diff --git a/tests/ui/reachable/type_ascribe_never_field.rs b/tests/ui/reachable/type_ascribe_never_field.rs new file mode 100644 index 000000000000..2788d30414e6 --- /dev/null +++ b/tests/ui/reachable/type_ascribe_never_field.rs @@ -0,0 +1,17 @@ +// Regression test for +// +// Checks that type ascription of a field place with type never is correctly +// checked for if it constitutes a read of type never. (it doesn't) +// +//@ check-pass + +#![feature(never_type)] +#![feature(type_ascription)] +#![deny(unreachable_code)] + +fn main() { + let x: (!,); + let _ = type_ascribe!(x.0, _); + + (); // reachable +}