From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/unsafe/ranged_ints_macro.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/ui/unsafe/ranged_ints_macro.rs (limited to 'tests/ui/unsafe/ranged_ints_macro.rs') diff --git a/tests/ui/unsafe/ranged_ints_macro.rs b/tests/ui/unsafe/ranged_ints_macro.rs new file mode 100644 index 000000000..8293d0299 --- /dev/null +++ b/tests/ui/unsafe/ranged_ints_macro.rs @@ -0,0 +1,19 @@ +// build-pass +// revisions: mir thir +// [thir]compile-flags: -Z thir-unsafeck + +#![feature(rustc_attrs)] + +macro_rules! apply { + ($val:expr) => { + #[rustc_layout_scalar_valid_range_start($val)] + #[repr(transparent)] + pub(crate) struct NonZero(pub(crate) T); + } +} + +apply!(1); + +fn main() { + let _x = unsafe { NonZero(1) }; +} -- cgit v1.2.3