about summary refs log tree commit diff
path: root/tests/ui/unsafe/ranged_ints_macro.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/unsafe/ranged_ints_macro.rs')
-rw-r--r--tests/ui/unsafe/ranged_ints_macro.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/ui/unsafe/ranged_ints_macro.rs b/tests/ui/unsafe/ranged_ints_macro.rs
new file mode 100644
index 00000000000..8293d029951
--- /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<T>(pub(crate) T);
+    }
+}
+
+apply!(1);
+
+fn main() {
+    let _x = unsafe { NonZero(1) };
+}