fmt
This commit is contained in:
parent
6771dc44b5
commit
a49c65976c
@ -3,11 +3,17 @@
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
#[allow(unused)]
|
||||
enum E {A, B, C }
|
||||
enum E {
|
||||
A,
|
||||
B,
|
||||
C,
|
||||
}
|
||||
|
||||
fn cast(ptr: *const E) { unsafe {
|
||||
let _val = *ptr as u32; //~ERROR: enum value has invalid tag
|
||||
}}
|
||||
fn cast(ptr: *const E) {
|
||||
unsafe {
|
||||
let _val = *ptr as u32; //~ERROR: enum value has invalid tag
|
||||
}
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let v = u32::MAX;
|
||||
|
@ -1,8 +1,8 @@
|
||||
error: Undefined Behavior: enum value has invalid tag: 0xff
|
||||
--> $DIR/invalid_enum_cast.rs:LL:CC
|
||||
|
|
||||
LL | let _val = *ptr as u32;
|
||||
| ^^^^^^^^^^^ enum value has invalid tag: 0xff
|
||||
LL | let _val = *ptr as u32;
|
||||
| ^^^^^^^^^^^ enum value has invalid tag: 0xff
|
||||
|
|
||||
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
|
||||
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
|
||||
|
Loading…
x
Reference in New Issue
Block a user