fix(error): normalize whitespace during msg_to_buffer
This commit is contained in:
parent
7908a1d654
commit
a2f275da51
3 changed files with 37 additions and 0 deletions
|
@ -1336,6 +1336,7 @@ impl EmitterWriter {
|
||||||
// see?
|
// see?
|
||||||
for (text, style) in msg.iter() {
|
for (text, style) in msg.iter() {
|
||||||
let text = self.translate_message(text, args).map_err(Report::new).unwrap();
|
let text = self.translate_message(text, args).map_err(Report::new).unwrap();
|
||||||
|
let text = &normalize_whitespace(&text);
|
||||||
let lines = text.split('\n').collect::<Vec<_>>();
|
let lines = text.split('\n').collect::<Vec<_>>();
|
||||||
if lines.len() > 1 {
|
if lines.len() > 1 {
|
||||||
for (i, line) in lines.iter().enumerate() {
|
for (i, line) in lines.iter().enumerate() {
|
||||||
|
|
7
tests/ui/extenv/issue-110547.rs
Normal file
7
tests/ui/extenv/issue-110547.rs
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
// compile-flags: -C debug-assertions
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
env!{"\t"}; //~ ERROR not defined at compile time
|
||||||
|
env!("\t"); //~ ERROR not defined at compile time
|
||||||
|
env!("\u{2069}"); //~ ERROR not defined at compile time
|
||||||
|
}
|
29
tests/ui/extenv/issue-110547.stderr
Normal file
29
tests/ui/extenv/issue-110547.stderr
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
error: environment variable ` ` not defined at compile time
|
||||||
|
--> $DIR/issue-110547.rs:4:5
|
||||||
|
|
|
||||||
|
LL | env!{"\t"};
|
||||||
|
| ^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= help: use `std::env::var(" ")` to read the variable at run time
|
||||||
|
= note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
|
error: environment variable ` ` not defined at compile time
|
||||||
|
--> $DIR/issue-110547.rs:5:5
|
||||||
|
|
|
||||||
|
LL | env!("\t");
|
||||||
|
| ^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= help: use `std::env::var(" ")` to read the variable at run time
|
||||||
|
= note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
|
error: environment variable `` not defined at compile time
|
||||||
|
--> $DIR/issue-110547.rs:6:5
|
||||||
|
|
|
||||||
|
LL | env!("\u{2069}");
|
||||||
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= help: use `std::env::var("")` to read the variable at run time
|
||||||
|
= note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
|
error: aborting due to 3 previous errors
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue