From c23a457e72abe608715ac76f076f47dc42af07a5 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 30 May 2024 20:31:44 +0200 Subject: Merging upstream version 1.74.1+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/unsafe/initializing-ranged-via-ctor.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 tests/ui/unsafe/initializing-ranged-via-ctor.rs (limited to 'tests/ui/unsafe/initializing-ranged-via-ctor.rs') diff --git a/tests/ui/unsafe/initializing-ranged-via-ctor.rs b/tests/ui/unsafe/initializing-ranged-via-ctor.rs new file mode 100644 index 000000000..ca44fa7e4 --- /dev/null +++ b/tests/ui/unsafe/initializing-ranged-via-ctor.rs @@ -0,0 +1,11 @@ +#![feature(rustc_attrs)] +#![allow(internal_features)] + +#[derive(Debug)] +#[rustc_layout_scalar_valid_range_start(2)] +struct NonZeroAndOneU8(u8); + +fn main() { + println!("{:?}", Some(1).map(NonZeroAndOneU8).unwrap()); + //~^ ERROR found `unsafe fn(u8) -> NonZeroAndOneU8 {NonZeroAndOneU8}` +} -- cgit v1.2.3