Skip to content

Commit 569c1de

Browse files
note value of RUST_MIN_STACK and explain unsetting
1 parent 9985821 commit 569c1de

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

compiler/rustc_interface/src/util.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,15 @@ fn init_stack_size(early_dcx: &EarlyDiagCtxt) -> usize {
6565
// so no one thinks we parsed them setting `RUST_MIN_STACK="64 megabytes"`
6666
// FIXME: we could accept `RUST_MIN_STACK=64MB`, perhaps?
6767
.map(|s| {
68-
s.trim().parse::<usize>().unwrap_or_else(|_| {
68+
let s = s.trim();
69+
#[allow(rustc::untranslatable_diagnostic, rustc::diagnostic_outside_of_impl)]
70+
s.parse::<usize>().unwrap_or_else(|_| {
6971
#[allow(rustc::untranslatable_diagnostic)]
70-
early_dcx.early_fatal("`RUST_MIN_STACK` should be unset or a number of bytes")
72+
let mut err = early_dcx.early_struct_fatal(format!(
73+
r#"`RUST_MIN_STACK` should be a number of bytes, but was "{s}""#,
74+
));
75+
err.note("you can also unset `RUST_MIN_STACK` to use the default stack size");
76+
err.emit()
7177
})
7278
})
7379
// otherwise pick a consistent default
+3-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
error: `RUST_MIN_STACK` should be unset or a number of bytes
1+
error: `RUST_MIN_STACK` should be a number of bytes, but was "banana"
2+
|
3+
= note: you can also unset `RUST_MIN_STACK` to use the default stack size
24

0 commit comments

Comments
 (0)