Skip to content

Commit ec0975d

Browse files
committed
Don't forget to normalize the translated message
1 parent 9bd60a6 commit ec0975d

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

compiler/rustc_errors/src/emitter.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -2346,7 +2346,13 @@ impl FileWithAnnotatedLines {
23462346
}
23472347

23482348
let label = label.as_ref().map(|m| {
2349-
emitter.translate_message(m, args).map_err(Report::new).unwrap().to_string()
2349+
normalize_whitespace(
2350+
&emitter
2351+
.translate_message(m, &args)
2352+
.map_err(Report::new)
2353+
.unwrap()
2354+
.to_string(),
2355+
)
23502356
});
23512357

23522358
if lo.line != hi.line {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#![crate_type = "lib"]
2+
3+
struct Bug([u8; panic!{"\t"}]);
4+
//~^ ERROR evaluation of constant value failed
5+
//~| NOTE: in this expansion of panic!
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0080]: evaluation of constant value failed
2+
--> $DIR/const_panic-normalize-tabs-115498.rs:3:17
3+
|
4+
LL | struct Bug([u8; panic!{"\t"}]);
5+
| ^^^^^^^^^^^^ the evaluated program panicked at ' ', $DIR/const_panic-normalize-tabs-115498.rs:3:17
6+
|
7+
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
8+
9+
error: aborting due to previous error
10+
11+
For more information about this error, try `rustc --explain E0080`.

0 commit comments

Comments
 (0)