From 45bbd14db4f12172cfb4f00e46b1f65ced0dd224 Mon Sep 17 00:00:00 2001 From: Esteban Küber Date: Fri, 19 Apr 2019 15:37:34 -0700 Subject: Continue evaluating after item-type checking --- src/test/ui/structs/struct-base-wrong-type.rs | 9 +++------ src/test/ui/structs/struct-base-wrong-type.stderr | 20 +++++++++++++++++++- 2 files changed, 22 insertions(+), 7 deletions(-) (limited to 'src/test/ui/structs') diff --git a/src/test/ui/structs/struct-base-wrong-type.rs b/src/test/ui/structs/struct-base-wrong-type.rs index 6252673c296..58aa35046d9 100644 --- a/src/test/ui/structs/struct-base-wrong-type.rs +++ b/src/test/ui/structs/struct-base-wrong-type.rs @@ -18,10 +18,7 @@ static foo_i: Foo = Foo { a: 2, ..4 }; //~ ERROR mismatched types fn main() { let b = Bar { x: 5 }; - // errors below are no longer caught since error above causes - // compilation to abort before we bother checking function bodies. - // See also struct-base-wrong-type-2.rs, which checks that we - // would catch these errors eventually. - let f = Foo { a: 2, ..b }; - let f__isize = Foo { a: 2, ..4 }; + // See also struct-base-wrong-type-2.rs, which checks these errors on isolation. + let f = Foo { a: 2, ..b }; //~ ERROR mismatched types + let f__isize = Foo { a: 2, ..4 }; //~ ERROR mismatched types } diff --git a/src/test/ui/structs/struct-base-wrong-type.stderr b/src/test/ui/structs/struct-base-wrong-type.stderr index 2491296c5ef..00c2e1e0dd5 100644 --- a/src/test/ui/structs/struct-base-wrong-type.stderr +++ b/src/test/ui/structs/struct-base-wrong-type.stderr @@ -16,6 +16,24 @@ LL | static foo_i: Foo = Foo { a: 2, ..4 }; = note: expected type `Foo` found type `{integer}` -error: aborting due to 2 previous errors +error[E0308]: mismatched types + --> $DIR/struct-base-wrong-type.rs:22:27 + | +LL | let f = Foo { a: 2, ..b }; + | ^ expected struct `Foo`, found struct `Bar` + | + = note: expected type `Foo` + found type `Bar` + +error[E0308]: mismatched types + --> $DIR/struct-base-wrong-type.rs:23:34 + | +LL | let f__isize = Foo { a: 2, ..4 }; + | ^ expected struct `Foo`, found integer + | + = note: expected type `Foo` + found type `{integer}` + +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0308`. -- cgit 1.4.1-3-g733a5