We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1d2877d commit e68687bCopy full SHA for e68687b
tests/compile-fail/nonzero.rs
@@ -0,0 +1,11 @@
1
+#![feature(rustc_attrs)]
2
+#![allow(unused_attributes)]
3
+
4
+#[rustc_layout_scalar_valid_range_start(1)]
5
+#[repr(transparent)]
6
+pub(crate) struct NonZero<T>(pub(crate) T);
7
8
+fn main() {
9
+ // Make sure that we detect this even when no function call is happening along the way
10
+ let _x = Some(NonZero(0)); //~ ERROR encountered 0, but expected something greater or equal to 1
11
+}
0 commit comments