Commit graph

259115 commits

Author SHA1 Message Date
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 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
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
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
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
Matthias Krüger dfa68f1d62
Rollup merge of #126822 - Kobzol:bootstrap-cmd-refactor-2, r=onur-ozkan
Bootstrap command refactoring: port more `Command` usages to `BootstrapCmd` (step 2)

This PR moves more of bootstrap to use `BooststrapCmd`, and also refactors the struct to allow it to serve as a proper command wrapper.

Tracking issue: https://github.com/rust-lang/rust/issues/126819

Best reviewed commit-by-commit, I have been adding some helper impls along the way to ease the migration, and then later I remove some of them since they were no longer needed.

r? `@onur-ozkan`
2024-06-29 09:14:55 +02:00
bors 38d0f87a49 Auto merge of #126698 - Oneirical:tessteract, r=Kobzol
Migrate `unknown-mod-stdin`, `issue-68794-textrel-on-minimal-lib`, `raw-dylib-cross-compilation` and `used-cdylib-macos` `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).

Seriously needs OSX/Windows try-jobs. If it fails, restore `only-linux` in `textrel-on-minimal-lib` and try again.

try-job: x86_64-mingw
try-job: x86_64-msvc
2024-06-29 07:12:17 +00:00
onur-ozkan 9098474dad create shared_helpers::parse_value_from_args
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-06-29 09:43:58 +03:00
surechen 50edb32939 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)
}

```
2024-06-29 14:23:33 +08:00
The Miri Cronjob Bot ec7bcc0357 Merge from rustc 2024-06-29 05:20:59 +00:00
onur-ozkan 0afc774e9d unify bin_helpers and dylib utility modules
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-06-29 08:17:44 +03:00
The Miri Cronjob Bot 64c8366ca2 Preparing for merge from rustc 2024-06-29 05:13:25 +00:00
bors d38cd229b7 Auto merge of #127096 - matthiaskrgr:rollup-kh7e0rh, r=matthiaskrgr
Rollup of 11 pull requests

Successful merges:

 - #123714 (Add test for fn pointer duplication.)
 - #124091 (Update AST validation module docs)
 - #127015 (Switch back `non_local_definitions` lint to allow-by-default)
 - #127016 (docs: check if the disambiguator matches its suffix)
 - #127029 (Fix Markdown tables in platform-support.md)
 - #127032 (Enable const casting for `f16` and `f128`)
 - #127055 (Mark Hasher::finish as #[must_use])
 - #127068 (Stall computing instance for drop shim until it has no unsubstituted const params)
 - #127070 (add () to the marker_impls macro for ConstParamTy)
 - #127071 (Remove (deprecated & unstable) {to,from}_bits pointer methods)
 - #127078 (Enable full tools and profiler for LoongArch Linux targets)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-29 05:00:11 +00:00
Santiago Pastorino a62cbda57e
Add feature diagnostic for unsafe_extern_blocks 2024-06-28 23:13:33 -03:00
bors 9ed2ab3790 Auto merge of #127099 - lqd:revert-126938, r=compiler-errors
Revert "miri: make sure we can find link_section statics even for the local crate"

This PR reverts #126938 as [requested by its author](https://github.com/rust-lang/rust/issues/127052#issuecomment-2196793473), to fix the #127052 regression.

Fixes #127052

We should probably improve the [`used` rmake test(s)](57931e5040/tests/run-make/used/rmake.rs (L7)) in the future, but this should do for now.
2024-06-28 23:43:57 +00:00
Michael Goulet 3bc3247200 Move binder and polarity parsing into parse_generic_ty_bound 2024-06-28 19:40:31 -04:00
Tyler Mandry 078d9d8aa9 Rename x86_64-gnu-integration builder to x86_64-fuchsia
This better reflects what the builder actually does.
2024-06-28 16:08:57 -07:00