summaryrefslogtreecommitdiffstats
path: root/src/test/ui/unsafe/ranged_ints.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/unsafe/ranged_ints.rs')
-rw-r--r--src/test/ui/unsafe/ranged_ints.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/ui/unsafe/ranged_ints.rs b/src/test/ui/unsafe/ranged_ints.rs
new file mode 100644
index 000000000..05efe87ba
--- /dev/null
+++ b/src/test/ui/unsafe/ranged_ints.rs
@@ -0,0 +1,11 @@
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
+#![feature(rustc_attrs)]
+
+#[rustc_layout_scalar_valid_range_start(1)]
+#[repr(transparent)]
+pub(crate) struct NonZero<T>(pub(crate) T);
+fn main() {
+ let _x = NonZero(0); //~ ERROR initializing type with `rustc_layout_scalar_valid_range` attr
+}