Commit Graph

259139 Commits

Author SHA1 Message Date
Matthias Krüger
fe1f83ccd7
Rollup merge of #126906 - GrigorenkoPV:fixme-split_at_first, r=Mark-Simulacrum
Small fixme in core now that split_first has no codegen issues

https://github.com/rust-lang/rust/issues/109328#issuecomment-1677366881

BTW, I have a crate implementing exactly this kind of an iterator: https://github.com/GrigorenkoPV/head-tail-iter and I was wondering if it would be worthwhile to try and make an ACP for it to get it included in std (or maybe itertools). My only doubt is that it kinda incentives writing O(n^2) algorithms and is not the hard to replace with a `while let` loop (just as in this PR).
2024-06-30 10:39:47 +02:00
Matthias Krüger
c7aee65edd
Rollup merge of #126876 - WaffleLapkin:unignoreconfigtoml, r=Mark-Simulacrum
Add `.ignore` file to make `config.toml` searchable in vscode

Based on this answer on [Stack Overflow](https://stackoverflow.com/a/72059075).
2024-06-30 10:39:47 +02:00
Matthias Krüger
b2d46036c5
Rollup merge of #126705 - safinaskar:panic, r=Mark-Simulacrum
Updated docs on `#[panic_handler]` in `library/core/src/lib.rs`
2024-06-30 10:39:46 +02:00
bors
716752ebe6 Auto merge of #127133 - matthiaskrgr:rollup-jxkp3yf, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #123237 (Various rustc_codegen_ssa cleanups)
 - #126960 (Improve error message in tidy)
 - #127002 (Implement `x perf` as a separate tool)
 - #127081 (Add a run-make test that LLD is not being used by default on the x64 beta/stable channel)
 - #127106 (Improve unsafe extern blocks diagnostics)
 - #127110 (Fix a error suggestion for E0121 when using placeholder _ as return types on function signature.)
 - #127114 (fix: prefer `(*p).clone` to `p.clone` if the `p` is a raw pointer)
 - #127118 (Show `used attribute`'s kind for user when find it isn't applied to a `static` variable.)
 - #127122 (Remove uneccessary condition in `div_ceil`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-30 02:20:01 +00:00
bors
bf750f5db5 Auto merge of #126869 - matthiaskrgr:kaboom, r=jieyouxu
crashes: add more tests
2024-06-30 00:06:27 +00:00
Matthias Krüger
c79e08d3a6
Rollup merge of #127122 - TDecking:div_ceil, r=Nilstrieb
Remove uneccessary condition in `div_ceil`

Previously, `div_ceil` for unsigned integers had a `rhs > 0` for rounding. That condition however is always fulfilled, since `rhs == 0` would mean a division by zero earlier.
2024-06-29 22:10:59 +02:00
Matthias Krüger
5ea1a03cca
Rollup merge of #127118 - surechen:fix_126789, r=jieyouxu
Show `used attribute`'s kind for user when find it isn't applied to a `static` variable.

For example :
```rust
extern "C" {
    #[used] //~ ERROR attribute must be applied to a `static` variable
    static FOO: i32; // show the kind of this item to help user understand why the error is reported.
}
```

fixes #126789
2024-06-29 22:10:59 +02:00
Matthias Krüger
9879b4606c
Rollup merge of #127114 - linyihai:issue-126863, r=Nadrieril
fix: prefer `(*p).clone` to `p.clone` if the `p` is a raw pointer

Fixes https://github.com/rust-lang/rust/issues/126863

I wonder if there is a better way to solve the regression problem of this test case:
`tests/ui/borrowck/issue-20801.rs`.
It's okay to drop the dereference symbol in this scenario.

But it's not correct in https://github.com/rust-lang/rust/issues/126863

```
help: consider removing the dereference here
  |
5 -         let inner: String = *p;
5 +         let inner: String = p;
```

I haven't found out how to tell if clone pointer is allowed, i.e. no type mismatch occurs
2024-06-29 22:10:58 +02:00
Matthias Krüger
80cf576f59
Rollup merge of #127110 - surechen:fix_125488_06, r=compiler-errors
Fix a error suggestion for E0121 when using placeholder _ as return types on function signature.

Recommit after refactoring based on comment:
https://github.com/rust-lang/rust/pull/126017#issuecomment-2189149361

But when changing return type's lifetime to `ReError` will affect the subsequent borrow check process and cause test11 in typeck_type_placeholder_item.rs to lost E0515 message.
```rust
fn test11(x: &usize) -> &_ {
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types
    &x //~ ERROR cannot return reference to function parameter(this E0515 msg will disappear)
}
```

fixes #125488

r? ``@pnkfelix``
2024-06-29 22:10:58 +02:00
Matthias Krüger
77152955b8
Rollup merge of #127106 - spastorino:improve-unsafe-extern-blocks-diagnostics, r=compiler-errors
Improve unsafe extern blocks diagnostics

Closes #126327

For this code:

```rust
extern {
    pub fn foo();
    pub safe fn bar();
}
```

We get ...

```
error: items in unadorned `extern` blocks cannot have safety qualifiers
 --> test.rs:3:5
  |
3 |     pub safe fn bar();
  |     ^^^^^^^^^^^^^^^^^^
  |
help: add unsafe to this `extern` block
  |
1 | unsafe extern {
  | ++++++

error[E0658]: `unsafe extern {}` blocks and `safe` keyword are experimental
 --> test.rs:3:9
  |
3 |     pub safe fn bar();
  |         ^^^^
  |
  = note: see issue #123743 <https://github.com/rust-lang/rust/issues/123743> for more information
  = help: add `#![feature(unsafe_extern_blocks)]` to the crate attributes to enable

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0658`.
```

And then making the extern block unsafe, we get ...

```
error: extern block cannot be declared unsafe
 --> test.rs:1:1
  |
1 | unsafe extern {
  | ^^^^^^
  |
  = note: see issue #123743 <https://github.com/rust-lang/rust/issues/123743> for more information
  = help: add `#![feature(unsafe_extern_blocks)]` to the crate attributes to enable

error: items in unadorned `extern` blocks cannot have safety qualifiers
 --> test.rs:3:5
  |
3 |     pub safe fn bar();
  |     ^^^^^^^^^^^^^^^^^^

error[E0658]: `unsafe extern {}` blocks and `safe` keyword are experimental
 --> test.rs:3:9
  |
3 |     pub safe fn bar();
  |         ^^^^
  |
  = note: see issue #123743 <https://github.com/rust-lang/rust/issues/123743> for more information
  = help: add `#![feature(unsafe_extern_blocks)]` to the crate attributes to enable

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0658`.
```

r? ``@compiler-errors``
2024-06-29 22:10:57 +02:00
Matthias Krüger
fafb2ea57b
Rollup merge of #127081 - Kobzol:lld-test, r=onur-ozkan
Add a run-make test that LLD is not being used by default on the x64 beta/stable channel

https://github.com/rust-lang/rust/pull/126701 showed that the handling of `lld` in bootstrap is currently not ideal. While it would be nice to refactor it eventually, we should also make sure that we have a test that checks that `lld` is not used (yet!) by default on the x64 Linux stable channel.

CC ``@lqd``

r? ``@onur-ozkan``
2024-06-29 22:10:57 +02:00
Matthias Krüger
6d74ffd238
Rollup merge of #127002 - Kobzol:bootstrap-perf-tool, r=onur-ozkan
Implement `x perf` as a separate tool

Continues work from https://github.com/rust-lang/rust/pull/126318, adds a CLI for running `rustc-perf` profiling commands through a new `rustc-perf-wrapper` tool. The CLI is in a separate tool to enable experimentation outside of `bootstrap`.

This is probably most of what we can do so far, I'll add support for benchmarking once `rustc-perf` gets a terminal output for comparing benchmark results.

r? ``@onur-ozkan``
2024-06-29 22:10:56 +02:00
Matthias Krüger
6df68793f3
Rollup merge of #126960 - Kobzol:tidy-venv-message, r=tgross35
Improve error message in tidy

The old error message was wrong (there is no `venv` Python package on PyPi), and we did not specify the correct Python path in the error message.
2024-06-29 22:10:56 +02:00
Matthias Krüger
5b90824433
Rollup merge of #123237 - bjorn3:debuginfo_refactor, r=compiler-errors
Various rustc_codegen_ssa cleanups
2024-06-29 22:10:55 +02:00
bors
ba1d7f4a08 Auto merge of #120639 - fee1-dead-contrib:new-effects-desugaring, r=oli-obk
Implement new effects desugaring

cc `@rust-lang/project-const-traits.` Will write down notes once I have finished.

* [x] See if we want `T: Tr` to desugar into `T: Tr, T::Effects: Compat<true>`
* [x] Fix ICEs on `type Assoc: ~const Tr` and `type Assoc<T: ~const Tr>`
* [ ] add types and traits to minicore test
* [ ] update rustc-dev-guide

Fixes #119717
Fixes #123664
Fixes #124857
Fixes #126148
2024-06-29 20:08:10 +00:00
bors
d1b7355d3d Auto merge of #126801 - Oneirical:seek-and-testroy, r=Kobzol
Migrate `remap-path-prefix`, `debug-assertions` and `emit-stack-sizes` `run-make` tests to rmake

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

Needs OSX/MSVC try jobs.

try-job: aarch64-apple
try-job: x86_64-msvc
2024-06-29 17:50:06 +00:00
Santiago Pastorino
15d5dac32e
Avoid suggesting to add unsafe when the extern block is already unsafe 2024-06-29 14:40:32 -03:00
Jakub Beránek
6a2638e6c4 Autolabel rustc-perf-wrapper changes with t-bootstrap label 2024-06-29 16:07:39 +02:00
Jakub Beránek
f6f21a8f11 Review changes 2024-06-29 16:07:22 +02:00
bors
19a1d2b404 Auto merge of #127121 - GuillaumeGomez:rollup-xjjjckn, r=GuillaumeGomez
Rollup of 7 pull requests

Successful merges:

 - #126805 (Migrate `pdb-alt-path`, `mismatching-target-triples` and `mingw-export-call-convention` `run-make` tests to rmake)
 - #126995 (Migrate `pretty-print-with-dep-file`, `pretty-print-to-file` and `libtest-padding` `run-make` tests to rmake)
 - #127041 (Migrate `run-make/override-aliased-flags` to `rmake.rs`)
 - #127072 (docs: say "includes" instead of "does include")
 - #127073 (Remove unnecessary SeqCst in `impl fmt::Pointer for AtomicPtr`)
 - #127112 (Bootstrap: Don't get output if `lldb --version` errors)
 - #127116 (Migrate `run-make/return-non-c-like-enum` to `rmake.rs`)

Failed merges:

 - #127050 (Make mtime of reproducible tarballs dependent on git commit)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-29 14:00:29 +00:00
Tobias Decking
5dece2b2bd
Remove uneccessary condition in div_ceil 2024-06-29 15:08:59 +02:00
Askar Safin
28ba5e4124 Updated docs on #[panic_handler] in library/core/src/lib.rs 2024-06-29 15:59:52 +03:00
Guillaume Gomez
69f355a74b
Rollup merge of #127116 - GuillaumeGomez:run-make-return-non-c-like-enum, r=Kobzol,jieyouxu
Migrate `run-make/return-non-c-like-enum` to `rmake.rs`

Part of https://github.com/rust-lang/rust/issues/121876.

r? `@Kobzol`
2024-06-29 14:07:23 +02:00
Guillaume Gomez
38983df5c7
Rollup merge of #127112 - ChrisDenton:lldb, r=Kobzol
Bootstrap: Don't get output if `lldb --version` errors

fixes #126892

`Command` can error in two ways: the OS can fail to run the binary at all or else the binary can return an error exit code. Unfortunately the distinction between the two is not clear cut. The OS may succeed in starting the binary but it may still error before `main` (e.g. if a necessary library fails to load) and this will be reported via the exit code.

Fortunately this case is simpler. We can assume that `lldb --version` will only ever error if there's a startup issue of some kind. so both kinds of errors are caused by the OS. Thus it's safe for us to treat them equally for the sake of this specific check.
2024-06-29 14:07:22 +02:00
Guillaume Gomez
0886faaeea
Rollup merge of #127073 - Sky9x:unnecessary-seqcst, r=Nilstrieb
Remove unnecessary SeqCst in `impl fmt::Pointer for AtomicPtr`

Unnecessarily strict ordering.
2024-06-29 14:07:22 +02:00
Guillaume Gomez
e9594b504d
Rollup merge of #127072 - Sky9x:docs-includes-vs-does-include, r=scottmcm
docs: say "includes" instead of "does include"

Provides more visual difference between the negative ("does not include") and the positive ("includes"). Both phrases have the same meaning.
2024-06-29 14:07:22 +02:00
Guillaume Gomez
c1fb4e5947
Rollup merge of #127041 - GuillaumeGomez:run-make-override-aliased-flags, r=Kobzol
Migrate `run-make/override-aliased-flags` to `rmake.rs`

Part of https://github.com/rust-lang/rust/issues/121876.

I voluntarily didn't use the helper methods to make it obvious what's tested.

r? `@jieyouxu`
2024-06-29 14:07:21 +02:00
Guillaume Gomez
c70a2e30dd
Rollup merge of #126995 - Oneirical:test-friends-forever, r=Kobzol
Migrate `pretty-print-with-dep-file`, `pretty-print-to-file` and `libtest-padding` `run-make` tests to rmake

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).
2024-06-29 14:07:20 +02:00
Guillaume Gomez
06aeb679f6
Rollup merge of #126805 - Oneirical:weaves-of-testiny, r=Kobzol
Migrate `pdb-alt-path`, `mismatching-target-triples` and `mingw-export-call-convention` `run-make` tests to rmake

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

Needs MSVC try jobs.

try-job: x86_64-mingw
try-job: x86_64-msvc
2024-06-29 14:07:20 +02:00
Lin Yihai
8dc36c1647 fix: prefer (*p).clone to p.clone if the p is a raw pointer 2024-06-29 19:58:18 +08:00
bors
f8453359bb Auto merge of #127119 - RalfJung:miri-sync, r=RalfJung
Miri subtree update

r? `@ghost`
2024-06-29 11:44:01 +00:00
surechen
9c0ce05d24 Show used attribute's kind for user when find it isn't applied to a static variable.
fixes #126789
2024-06-29 19:39:09 +08:00
Guillaume Gomez
8cbeedac8d Migrate run-make/return-non-c-like-enum to rmake.rs 2024-06-29 12:29:37 +02:00
bors
9d920ed333 Auto merge of #3723 - RalfJung:win-tls-callback, r=RalfJung
iter_exported_symbols: also walk used statics in local crate

Since https://github.com/rust-lang/rust/pull/126938 got reverted, we need a different approach.

Fixes https://github.com/rust-lang/miri/issues/3722
2024-06-29 10:20:13 +00:00
Ralf Jung
66a885b25d iter_exported_symbols: also walk used statics in local crate 2024-06-29 12:17:10 +02:00
Guillaume Gomez
4ee077aa63 Migrate run-make/override-aliased-flags to rmake.rs 2024-06-29 11:55:30 +02:00
bors
be99243afc Auto merge of #127111 - matthiaskrgr:rollup-ybzkuuv, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #126822 (Bootstrap command refactoring: port more `Command` usages to `BootstrapCmd` (step 2))
 - #126835 (Simplifications in match lowering)
 - #126953 (std: separate TLS key creation from TLS access)
 - #127045 (Rename `super_predicates_of` and similar queries to `explicit_*` to note that they're not elaborated)
 - #127075 (rustc_data_structures: Explicitly check for 64-bit atomics support)
 - #127101 (remove redundant match statement from dataflow const prop)
 - #127102 (Rename fuchsia builder and bump Fuchsia)
 - #127103 (Move binder and polarity parsing into `parse_generic_ty_bound`)
 - #127108 (unify `dylib` and `bin_helpers` and create `shared_helpers::parse_value_from_args`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-29 09:29:41 +00:00
Jakub Beránek
4442fd7a09 Add a run-make test that LLD is not being used by default on the x64 beta/stable channel 2024-06-29 10:10:59 +02:00
Chris Denton
a6ef91e414
Update test.rs 2024-06-29 07:57:58 +00:00
Matthias Krüger
c59e7fd95b crashes: add more tests 2024-06-29 09:33:28 +02:00
bors
abb5826e3d Auto merge of #3721 - rust-lang:rustup-2024-06-29, r=RalfJung
Automatic Rustup
2024-06-29 07:33:09 +00:00
Chris Denton
fa12064d6d
Don't get output if lldb --version errors 2024-06-29 07:27:25 +00:00
Matthias Krüger
8fe770165f
Rollup merge of #127108 - onur-ozkan:bin-helper, r=Kobzol
unify `dylib` and `bin_helpers` and create `shared_helpers::parse_value_from_args`

`dylib` and `bin_helpers` were already used in similar logic. This PR unifies them under a `shared_helpers` module that is utilized by both the bootstrap library and shims. Additionally, created `parse_value_from_args` with a unit test.  This helps avoid code duplication in shims and can also be used in the bootstrap library if needed (which is the case in one of `@Kobzol's` tasks).

r? `@Kobzol`
2024-06-29 09:14:59 +02:00
Matthias Krüger
a4e92bfef0
Rollup merge of #127103 - compiler-errors:tighten-trait-bound-parsing, r=fmease
Move binder and polarity parsing into `parse_generic_ty_bound`

Let's pull out the parts of #127054 which just:
1. Make the parsing code less confusing
2. Fix `?use<>` (to correctly be denied)
3. Improve `T: for<'a> 'a` diagnostics

This should have no user-facing effects on stable parsing.

r? fmease
2024-06-29 09:14:59 +02:00
Matthias Krüger
367a80ce9e
Rollup merge of #127102 - tmandry:rename-fuchsia-builder, r=Kobzol
Rename fuchsia builder and bump Fuchsia

This PR renames the fuchsia builder as requested in https://github.com/rust-lang/rustc-dev-guide/pull/1989#pullrequestreview-2148682346 and bumps Fuchsia.

This includes the quality-of-life improvements for developers in https://fxrev.dev/1061894. It also removes the wasm target, which should speed up the build a little.

The new name of the builder is `x86_64-fuchsia` because I think `x86_64-gnu-fuchsia` would be confusing and put too much emphasis on the host target. (In terms of triples, we are targeting `x86_64-unknown-fuchsia` from `x86_64-unknown-linux-gnu`.) Someone on the infra team should weigh in here.

After this lands, we should update the docs in the rustc-dev-guide again.

cc `@lqd`
r? t-infra

try-job: x86_64-fuchsia
2024-06-29 09:14:58 +02:00
Matthias Krüger
c1d7ff55b5
Rollup merge of #127101 - matthiaskrgr:thonk, r=compiler-errors
remove redundant match statement from dataflow const prop
2024-06-29 09:14:58 +02:00
Matthias Krüger
3369e8364b
Rollup merge of #127075 - glaubitz:copy-and-paste-fix, r=SparrowLii
rustc_data_structures: Explicitly check for 64-bit atomics support

Instead of keeping a list of architectures which have native support
for 64-bit atomics, just use #[cfg(target_has_atomic = "64")] and its
inverted counterpart to determine whether we need to use portable
AtomicU64 on the target architecture.
2024-06-29 09:14:57 +02:00
Matthias Krüger
e9d5a2f45f
Rollup merge of #127045 - compiler-errors:explicit, r=oli-obk
Rename `super_predicates_of` and similar queries to `explicit_*` to note that they're not elaborated

Rename:
* `super_predicates_of` -> `explicit_super_predicates_of`
* `implied_predicates_of` -> `explicit_implied_predicates_of`
* `supertraits_containing_assoc_item` -> `explicit_supertraits_containing_assoc_item`

This makes it clearer that, unlike (for example) [`TyCtxt::super_traits_of`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.super_traits_of), we don't automatically elaborate this set of predicates.

r? ``@lcnr`` or ``@oli-obk`` or someone from t-types idc
2024-06-29 09:14:57 +02:00
Matthias Krüger
1e39eb7d53
Rollup merge of #126953 - joboet:lazy_key, r=jhpratt
std: separate TLS key creation from TLS access

Currently, `std` performs an atomic load to get the OS key on every access to `StaticKey` even when the key is already known. This PR thus replaces `StaticKey` with the platform-specific `get` and `set` function and a new `LazyKey` type that acts as a `LazyLock<Key>`, allowing the reuse of the retreived key for multiple accesses.

Related to #110897.
2024-06-29 09:14:56 +02:00
Matthias Krüger
806c5c1971
Rollup merge of #126835 - Nadrieril:reify-decision-tree, r=matthewjasper
Simplifications in match lowering

A series of small simplifications and deduplications in the MIR lowering of patterns.

r? ````@matthewjasper````
2024-06-29 09:14:56 +02:00