Skip to content

Commit 6c235cf

Browse files
committed
Update const eval uninhabited messages
1 parent 7bb2980 commit 6c235cf

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

src/test/ui/consts/const-eval/ub-uninhabit.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ use std::mem;
1616
enum Bar {}
1717

1818
const BAD_BAD_BAD: Bar = unsafe { mem::transmute(()) };
19-
//~^ ERROR this constant likely exhibits undefined behavior
19+
//~^ ERROR this constant cannot be used
2020

2121
const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
2222
//~^ ERROR this constant likely exhibits undefined behavior
2323

2424
const BAD_BAD_ARRAY: [Bar; 1] = unsafe { mem::transmute(()) };
25-
//~^ ERROR this constant likely exhibits undefined behavior
25+
//~^ ERROR this constant cannot be used
2626

2727
fn main() {
2828
}

src/test/ui/consts/const-eval/ub-uninhabit.stderr

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
error[E0080]: this constant likely exhibits undefined behavior
1+
error: this constant cannot be used
22
--> $DIR/ub-uninhabit.rs:18:1
33
|
44
LL | const BAD_BAD_BAD: Bar = unsafe { mem::transmute(()) };
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a value of an uninhabited type
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------------------^^^
6+
| |
7+
| entered unreachable code
68
|
7-
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
9+
= note: #[deny(const_err)] on by default
810

911
error[E0080]: this constant likely exhibits undefined behavior
1012
--> $DIR/ub-uninhabit.rs:21:1
@@ -14,13 +16,13 @@ LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
1416
|
1517
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
1618

17-
error[E0080]: this constant likely exhibits undefined behavior
19+
error: this constant cannot be used
1820
--> $DIR/ub-uninhabit.rs:24:1
1921
|
2022
LL | const BAD_BAD_ARRAY: [Bar; 1] = unsafe { mem::transmute(()) };
21-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a value of an uninhabited type at [0]
22-
|
23-
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
23+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------------------^^^
24+
| |
25+
| entered unreachable code
2426

2527
error: aborting due to 3 previous errors
2628

0 commit comments

Comments
 (0)