Files
rust/tests/ui/structs/nonexistent-struct-field-error-5439.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
372 B
Rust
Raw Normal View History

2025-08-20 14:02:39 -04:00
// https://github.com/rust-lang/rust/issues/5439
struct Foo {
foo: isize,
}
struct Bar {
bar: isize,
}
impl Bar {
fn make_foo (&self, i: isize) -> Box<Foo> {
return Box::new(Foo { nonexistent: self, foo: i }); //~ ERROR: no field named
}
}
fn main () {
let bar = Bar { bar: 1 };
let foo = bar.make_foo(2);
2013-09-29 20:06:21 -07:00
println!("{}", foo.foo);
}