-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Add c_enum_min_bits target spec field, use for arm-none and thumb-none targets #87922
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// compile-flags: --target thumbv8m.main-none-eabihf | ||
// needs-llvm-components: arm | ||
// | ||
// Verify that thumb targets implement the repr(C) for enums correctly. | ||
// | ||
// See #87917 | ||
#![feature(never_type, rustc_attrs, no_core, lang_items)] | ||
#![crate_type = "lib"] | ||
#![no_core] | ||
|
||
#[lang="sized"] | ||
trait Sized {} | ||
|
||
|
||
#[rustc_layout(debug)] | ||
#[repr(C)] | ||
enum A { Apple } //~ ERROR: layout_of | ||
|
||
#[rustc_layout(debug)] | ||
#[repr(C)] | ||
enum B { Banana = 255, } //~ ERROR: layout_of | ||
|
||
#[rustc_layout(debug)] | ||
#[repr(C)] | ||
enum C { Chaenomeles = 256, } //~ ERROR: layout_of | ||
|
||
#[rustc_layout(debug)] | ||
#[repr(C)] | ||
enum P { Peach = 0x1000_0000isize, } //~ ERROR: layout_of | ||
|
||
const TANGERINE: usize = 0x8100_0000; // hack to get negative numbers without negation operator! | ||
|
||
|
||
#[rustc_layout(debug)] | ||
#[repr(C)] | ||
enum T { Tangerine = TANGERINE as isize } //~ ERROR: layout_of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be a good idea to have some deduplication between all the
arm*-none-eabi(hf)
target specs, but it doesn't have to happen in this PR.