You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#![deny(improper_ctypes)]// Intentionally not #[repr(C)]pubstructFoo;#[repr(C)]// Expect error here that Bar is marked repr(C) but contains fn ptr referencing non-repr(C) typepubstructBar{// Alternatively expect error here that extern fn contains type that is non-repr(C).pubf:unsafeextern"system"fn(arg:*constFoo)}extern"system"{pubfnbaz(bar:*constBar);// Actually get error here implying Bar is not marked repr(C) even though it is}fnmain(){}
error: found non-foreign-function-safe member in struct marked #[repr(C)]: found struct without foreign-function-safe representation annotation in foreign module, consider adding a #[repr(C)] attribute to the type
--> src/main.rs:12:21
|
12 | pub fn baz(bar: *const Bar); // Actually get error here implying Bar is not marked repr(C) even though it is
| ^^^^^^^^^^
|
note: lint level defined here
--> src/main.rs:1:9
|
1 | #![deny(improper_ctypes)]
| ^^^^^^^^^^^^^^^
error: aborting due to previous error
The text was updated successfully, but these errors were encountered:
…bank
Overhaul improper_ctypes output
This snowballed into a rather big set of improvements to the diagnostics of the improper_ctypes lint. See commits for details, including effects of each change on the `compile-fail/improper-ctypes.rs` test (now a UI test), which is pretty gnarly and hopefully not representative of real code, but covers a lot of different error cases.
Fixesrust-lang#42050
…bank
Overhaul improper_ctypes output
This snowballed into a rather big set of improvements to the diagnostics of the improper_ctypes lint. See commits for details, including effects of each change on the `compile-fail/improper-ctypes.rs` test (now a UI test), which is pretty gnarly and hopefully not representative of real code, but covers a lot of different error cases.
Fixesrust-lang#42050
The text was updated successfully, but these errors were encountered: