forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request rust-lang#34 from oli-obk/alignment
use ty::layout::Size and ty::layout::TargetDataLayout
- Loading branch information
Showing
6 changed files
with
72 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#[repr(C)] | ||
pub enum Foo { | ||
A, B, C, D | ||
} | ||
|
||
fn main() { | ||
let f = unsafe { std::mem::transmute::<i32, Foo>(42) }; | ||
match f { | ||
Foo::A => {}, //~ ERROR invalid enum discriminant value read | ||
Foo::B => {}, | ||
Foo::C => {}, | ||
Foo::D => {}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
fn main() { | ||
assert!(std::char::from_u32(-1_i32 as u32).is_none()); | ||
match unsafe { std::mem::transmute::<i32, char>(-1) } { | ||
'a' => {}, //~ERROR tried to interpret an invalid 32-bit value as a char: 4294967295 | ||
'b' => {}, | ||
_ => {}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters