File tree 2 files changed +12
-4
lines changed
compiler/rustc_interface/src
2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -65,9 +65,15 @@ fn init_stack_size(early_dcx: &EarlyDiagCtxt) -> usize {
65
65
// so no one thinks we parsed them setting `RUST_MIN_STACK="64 megabytes"`
66
66
// FIXME: we could accept `RUST_MIN_STACK=64MB`, perhaps?
67
67
. 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 ( )
71
77
} )
72
78
} )
73
79
// otherwise pick a consistent default
Original file line number Diff line number Diff line change 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
2
4
You can’t perform that action at this time.
0 commit comments