305295 Commits

Author SHA1 Message Date
Ralf Jung
36376bc5a5
Merge pull request #4580 from JoJoDeveloping/fix-4579-protector-0sized
Fix #4579 by checking if the strong protector is actually "active".
2025-09-11 17:49:09 +00:00
Johannes Hostert
16b34c6f70
move zero-sized protector dealloc test 2025-09-11 19:15:50 +02:00
Ralf Jung
166af83c69
Merge pull request #4577 from RalfJung/release-seq
Fix release/scquire synchonization for loads from the store buffer
2025-09-11 15:43:36 +00:00
Johannes Hostert
2b5b191965
Fix miri issue 4579 by checking if the strong protector is actually "active".
Where "active" means that the accessed bit is set.

This also reverts miri PR 3831.
2025-09-11 17:18:20 +02:00
Ralf Jung
24d195bc07 weak_memory: fix sync clock handling when loading from old store elements 2025-09-11 17:14:58 +02:00
Ralf Jung
ad6004d953 add release sequence test 2025-09-11 11:25:03 +02:00
Ralf Jung
906bfe94ed
Merge pull request #4576 from rust-lang/rustup-2025-09-11
Automatic Rustup
2025-09-11 08:50:21 +00:00
The Miri Cronjob Bot
3790e37ca2 Merge ref 'f4665ab8368a' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: f4665ab8368ad2e8a86d4390ae35c28bdd9561bb
Filtered ref: d2e3c00d12fb613c03777e620c50528112247ad2
Upstream diff: a09fbe2c83...f4665ab836

This merge was created using https://github.com/rust-lang/josh-sync.
2025-09-11 05:01:01 +00:00
Jeremy Smart
1a1510816a
handle const generics, ?Sized, early bound lifetimes 2025-09-16 10:17:25 -04:00
The Miri Cronjob Bot
68bff8cb9d Prepare for merging from rust-lang/rust
This updates the rust-version file to f4665ab8368ad2e8a86d4390ae35c28bdd9561bb.
2025-09-11 04:53:20 +00:00
Ralf Jung
52fb37121b
Merge pull request #4575 from RalfJung/weakmem-origin
weak memory tests: add more info on where they come from, and test list of behaviors more thoroughly
2025-09-10 21:31:11 +00:00
bors
f4665ab836 Auto merge of #146418 - matthiaskrgr:rollup-za0lrux, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#145327 (std: make address resolution weirdness local to SGX)
 - rust-lang/rust#145879 (default auto traits: use default supertraits instead of `Self: Trait` bounds on associated items)
 - rust-lang/rust#146123 (Suggest examples of format specifiers in error messages)
 - rust-lang/rust#146311 (Minor symbol comment fixes.)
 - rust-lang/rust#146322 (Make Barrier RefUnwindSafe again)
 - rust-lang/rust#146327 (Add tests for deref on pin)
 - rust-lang/rust#146340 (Strip frontmatter in fewer places)
 - rust-lang/rust#146342 (Improve C-variadic error messages: part 2)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-09-10 21:30:05 +00:00
Ralf Jung
f8302a7c15 add release sequence test 2025-09-10 23:01:15 +02:00
Matthias Krüger
bb45ea3acc
Rollup merge of #146342 - folkertdev:c-variadic-errors-take-3, r=workingjubilee
Improve C-variadic error messages: part 2

tracking issue: https://github.com/rust-lang/rust/issues/44930

a reimplementation of https://github.com/rust-lang/rust/pull/143546 that builds on https://github.com/rust-lang/rust/pull/146165.

This PR

- disallows coroutines (e.g. `async fn`) from having a `...` argument
- disallows associated functions (both in traits and standard impl blocks) from having a `...` argument
- splits up a generic "ill-formed C-variadic function" into specific errors about using an incorrect ABI, not specifying an ABI, or missing the unsafe keyword

C-variadic coroutines probably don't make sense? C-variadic functions are for FFI purposes, combining that with async functions seems weird.

For associated functions, we're just cutting scope. It's probably fine, but it's probably better to explicitly allow it. So for now, at least give a more targeted error message.

Made to be reviewed commit-by-commit.

cc `@workingjubilee`
r? compiler
2025-09-10 20:29:10 +02:00
Matthias Krüger
86d39a0673
Rollup merge of #146340 - fmease:frontmatter-containment, r=fee1-dead,Urgau
Strip frontmatter in fewer places

* Stop stripping frontmatter in `proc_macro::Literal::from_str` (RUST-146132)
* Stop stripping frontmatter in expr-ctxt (but not item-ctxt!) `include`s (RUST-145945)
* Stop stripping shebang (!) in `proc_macro::Literal::from_str`
  * Not a breaking change because it did compare spans already to ensure there wasn't extra whitespace or comments (`Literal::from_str("#!\n0")` already yields `Err(_)` thankfully!)
* Stop stripping frontmatter+shebang inside some rustdoc code where it doesn't make any observable difference (see self review comments)
* (Stop stripping frontmatter+shebang inside internal test code)

Fixes https://github.com/rust-lang/rust/issues/145945.
Fixes https://github.com/rust-lang/rust/issues/146132.

r? fee1-dead
2025-09-10 20:29:09 +02:00
Matthias Krüger
868226b8b2
Rollup merge of #146327 - Darksonn:pin-deref-tests, r=lcnr
Add tests for deref on pin

Tests split out from rust-lang/rust#145608.

r? `@lcnr`
2025-09-10 20:29:08 +02:00
Matthias Krüger
d061896a37
Rollup merge of #146322 - weiznich:fix/146087, r=joboet
Make Barrier RefUnwindSafe again

This commit manually implements `RefUnwindSafe` for `std::sync::Barrier` to fix rust-lang/rust#146087. This is a fix for a regression indroduced by e95db591a4
2025-09-10 20:29:07 +02:00
Matthias Krüger
4a834b54d4
Rollup merge of #146311 - nnethercote:symbol-comments, r=petrochenkov
Minor symbol comment fixes.

- The empty symbol is no longer a keyword.
- I don't think any of the special reserved identifiers are used for error recovery.

r? ```@petrochenkov```
2025-09-10 20:29:06 +02:00
Matthias Krüger
f48c1d85b2
Rollup merge of #146123 - IoaNNUwU:issue-68293, r=estebank
Suggest examples of format specifiers in error messages

Format macro now suggests adding `{}` if no formatting specifiers are present. It also gives an example:
```rust
LL |     println!("Hello", "World");
   |              -------  ^^^^^^^ argument never used
   |              |
   |              formatting specifier missing
   |
   = note: format specifiers use curly braces: `{}`
help: consider adding format specifier
   |
LL |     println!("Hello{}", "World");
   |                    ++
```
When one or more `{}` are present, it doesn't show 'format specifiers use curly braces: `{}`' and example, just small hint on how many you missing:
```rust
LL |     println!("list: {}", 1, 2, 3);
   |              ----------     ^  ^ argument never used
   |              |              |
   |              |              argument never used
   |              multiple missing formatting specifiers
   |
   = help: consider adding 2 format specifiers
```

Original issue: rust-lang/rust#68293
Based on discussion in this PR: rust-lang/rust#76443

Let me know if something is missing
2025-09-10 20:29:06 +02:00
Matthias Krüger
fc6beb3034
Rollup merge of #145879 - Bryanskiy:supertraits-2, r=lcnr
default auto traits: use default supertraits instead of `Self: Trait` bounds on associated items

First commit: the motivation has been discussed [here](https://github.com/rust-lang/rust/pull/144679).

Second commit:  the only new places where new implicit `DefaultAutoTrait` bounds are generated are supertraits and trait object so `?Trait` syntax should be extended to these places only.

r? `@lcnr`
2025-09-10 20:29:05 +02:00
Matthias Krüger
e79630da0b
Rollup merge of #145327 - joboet:net-addr-sgx-hack, r=tgross35
std: make address resolution weirdness local to SGX

Currently, the implementations of `TcpStream::connect` and its cousins take an `io::Result<&SocketAddr>` as argument, which is very weird, as most of them then `?`-try the result immediately to access the actual address. This weirdness is however necessitated by a peculiarity of the SGX networking implementation:

SGX doesn't support DNS resolution but rather accepts hostnames in the same place as socket addresses. So, to make e.g.
```rust
TcpStream::connect("example.com:80")`
```
work, the DNS lookup returns a special error (`NonIpSockAddr`) instead, which contains the hostname being looked up. When `.to_socket_addrs()` fails, the `each_addr` function used to select an address will pass the error to the inner `TcpStream::connect` implementation, which in SGX's case will inspect the error and try recover the hostname from it. If
that succeeds, it continues with the found hostname.

This is pretty obviously a terrible hack and leads to buggy code (for instance, when users use the result of `.to_socket_addrs()` in their own `ToSocketAddrs` implementation to select from a list of possible URLs, the only URL used will be that of the last item tried). Still, without changes to the SGX usercall ABI, it cannot be avoided.

Therefore, this PR aims to minimise the impact of that weirdness and remove it from all non-SGX platforms. The inner `TcpStream::connect`, et al. functions now receive the `ToSocketAddrs` type directly and call `each_addr` (which is moved to `sys::net::connection`) themselves. On SGX, the implementation uses a special `each_addr` which contains the whole pass-hostname-through-error hack.

As well as making the code cleaner, this also opens up the possibility of reusing newly created sockets even if a connection request fails – but I've left that for another PR.

CC `@raoulstrackx`
2025-09-10 20:29:04 +02:00
Ralf Jung
7d5413bd17 this apparently needs more test rounds 2025-09-10 17:59:08 +02:00
Ralf Jung
827a6541e6 move all weak memory tests into their folder 2025-09-10 17:14:29 +02:00
Ralf Jung
655b847434 also use nicer check_all_outcomes in float_nan 2025-09-10 17:14:29 +02:00
bors
565a9ca63e Auto merge of #146409 - matthiaskrgr:rollup-thju381, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#144765 (inclusive `Range`s: change `end` to `last`)
 - rust-lang/rust#146178 (Implement `#[rustc_align_static(N)]` on `static`s)
 - rust-lang/rust#146368 (CI: rfl: move job forward to Linux v6.17-rc5 to remove temporary commits)
 - rust-lang/rust#146378 (Update wasm-component-ld to 0.5.17)
 - rust-lang/rust#146391 (Trim paths less in MIR dumping)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-09-10 15:09:18 +00:00
Ralf Jung
21e3111ef9 refactor weak-mem test to list all expected executions 2025-09-10 16:35:17 +02:00
Ralf Jung
0e0b254df9 ensure we do not see the inconsistent execution from Figure 8 2025-09-10 16:16:49 +02:00
Ralf Jung
edbc0a08fb weak memory tests: add more info on where they come from 2025-09-10 16:09:28 +02:00
Matthias Krüger
212baec446
Rollup merge of #146391 - beepster4096:trimnt, r=saethlin
Trim paths less in MIR dumping

With this PR, the paths MIR dump filters and that are printed at the start of a dump file are no longer trimmed. They don't include the crate that is being compiled, however.
2025-09-10 14:17:40 +02:00
Matthias Krüger
29cbf41517
Rollup merge of #146378 - alexcrichton:update-wasm-component-ld, r=lqd
Update wasm-component-ld to 0.5.17

Keeping this up-to-date as the project itself, and its dependencies, are updated.
2025-09-10 14:17:39 +02:00
Matthias Krüger
f0bf4f3d6b
Rollup merge of #146368 - ojeda:rfl, r=lqd
CI: rfl: move job forward to Linux v6.17-rc5 to remove temporary commits

v6.17-rc5 contains the equivalent of the two commits we had here, thus move the Rust for Linux job forward to that so that we don't need the temporary commits anymore.

r? ```@lqd``` ```@Kobzol```
try-job: x86_64-rust-for-linux
```@rustbot``` label A-rust-for-linux
```@bors``` try
2025-09-10 14:17:39 +02:00
Matthias Krüger
422c76adae
Rollup merge of #146178 - folkertdev:static-align, r=jdonszelmann,ralfjung,traviscross
Implement `#[rustc_align_static(N)]` on `static`s

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

```rust
#![feature(static_align)]

#[rustc_align_static(64)]
static SO_ALIGNED: u64 = 0;
```

We need a different attribute than `rustc_align` because unstable attributes are tied to their feature (we can't have two unstable features use the same unstable attribute). Otherwise this uses all of the same infrastructure as `#[rustc_align]`.

r? `@traviscross`
2025-09-10 14:17:38 +02:00
Matthias Krüger
d0ba5e33ff
Rollup merge of #144765 - Qelxiros:range-inclusive-last, r=jhpratt
inclusive `Range`s: change `end` to `last`

Tracking issue: rust-lang/rust#125687
ACP: rust-lang/libs-team#511
2025-09-10 14:17:37 +02:00
Bryanskiy
3ab7b397bb Permit more_maybe_bounds in supertraits and trait objects only 2025-09-10 15:08:08 +03:00
Bryanskiy
bd089e1e6e Default auto traits: revert to the default supertraits 2025-09-10 15:08:06 +03:00
Georg Semmler
ef7b036458
Add suggestions 2025-09-10 07:55:03 +02:00
beepster4096
90e74de473 don't trim paths in mir dumping when filtering and at the top of the file 2025-09-09 16:23:14 -07:00
Folkert de Vries
cbacd00f10
allow #[rustc_align_static(N)] on statics
We need a different attribute than `rustc_align` because unstable attributes are
tied to their feature (we can't have two unstable features use the same
unstable attribute). Otherwise this uses all of the same infrastructure
as `#[rustc_align]`.
2025-09-09 21:54:54 +02:00
Folkert de Vries
9196844f0d
c-variadic: reject functions with unsupported extern ABI 2025-09-09 21:38:38 +02:00
Folkert de Vries
0c96200f26
c-variadic: reject non-unsafe functions 2025-09-09 21:30:38 +02:00
bors
7ad23f43a2 Auto merge of #146375 - matthiaskrgr:rollup-utik9zj, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#145463 (Reject invalid literal suffixes in tuple indexing, tuple struct indexing, and struct field name position)
 - rust-lang/rust#145929 (fix APITIT being treated as a normal generic parameter in suggestions)
 - rust-lang/rust#146001 (Update getopts to remove unicode-width dependency)
 - rust-lang/rust#146365 (triagebot: warn about #[rustc_intrinsic_const_stable_indirect])
 - rust-lang/rust#146366 (add approx_delta to all gamma tests)
 - rust-lang/rust#146373 (fix comments about trait solver cycle heads)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-09-09 18:14:23 +00:00
León Orell Valerian Liehr
7a66925a81
Strip frontmatter in fewer places 2025-09-09 19:49:40 +02:00
Alex Crichton
6e36750c61 Update wasm-component-ld to 0.5.17
Keeping this up-to-date as the project itself, and its dependencies, are
updated.
2025-09-09 10:30:03 -07:00
Matthias Krüger
a40ec4c50a
Rollup merge of #146373 - calvinhirsch:trait-solver-cycle-head-docs, r=lcnr
fix comments about trait solver cycle heads

update some comments that use "cycle root" rather than "cycle head"
also fixed a random other nearby typo in `StackEntry` docs

zulip thread: https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/quick.20question.20about.20SearchGraph.3A.3Aevaluate_goal_in_task/with/538004295

?r lcnr
2025-09-09 17:32:23 +02:00
Matthias Krüger
542130f729
Rollup merge of #146366 - LorrensP-2158466:miri-gamma, r=RalfJung
add approx_delta to all gamma tests

f32::gamma tests are less precise in CI, so we increase the tolerance for these tests. See [#miri > Miri test-libstd Failure (2025-09) @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/269128-miri/topic/Miri.20test-libstd.20Failure.20.282025-09.29/near/538138742)

r? `@RalfJung`
2025-09-09 17:32:23 +02:00
Matthias Krüger
af4cecebd9
Rollup merge of #146365 - RalfJung:triagebot-rustc_intrinsic_const_stable_indirect, r=jieyouxu
triagebot: warn about #[rustc_intrinsic_const_stable_indirect]

Also make the warnings a bit more noticeable by adding a ⚠️.
2025-09-09 17:32:22 +02:00
Matthias Krüger
f46ddbab2f
Rollup merge of #146001 - bjorn3:update_getopts, r=davidtwco
Update getopts to remove unicode-width dependency

Pulls in https://github.com/rust-lang/getopts/pull/133. This saves 1.5MB on the vendored size of the standard library.
2025-09-09 17:32:21 +02:00
Matthias Krüger
85f3989ca5
Rollup merge of #145929 - Qelxiros:apitit-suggestion, r=BoxyUwU
fix APITIT being treated as a normal generic parameter in suggestions

closes rust-lang/rust#126395
2025-09-09 17:32:20 +02:00
Matthias Krüger
12e548704e
Rollup merge of #145463 - jieyouxu:error-suffix, r=fmease
Reject invalid literal suffixes in tuple indexing, tuple struct indexing, and struct field name position

Tracking issue: rust-lang/rust#60210
Closes rust-lang/rust#60210

## Summary

Bump the ["suffixes on a tuple index are invalid" non-lint pseudo future-incompatibility warning (#60210)][issue-60210][^non-lint] to a **hard error** across all editions, rejecting the remaining carve outs from accidentally accepted invalid suffixes since Rust **1.27**.

- We accidentally accepted invalid suffixes in tuple indexing positions in Rust **1.27**. Originally reported at https://github.com/rust-lang/rust/issues/59418.
- We tried to hard reject all invalid suffixes in https://github.com/rust-lang/rust/pull/59421, but unfortunately it turns out there were proc macros accidentally relying on it: https://github.com/rust-lang/rust/issues/60138.
- We temporarily accepted `{i,u}{32,size}` in https://github.com/rust-lang/rust/pull/60186 (the "*carve outs*") to mitigate *immediate* ecosystem impact, but it came with an FCW warning indicating that we wanted to reject it after a few Rust releases.
- Now (1.89.0) is a few Rust releases later (1.35.0), thus I'm proposing to **also reject the carve outs**.
    - `std::mem::offset_of!` stabilized in Rust **1.77.0** happens to use the same "don't expect suffix" code path which has the carve outs, so it also accepted the carve out suffixes. I'm proposing to **reject this case as well**.

## What specifically breaks?

Code that still relied on invalid `{i,u}{32,size}` suffixes being temporarily accepted by rust-lang/rust#60186 as an ecosystem impact mitigation measure (cf. rust-lang/rust#60138). Specifically, the following cases (particularly the construction of these forms in proc macros like reported in rust-lang/rust#60138):

### Position 1: Invalid `{i,u}{32,size}` suffixes in tuple indexing

```rs
fn main() {
    let _x = (42,).0invalid; // Already error, already rejected by #59421
    let _x = (42,).0i8;      // Already error, not one of the #60186 carve outs.
    let _x = (42,).0usize;   // warning: suffixes on a tuple index are invalid
}
```

### Position 2: Invalid `{i,u}{32,size}` suffixes in tuple struct indexing

```rs
fn main() {
    struct X(i32);
    let _x = X(42);
	let _x = _x.0invalid; // Already error, already rejected by #59421
    let _x = _x.0i8;      // Already error, not one of the #60186 carve outs.
    let _x = _x.0usize;   // warning: suffixes on a tuple index are invalid
}
```

### Position 3: Invalid `{i,u}{32,size}` suffixes in numeric struct field names

```rs
fn main() {
    struct X(i32, i32, i32);
    let _x = X(1, 2, 3);
    let _y = X { 0usize: 42, 1: 42, 2: 42 };    // warning: suffixes on a tuple index are invalid
	match _x {
        X { 0usize: 1, 1: 2, 2: 3 } => todo!(), // warning: suffixes on a tuple index are invalid
        _ => {}
    }
}
```

### Position 4: Invalid `{i,u}{32,size}` suffixes in `std::mem::offset_of!`

While investigating the warning, unfortunately I noticed `std::mem::offset_of!` also happens to use the "expect no suffix" code path which had the carve outs. So this was accepted since Rust **1.77.0** with the same FCW:

```rs
fn main() {
    #[repr(C)]
    pub struct Struct<T>(u8, T);

    assert_eq!(std::mem::offset_of!(Struct<u32>, 0usize), 0);
    //~^ WARN suffixes on a tuple index are invalid
}
```

### The above forms in proc macros

For instance, constructions like (see tracking issue rust-lang/rust#60210):

```rs
let i = 0;
quote! { foo.$i }
```

where the user needs to actually write

```rs
let i = syn::Index::from(0);
quote! { foo.$i }
```

### Crater results

Conducted a crater run (https://github.com/rust-lang/rust/pull/145463#issuecomment-3194920383).

- 256af3c72f: genuine regression; "invalid suffix `usize`" in derive macro. Has a ton of other build warnings, last updated 6 years ago.
    - Exactly the kind of intended breakage. Minimized down to 256af3c72f/validates_derive/src/lib.rs (L71-L75), where when interpolation uses `quote`'s `ToTokens` on a `usize` index (i.e. on tuple struct `Tup(())`), the generated suffix becomes `.0usize` (cf. Position 2).
    - Notified crate author of breakage in https://github.com/AmlingPalantir/r4/issues/1.
- Other failures are unrelated or spurious.

## Review remarks

- Commits 1-3 expands the test coverage to better reflect the current situation before doing any functional changes.
- Commit 4 is an intentional **breaking change**. We bump the non-lint "suffixes on a tuple index are invalid" warning into a hard error. Thus, this will need a crater run and a T-lang FCP.

## Tasks

- [x] Run crater to check if anyone is still relying on this being not a hard error. Determine degree of ecosystem breakage.
- [x] If degree of breakage seems acceptable, draft nomination report for T-lang for FCP.
- [x] Determine hard error on Edition 2024+, or on all editions.

## Accompanying Reference update

- https://github.com/rust-lang/reference/pull/1966

[^non-lint]: The FCW was implemented as a *non-lint* warning (meaning it has no associated lint name, and you can't `#![deny(..)]` it) because spans coming from proc macros could not be distinguished from regular field access. This warning was also intentionally impossible to silence. See https://github.com/rust-lang/rust/pull/60186#issuecomment-485581694.

[issue-60210]: https://github.com/rust-lang/rust/issues/60210
2025-09-09 17:32:20 +02:00
León Orell Valerian Liehr
ec87250101
Improve docs of certain built-in macro expanders 2025-09-09 17:16:50 +02:00