Skip to content

Commit b6d0d6d

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

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

compiler/rustc_interface/src/util.rs

+9-3
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(|_| {
69-
#[allow(rustc::untranslatable_diagnostic)]
70-
early_dcx.early_fatal("`RUST_MIN_STACK` should be unset or a number of bytes")
68+
let s = s.trim();
69+
// FIXME(workingjubilee): add proper diagnostics when we factor out "pre-run" setup
70+
#[allow(rustc::untranslatable_diagnostic, rustc::diagnostic_outside_of_impl)]
71+
s.parse::<usize>().unwrap_or_else(|_| {
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)