Skip to content

Commit 637d9dd

Browse files
authored
Rollup merge of #110578 - bvanjoi:fix-issue-110547, r=jackh726
fix(error): normalize whitespace during msg_to_buffer close #110547
2 parents 7d04655 + a2f275d commit 637d9dd

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

compiler/rustc_errors/src/emitter.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,6 +1336,7 @@ impl EmitterWriter {
13361336
// see?
13371337
for (text, style) in msg.iter() {
13381338
let text = self.translate_message(text, args).map_err(Report::new).unwrap();
1339+
let text = &normalize_whitespace(&text);
13391340
let lines = text.split('\n').collect::<Vec<_>>();
13401341
if lines.len() > 1 {
13411342
for (i, line) in lines.iter().enumerate() {

tests/ui/extenv/issue-110547.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// compile-flags: -C debug-assertions
2+
3+
fn main() {
4+
env!{"\t"}; //~ ERROR not defined at compile time
5+
env!("\t"); //~ ERROR not defined at compile time
6+
env!("\u{2069}"); //~ ERROR not defined at compile time
7+
}

tests/ui/extenv/issue-110547.stderr

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
error: environment variable ` ` not defined at compile time
2+
--> $DIR/issue-110547.rs:4:5
3+
|
4+
LL | env!{"\t"};
5+
| ^^^^^^^^^^
6+
|
7+
= help: use `std::env::var(" ")` to read the variable at run time
8+
= note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
9+
10+
error: environment variable ` ` not defined at compile time
11+
--> $DIR/issue-110547.rs:5:5
12+
|
13+
LL | env!("\t");
14+
| ^^^^^^^^^^
15+
|
16+
= help: use `std::env::var(" ")` to read the variable at run time
17+
= note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
18+
19+
error: environment variable `` not defined at compile time
20+
--> $DIR/issue-110547.rs:6:5
21+
|
22+
LL | env!("\u{2069}");
23+
| ^^^^^^^^^^^^^^^^
24+
|
25+
= help: use `std::env::var("")` to read the variable at run time
26+
= note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
27+
28+
error: aborting due to 3 previous errors
29+

0 commit comments

Comments
 (0)