diff options
Diffstat (limited to 'src/test/ui/destructuring-assignment/struct_destructure_fail.stderr')
-rw-r--r-- | src/test/ui/destructuring-assignment/struct_destructure_fail.stderr | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/test/ui/destructuring-assignment/struct_destructure_fail.stderr b/src/test/ui/destructuring-assignment/struct_destructure_fail.stderr new file mode 100644 index 000000000..ae7b3d1e5 --- /dev/null +++ b/src/test/ui/destructuring-assignment/struct_destructure_fail.stderr @@ -0,0 +1,45 @@ +error: expected identifier, found reserved identifier `_` + --> $DIR/struct_destructure_fail.rs:11:17 + | +LL | Struct { a, _ } = Struct { a: 1, b: 2 }; + | ------ ^ expected identifier, found reserved identifier + | | + | while parsing this struct + +error: functional record updates are not allowed in destructuring assignments + --> $DIR/struct_destructure_fail.rs:13:19 + | +LL | Struct { a, ..d } = Struct { a: 1, b: 2 }; + | ^ help: consider removing the trailing pattern + +error: base expression required after `..` + --> $DIR/struct_destructure_fail.rs:15:19 + | +LL | Struct { a, .. }; + | ^ add a base expression here + +error[E0026]: struct `Struct` does not have a field named `c` + --> $DIR/struct_destructure_fail.rs:10:20 + | +LL | Struct { a, b, c } = Struct { a: 0, b: 1 }; + | ^ struct `Struct` does not have this field + +error[E0027]: pattern does not mention field `b` + --> $DIR/struct_destructure_fail.rs:11:5 + | +LL | Struct { a, _ } = Struct { a: 1, b: 2 }; + | ^^^^^^^^^^^^^^^ missing field `b` + | +help: include the missing field in the pattern + | +LL | Struct { a, b } = Struct { a: 1, b: 2 }; + | ~~~~~ +help: if you don't care about this missing field, you can explicitly ignore it + | +LL | Struct { a, .. } = Struct { a: 1, b: 2 }; + | ~~~~~~ + +error: aborting due to 5 previous errors + +Some errors have detailed explanations: E0026, E0027. +For more information about an error, try `rustc --explain E0026`. |