Closed
Description
opened on Feb 15, 2022
The span for a typo suggestion inside a format string encompasses the {}
characters, causing them to be removed, breaking the format string.
fn main() {
const FOO: i32 = 123;
let x = format!("{foo}");
}
The current output is:
error[E0425]: cannot find value `foo` in this scope
--> src/main.rs:3:22
|
2 | const FOO: i32 = 123;
| --------------------- similarly named constant `FOO` defined here
3 | let x = format!("{foo}");
| ^^^^^ help: a constant with a similar name exists: `FOO`
Applying the fix results in:
let x = format!("FOO");
which is now missing the {}
characters.
rustc 1.60.0-nightly (5d8767cb2 2022-02-12)
binary: rustc
commit-hash: 5d8767cb229b097fedb1dd4bd9420d463c37774f
commit-date: 2022-02-12
host: x86_64-apple-darwin
release: 1.60.0-nightly
LLVM version: 13.0.0
Activity