rust/tests/ui/invalid/invalid_rustc_layout_scalar_valid_range.rs
2023-01-11 09:32:08 +00:00

31 lines
597 B
Rust

#![feature(rustc_attrs)]
#[rustc_layout_scalar_valid_range_start(u32::MAX)] //~ ERROR
pub struct A(u32);
#[rustc_layout_scalar_valid_range_end(1, 2)] //~ ERROR
pub struct B(u8);
#[rustc_layout_scalar_valid_range_end(a = "a")] //~ ERROR
pub struct C(i32);
#[rustc_layout_scalar_valid_range_end(1)] //~ ERROR
enum E {
X = 1,
Y = 14,
}
#[rustc_layout_scalar_valid_range_start(rustc_layout_scalar_valid_range_start)] //~ ERROR
struct NonZero<T>(T);
fn not_field() -> impl Send {
NonZero(false)
}
fn main() {
let _ = A(0);
let _ = B(0);
let _ = C(0);
let _ = E::X;
}