Fix rustc_parse_format spans following escaped utf-8 multibyte chars

This commit is contained in:
Alex Macleod 2022-10-27 18:20:56 +00:00
parent 9dd3d29ec8
commit f5e390e863
3 changed files with 111 additions and 18 deletions

View file

@ -0,0 +1,19 @@
fn main() {
// 1 byte in UTF-8
format!("\u{000041}{a}"); //~ ERROR cannot find value
format!("\u{0041}{a}"); //~ ERROR cannot find value
format!("\u{41}{a}"); //~ ERROR cannot find value
format!("\u{0}{a}"); //~ ERROR cannot find value
// 2 bytes
format!("\u{0df}{a}"); //~ ERROR cannot find value
format!("\u{df}{a}"); //~ ERROR cannot find value
// 3 bytes
format!("\u{00211d}{a}"); //~ ERROR cannot find value
format!("\u{211d}{a}"); //~ ERROR cannot find value
// 4 bytes
format!("\u{1f4a3}{a}"); //~ ERROR cannot find value
format!("\u{10ffff}{a}"); //~ ERROR cannot find value
}

View file

@ -0,0 +1,63 @@
error[E0425]: cannot find value `a` in this scope
--> $DIR/unicode-escape-spans.rs:3:25
|
LL | format!("\u{000041}{a}");
| ^ not found in this scope
error[E0425]: cannot find value `a` in this scope
--> $DIR/unicode-escape-spans.rs:4:23
|
LL | format!("\u{0041}{a}");
| ^ not found in this scope
error[E0425]: cannot find value `a` in this scope
--> $DIR/unicode-escape-spans.rs:5:21
|
LL | format!("\u{41}{a}");
| ^ not found in this scope
error[E0425]: cannot find value `a` in this scope
--> $DIR/unicode-escape-spans.rs:6:20
|
LL | format!("\u{0}{a}");
| ^ not found in this scope
error[E0425]: cannot find value `a` in this scope
--> $DIR/unicode-escape-spans.rs:9:22
|
LL | format!("\u{0df}{a}");
| ^ not found in this scope
error[E0425]: cannot find value `a` in this scope
--> $DIR/unicode-escape-spans.rs:10:21
|
LL | format!("\u{df}{a}");
| ^ not found in this scope
error[E0425]: cannot find value `a` in this scope
--> $DIR/unicode-escape-spans.rs:13:25
|
LL | format!("\u{00211d}{a}");
| ^ not found in this scope
error[E0425]: cannot find value `a` in this scope
--> $DIR/unicode-escape-spans.rs:14:23
|
LL | format!("\u{211d}{a}");
| ^ not found in this scope
error[E0425]: cannot find value `a` in this scope
--> $DIR/unicode-escape-spans.rs:17:24
|
LL | format!("\u{1f4a3}{a}");
| ^ not found in this scope
error[E0425]: cannot find value `a` in this scope
--> $DIR/unicode-escape-spans.rs:18:25
|
LL | format!("\u{10ffff}{a}");
| ^ not found in this scope
error: aborting due to 10 previous errors
For more information about this error, try `rustc --explain E0425`.