Skip to content

Commit 4edaff0

Browse files
committed
Drive-by-cleanup: Don't emit thir::ExprKind::NeverToAny for ! -> !
1 parent 2fbd2d7 commit 4edaff0

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

tests/fail/never_say_never.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@
66

77
fn main() {
88
let y = &5;
9-
let x: ! = unsafe {
10-
*(y as *const _ as *const !) //~ ERROR: entering unreachable code
11-
};
12-
f(x)
9+
let x: ! = unsafe { *(y as *const _ as *const !) };
10+
f(x) //~ ERROR: entering unreachable code
1311
}
1412

1513
fn f(x: !) -> ! {

tests/fail/never_say_never.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error: Undefined Behavior: entering unreachable code
22
--> $DIR/never_say_never.rs:LL:CC
33
|
4-
LL | *(y as *const _ as *const !)
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ entering unreachable code
4+
LL | f(x)
5+
| ^^^^ entering unreachable code
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

0 commit comments

Comments
 (0)