diff options
| author | kennytm <kennytm@gmail.com> | 2017-12-02 01:38:52 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-12-02 01:38:52 +0800 |
| commit | 95f465d5355f559e9c1955a7e4774dc3e619ed63 (patch) | |
| tree | 995f98cb302845ca94dddfcb041fd77177ed14d8 /src/test/ui | |
| parent | e3ed21272d5f50c37c09f2a7f06c40f56b6ac298 (diff) | |
| parent | 5a00b7cb74ba1511c012c0163a29cd6972d64135 (diff) | |
| download | rust-95f465d5355f559e9c1955a7e4774dc3e619ed63.tar.gz rust-95f465d5355f559e9c1955a7e4774dc3e619ed63.zip | |
Rollup merge of #45880 - arielb1:never-coerce, r=nikomatsakis
make coercions to `!` in unreachable code a hard error This was added to cover up a lazy extra semicolon in #35849, but does not actually make sense. This is removed as a part of the stabilization of `never_type`.
Diffstat (limited to 'src/test/ui')
| -rw-r--r-- | src/test/ui/reachable/expr_unary.rs | 5 | ||||
| -rw-r--r-- | src/test/ui/reachable/expr_unary.stderr | 24 |
2 files changed, 23 insertions, 6 deletions
diff --git a/src/test/ui/reachable/expr_unary.rs b/src/test/ui/reachable/expr_unary.rs index 6cff3ff9644..ad12cb876fe 100644 --- a/src/test/ui/reachable/expr_unary.rs +++ b/src/test/ui/reachable/expr_unary.rs @@ -12,11 +12,14 @@ #![allow(unused_assignments)] #![allow(dead_code)] #![deny(unreachable_code)] +#![deny(coerce_never)] #![feature(never_type)] fn foo() { let x: ! = ! { return; 22 }; //~ ERROR unreachable - //~^ ERROR cannot apply unary operator `!` to type `!` + //~^ ERROR cannot coerce + //~| hard error + //~| ERROR cannot apply unary operator `!` to type `!` } fn main() { } diff --git a/src/test/ui/reachable/expr_unary.stderr b/src/test/ui/reachable/expr_unary.stderr index f14824728a7..39120f0bdf9 100644 --- a/src/test/ui/reachable/expr_unary.stderr +++ b/src/test/ui/reachable/expr_unary.stderr @@ -1,7 +1,7 @@ error: unreachable expression - --> $DIR/expr_unary.rs:18:28 + --> $DIR/expr_unary.rs:19:28 | -18 | let x: ! = ! { return; 22 }; //~ ERROR unreachable +19 | let x: ! = ! { return; 22 }; //~ ERROR unreachable | ^^ | note: lint level defined here @@ -10,11 +10,25 @@ note: lint level defined here 14 | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ +error: cannot coerce `{integer}` to ! + --> $DIR/expr_unary.rs:19:28 + | +19 | let x: ! = ! { return; 22 }; //~ ERROR unreachable + | ^^ + | +note: lint level defined here + --> $DIR/expr_unary.rs:15:9 + | +15 | #![deny(coerce_never)] + | ^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #46325 <https://github.com/rust-lang/rust/issues/46325> + error[E0600]: cannot apply unary operator `!` to type `!` - --> $DIR/expr_unary.rs:18:16 + --> $DIR/expr_unary.rs:19:16 | -18 | let x: ! = ! { return; 22 }; //~ ERROR unreachable +19 | let x: ! = ! { return; 22 }; //~ ERROR unreachable | ^^^^^^^^^^^^^^^^ -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors |
