Replace ! with * in ui test of unary expr reachability

This commit is contained in:
David Tolnay 2021-11-21 19:30:17 -08:00
parent 9e83478578
commit 881e093f6d
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
2 changed files with 7 additions and 7 deletions

View File

@ -5,8 +5,8 @@
#![deny(unreachable_code)]
fn foo() {
let x: ! = ! { return; }; //~ ERROR unreachable
//~| ERROR cannot apply unary operator `!` to type `!`
let x: ! = * { return; }; //~ ERROR unreachable
//~| ERROR type `!` cannot be dereferenced
}
fn main() { }

View File

@ -1,13 +1,13 @@
error[E0600]: cannot apply unary operator `!` to type `!`
error[E0614]: type `!` cannot be dereferenced
--> $DIR/expr_unary.rs:8:16
|
LL | let x: ! = ! { return; };
| ^^^^^^^^^^^^^ cannot apply unary operator `!`
LL | let x: ! = * { return; };
| ^^^^^^^^^^^^^
error: unreachable expression
--> $DIR/expr_unary.rs:8:16
|
LL | let x: ! = ! { return; };
LL | let x: ! = * { return; };
| ^^^^------^^^
| | |
| | any code following this expression is unreachable
@ -21,4 +21,4 @@ LL | #![deny(unreachable_code)]
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0600`.
For more information about this error, try `rustc --explain E0614`.