Files
rust/tests/ui/resolve/suggestions/sugg-field-in-format-string-issue-141136.rs
2025-05-20 14:10:17 +08:00

16 lines
509 B
Rust

struct Foo {
x: i32
}
impl Foo {
fn foo(&self) {
let _ = format!("{x}"); //~ ERROR cannot find value `x` in this scope [E0425]
let _ = format!("{x }"); //~ ERROR cannot find value `x` in this scope [E0425]
let _ = format!("{ x}"); //~ ERROR invalid format string: expected `}`, found `x`
let _ = format!("{}", x); //~ ERROR cannot find value `x` in this scope [E0425]
println!("{x}"); //~ ERROR cannot find value `x` in this scope [E0425]
}
}
fn main(){}