about summary refs log tree commit diff
path: root/tests/ui/structs/nonexistent-struct-field-error-5439.rs
blob: b2b3293ac91ad71d7672de489624914a7dc4facc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// 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);
    println!("{}", foo.foo);
}