1
Fork 0

rustc_layout/abi: error when attribute is applied to the wrong thing

This commit is contained in:
Ralf Jung 2023-09-02 14:03:25 +02:00
parent 9570cac019
commit e66913f8fe
8 changed files with 134 additions and 63 deletions

View file

@ -17,6 +17,9 @@ type Test = Result<i32, i32>; //~ ERROR: layout_of
#[rustc_layout(debug)]
type T = impl std::fmt::Debug; //~ ERROR: layout_of
fn f() -> T {
0i32
}
#[rustc_layout(debug)]
pub union V { //~ ERROR: layout_of
@ -63,6 +66,10 @@ union P5 { zst: [u16; 0], byte: u8 } //~ ERROR: layout_of
#[rustc_layout(debug)]
type X = std::mem::MaybeUninit<u8>; //~ ERROR: layout_of
fn f() -> T {
0i32
#[rustc_layout(debug)]
const C: () = (); //~ ERROR: can only be applied to
impl S {
#[rustc_layout(debug)]
const C: () = (); //~ ERROR: can only be applied to
}