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
{{ message }}
Repository navigation
assertions-on-constants incorrectly fails on const blocks #12816
In ffi code, sometimes std defines types that may have incompatible layout with third-party codes (windows-sys).
To be more safe, one has to check the layout of a std type and another correspond type has the same layout.
Lint Name
assertions_on_constants
Reproducer
I tried this code:
const _:() = {assert!(8 == (7+1));// let std_layout = Layout::new::<RawHandle>();// let win_sys_layout = Layout::new::<HANDLE>();// assert!(std_layout.size() == win_sys_layout.size())// assert!(std_layout.align() == win_sys_layout.align())};
I saw this happen:
error: `assert!(true)` will be optimized out by the compiler
--> src/internals/c.rs:53:5
|
53 | assert!(8 == (7+1));
| ^^^^^^^^^^^^^^^^^^^
|
= help: remove it
Activity
Auto merge of #12840 - tesuji:const-asserts, r=llogiq
Auto merge of #12840 - tesuji:const-asserts, r=llogiq