Skip to content

Commit a49c659

Browse files
The Miri Cronjob BotRalfJung
The Miri Cronjob Bot
authored andcommitted
fmt
1 parent 6771dc4 commit a49c659

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/tools/miri/tests/fail/validity/invalid_enum_cast.rs

+10-4
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,17 @@
33

44
#[derive(Copy, Clone)]
55
#[allow(unused)]
6-
enum E {A, B, C }
6+
enum E {
7+
A,
8+
B,
9+
C,
10+
}
711

8-
fn cast(ptr: *const E) { unsafe {
9-
let _val = *ptr as u32; //~ERROR: enum value has invalid tag
10-
}}
12+
fn cast(ptr: *const E) {
13+
unsafe {
14+
let _val = *ptr as u32; //~ERROR: enum value has invalid tag
15+
}
16+
}
1117

1218
pub fn main() {
1319
let v = u32::MAX;

src/tools/miri/tests/fail/validity/invalid_enum_cast.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error: Undefined Behavior: enum value has invalid tag: 0xff
22
--> $DIR/invalid_enum_cast.rs:LL:CC
33
|
4-
LL | let _val = *ptr as u32;
5-
| ^^^^^^^^^^^ enum value has invalid tag: 0xff
4+
LL | let _val = *ptr as u32;
5+
| ^^^^^^^^^^^ enum value has invalid tag: 0xff
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)