diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2017-03-24 13:35:49 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2017-03-30 08:18:02 -0400 |
| commit | 8450add8bede7bc5119457e37bbbcc95a5e8b121 (patch) | |
| tree | bded4dd18f0057ddeeca8213f2418a29cd2fa2f5 /src/test | |
| parent | 7eeddb409364fdeecbec8611f08a6ccea134971f (diff) | |
| download | rust-8450add8bede7bc5119457e37bbbcc95a5e8b121.tar.gz rust-8450add8bede7bc5119457e37bbbcc95a5e8b121.zip | |
fix `X as !` behavior
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/compile-fail/coerce-to-bang-cast.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/test/compile-fail/coerce-to-bang-cast.rs b/src/test/compile-fail/coerce-to-bang-cast.rs new file mode 100644 index 00000000000..57d2192e635 --- /dev/null +++ b/src/test/compile-fail/coerce-to-bang-cast.rs @@ -0,0 +1,23 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(never_type)] + +fn foo(x: usize, y: !, z: usize) { } + +fn cast_a() { + let y = {return; 22} as !; +} + +fn cast_b() { + let y = 22 as !; //~ ERROR non-scalar cast +} + +fn main() { } |
