]> git.lizzy.rs Git - rust.git/blob - src/test/ui/reachable/expr_struct.rs
Merge commit '8da837185714cefbb261e93e9846afb11c1dc60e' into sync-rustfmt-subtree
[rust.git] / src / test / ui / reachable / expr_struct.rs
1 #![allow(unused_variables)]
2 #![allow(unused_assignments)]
3 #![allow(dead_code)]
4 #![deny(unreachable_code)]
5 #![feature(type_ascription)]
6
7 struct Foo {
8     a: usize,
9     b: usize,
10 }
11
12 fn a() {
13     // struct expr is unreachable:
14     let x = Foo { a: 22, b: 33, ..return }; //~ ERROR unreachable
15 }
16
17 fn b() {
18     // the `33` is unreachable:
19     let x = Foo { a: return, b: 33, ..return }; //~ ERROR unreachable
20 }
21
22 fn c() {
23     // the `..return` is unreachable:
24     let x = Foo { a: 22, b: return, ..return }; //~ ERROR unreachable
25 }
26
27 fn d() {
28     // the struct expr is unreachable:
29     let x = Foo { a: 22, b: return }; //~ ERROR unreachable
30 }
31
32 fn main() { }