2017-03-21 13:41:41 +00:00
|
|
|
#![allow(unused_variables)]
|
|
|
|
#![allow(unused_assignments)]
|
|
|
|
#![allow(dead_code)]
|
|
|
|
#![deny(unreachable_code)]
|
|
|
|
#![feature(type_ascription)]
|
|
|
|
|
|
|
|
struct Foo {
|
|
|
|
a: usize,
|
|
|
|
b: usize,
|
|
|
|
}
|
|
|
|
|
|
|
|
fn a() {
|
|
|
|
// struct expr is unreachable:
|
2017-11-20 12:13:27 +00:00
|
|
|
let x = Foo { a: 22, b: 33, ..return }; //~ ERROR unreachable
|
2017-03-21 13:41:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn b() {
|
|
|
|
// the `33` is unreachable:
|
2017-11-20 12:13:27 +00:00
|
|
|
let x = Foo { a: return, b: 33, ..return }; //~ ERROR unreachable
|
2017-03-21 13:41:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn c() {
|
|
|
|
// the `..return` is unreachable:
|
2017-11-20 12:13:27 +00:00
|
|
|
let x = Foo { a: 22, b: return, ..return }; //~ ERROR unreachable
|
2017-03-21 13:41:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn d() {
|
|
|
|
// the struct expr is unreachable:
|
2017-11-20 12:13:27 +00:00
|
|
|
let x = Foo { a: 22, b: return }; //~ ERROR unreachable
|
2017-03-21 13:41:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() { }
|