Skip to content

Commit 97e669f

Browse files
NoratriebWaffleLapkin
authored andcommitted
Update to nightly-2025-11-02
A bunch of error messages changed. This also brings in thread IDs in panic messages, which we need to normalize away. I first tried implementing this normalization without regex, but it didn't work first try, so I chose regex, which is simpler. Also updated the builder to edition 2024 (since my initial implementation required let chains) which requires using unsafe for `remove_var`, but that's trivial unsafe that's fine. I also added a note about the current version to the index.
1 parent a42c445 commit 97e669f

20 files changed

+122
-38
lines changed

builder/Cargo.lock

Lines changed: 46 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

builder/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
[package]
22
name = "builder"
33
version = "0.1.0"
4-
edition = "2021"
4+
edition = "2024"
55

66
[dependencies]
77
eyre = "0.6.12"
8+
regex = "1.12.2"

builder/src/main.rs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
use std::{path::Path, thread};
22

3-
use eyre::{ensure, Context, OptionExt};
3+
use eyre::{Context, OptionExt, ensure};
4+
use regex::Regex;
45

56
fn main() -> eyre::Result<()> {
67
// Ensure rustup picks up the rust-toolchain.toml file properly and doesn't get confused by this cargo run.
7-
std::env::remove_var("CARGO");
8-
std::env::remove_var("RUSTUP_TOOLCHAIN");
8+
// SAFETY: This is at the start of main, no other threads are running.
9+
unsafe {
10+
std::env::remove_var("CARGO");
11+
std::env::remove_var("RUSTUP_TOOLCHAIN");
12+
}
913

1014
let root_dir = Path::new("..")
1115
.canonicalize()
@@ -87,7 +91,8 @@ fn run_example(examples_dir: &Path, filename: &str) -> eyre::Result<()> {
8791
cmd.arg(example_name);
8892

8993
let out = cmd.output().wrap_err("spawning cargo")?;
90-
let stderr = String::from_utf8(out.stderr).wrap_err("stderr was invalid UTF-8")?;
94+
let stderr =
95+
normalize_stderr(String::from_utf8(out.stderr).wrap_err("stderr was invalid UTF-8")?);
9196

9297
let stderr_dir = examples_dir.join("stderr");
9398
let path = stderr_dir.join(format!("{example_name}.stderr"));
@@ -97,6 +102,15 @@ fn run_example(examples_dir: &Path, filename: &str) -> eyre::Result<()> {
97102
Ok(())
98103
}
99104

105+
fn normalize_stderr(stderr: String) -> String {
106+
// thread 'main' (16399) panicked -> thread 'main' (???) panicked
107+
108+
Regex::new(r"thread 'main' \(\d+\) panicked")
109+
.unwrap()
110+
.replace(&stderr, "thread 'main' (???) panicked")
111+
.into()
112+
}
113+
100114
/// Ensures there is output for the toolchain and that the installation doesn't pollute stderr.
101115
fn install_toolchain() -> eyre::Result<()> {
102116
let mut toolchain_install = std::process::Command::new("rustc");

code/examples/stderr/borrowck_1.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ error[E0308]: mismatched types
1111
note: function defined here
1212
--> examples/borrowck_1.rs:5:4
1313
|
14-
5 | fn accepts_func(f: fn(&u32), data: &u32) {
14+
5 | fn accepts_func(f: fn(&u32), data: &u32) {
1515
| ^^^^^^^^^^^^ -----------
1616

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

code/examples/stderr/borrowck_4.stderr

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ error[E0505]: cannot move out of `foo` because it is borrowed
1111
| move out of `foo` occurs here
1212
| borrow later used here
1313
|
14+
note: if `Foo<'_>` implemented `Clone`, you could clone the value
15+
--> examples/borrowck_4.rs:2:1
16+
|
17+
2 | struct Foo<'a>(&'a mut u32);
18+
| ^^^^^^^^^^^^^^ consider implementing `Clone` for this type
19+
...
20+
7 | mutate(&mut foo);
21+
| --- you could clone this value
1422
= note: this error originates in the macro `dbg` (in Nightly builds, run with -Z macro-backtrace for more info)
1523

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

code/examples/stderr/borrowck_6.stderr

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,18 @@ error[E0382]: use of moved value: `x`
1111
note: consider changing this parameter type in function `r2_once` to borrow instead if owning the value isn't necessary
1212
--> examples/borrowck_6.rs:5:15
1313
|
14-
5 | fn r2_once(_: R2){}
14+
5 | fn r2_once(_: R2){}
1515
| ------- ^^ this parameter takes ownership of the value
1616
| |
1717
| in this function
18+
note: if `R2<'_>` implemented `Clone`, you could clone the value
19+
--> examples/borrowck_6.rs:2:1
20+
|
21+
2 | struct R2<'a>(&'a mut i32);
22+
| ^^^^^^^^^^^^^ consider implementing `Clone` for this type
23+
...
24+
13 | r2_once(x);
25+
| - you could clone this value
1826

1927
For more information about this error, try `rustc --explain E0382`.
2028
error: could not compile `code` (example "borrowck_6") due to 1 previous error

code/examples/stderr/misc_10.stderr

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
error[E0277]: `*const i32` cannot be sent between threads safely
2-
--> examples/misc_10.rs:12:19
2+
--> examples/misc_10.rs:12:5
33
|
44
12 | requires_send(async move {
5-
| ------------- ^---------
6-
| | |
7-
| _____|_____________within this `{async block@examples/misc_10.rs:12:19: 12:29}`
8-
| | |
9-
| | required by a bound introduced by this call
5+
| ^ ---------- within this `{async block@examples/misc_10.rs:12:19: 12:29}`
6+
| _____|
7+
| |
108
13 | | println!("{}", unsafe{*y.0})
119
14 | | })
12-
| |_____^ `*const i32` cannot be sent between threads safely
10+
| |______^ `*const i32` cannot be sent between threads safely
1311
|
1412
= help: within `{async block@examples/misc_10.rs:12:19: 12:29}`, the trait `Send` is not implemented for `*const i32`
1513
note: required because it's used within this `async` block
@@ -20,7 +18,7 @@ note: required because it's used within this `async` block
2018
note: required by a bound in `requires_send`
2119
--> examples/misc_10.rs:6:36
2220
|
23-
6 | fn requires_send(_f: impl Future + Send) {}
21+
6 | fn requires_send(_f: impl Future + Send) {}
2422
| ^^^^ required by this bound in `requires_send`
2523

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

code/examples/stderr/misc_3.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error[E0599]: no method named `func` found for struct `Foo` in the current scope
22
--> examples/misc_3.rs:10:9
33
|
4-
1 | struct Foo {
4+
1 | struct Foo {
55
| ---------- method `func` not found for this struct
66
...
77
10 | foo.func();

code/examples/stderr/misc_7.stderr

Whitespace-only changes.

code/examples/stderr/misc_9.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ error[E0423]: expected value, found struct `Struct`
1010
error[E0423]: expected value, found struct `Struct`
1111
--> examples/misc_9.rs:20:5
1212
|
13-
3 | struct Struct {}
13+
3 | struct Struct {}
1414
| ---------------- `Struct` defined here
1515
...
1616
20 | Struct = Struct {};
@@ -19,7 +19,7 @@ error[E0423]: expected value, found struct `Struct`
1919
error[E0618]: expected function, found struct `Unit`
2020
--> examples/misc_9.rs:10:5
2121
|
22-
1 | struct Unit;
22+
1 | struct Unit;
2323
| ----------- struct `Unit` defined here
2424
...
2525
10 | Unit();
@@ -36,7 +36,7 @@ help: `Unit` is a unit struct, and does not take parentheses to be constructed
3636
error[E0423]: expected function, tuple struct or tuple variant, found struct `Struct`
3737
--> examples/misc_9.rs:12:5
3838
|
39-
3 | struct Struct {}
39+
3 | struct Struct {}
4040
| ---------------- `Struct` defined here
4141
...
4242
12 | Struct();

0 commit comments

Comments
 (0)