Auto merge of #115513 - Urgau:normalize-msg-after-translate, r=petrochenkov
Don't forget to normalize the translated message This PR adds a missing call to `normalize_whitespace` after translating an label. Fixes https://github.com/rust-lang/rust/issues/115498
This commit is contained in:
commit
bf1e3f31f9
@ -2348,7 +2348,13 @@ fn add_annotation_to_file(
|
||||
}
|
||||
|
||||
let label = label.as_ref().map(|m| {
|
||||
emitter.translate_message(m, args).map_err(Report::new).unwrap().to_string()
|
||||
normalize_whitespace(
|
||||
&emitter
|
||||
.translate_message(m, &args)
|
||||
.map_err(Report::new)
|
||||
.unwrap()
|
||||
.to_string(),
|
||||
)
|
||||
});
|
||||
|
||||
if lo.line != hi.line {
|
||||
|
@ -0,0 +1,5 @@
|
||||
#![crate_type = "lib"]
|
||||
|
||||
struct Bug([u8; panic!{"\t"}]);
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
//~| NOTE: in this expansion of panic!
|
@ -0,0 +1,11 @@
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const_panic-normalize-tabs-115498.rs:3:17
|
||||
|
|
||||
LL | struct Bug([u8; panic!{"\t"}]);
|
||||
| ^^^^^^^^^^^^ the evaluated program panicked at ' ', $DIR/const_panic-normalize-tabs-115498.rs:3:17
|
||||
|
|
||||
= 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)
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0080`.
|
Loading…
Reference in New Issue
Block a user