rust/tests/ui/resolve/field-and-method-in-self-not-available-in-assoc-fn.rs
2023-09-25 15:56:36 +00:00

19 lines
385 B
Rust

struct Foo {
field: u32,
}
impl Foo {
fn field(&self) -> u32 {
self.field
}
fn new() -> Foo {
field; //~ ERROR cannot find value `field` in this scope
Foo { field } //~ ERROR cannot find value `field` in this scope
}
fn clone(&self) -> Foo {
Foo { field } //~ ERROR cannot find value `field` in this scope
}
}
fn main() {}