[improper_ctypes] Stop complaining about repr(usize) and repr(isize) enums
This dates back to at least #26583. At the time, usize and isize were considered ffi-unsafe to nudge people away from them, but this changed in the aforementioned PR, making it inconsistent to complain about it in enum discriminants. In fact, repr(usize) is probably the best way to interface with `enum Foo : size_t { ... }`.
This commit is contained in:
parent
7ac5e96f4a
commit
ae92dfac50
2 changed files with 12 additions and 29 deletions
|
|
@ -16,11 +16,23 @@ enum U { A }
|
|||
enum B { C, D }
|
||||
enum T { E, F, G }
|
||||
|
||||
#[repr(C)]
|
||||
enum ReprC { A, B, C }
|
||||
|
||||
#[repr(u8)]
|
||||
enum U8 { A, B, C }
|
||||
|
||||
#[repr(isize)]
|
||||
enum Isize { A, B, C }
|
||||
|
||||
extern {
|
||||
fn zf(x: Z);
|
||||
fn uf(x: U); //~ ERROR found enum without foreign-function-safe
|
||||
fn bf(x: B); //~ ERROR found enum without foreign-function-safe
|
||||
fn tf(x: T); //~ ERROR found enum without foreign-function-safe
|
||||
fn reprc(x: ReprC);
|
||||
fn u8(x: U8);
|
||||
fn isize(x: Isize);
|
||||
}
|
||||
|
||||
pub fn main() { }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue