diff options
Diffstat (limited to 'tests/ui/unsafe/ranged_ints_const.mir.stderr')
-rw-r--r-- | tests/ui/unsafe/ranged_ints_const.mir.stderr | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/ui/unsafe/ranged_ints_const.mir.stderr b/tests/ui/unsafe/ranged_ints_const.mir.stderr new file mode 100644 index 000000000..33d134c7c --- /dev/null +++ b/tests/ui/unsafe/ranged_ints_const.mir.stderr @@ -0,0 +1,11 @@ +error[E0133]: initializing type with `rustc_layout_scalar_valid_range` attr is unsafe and requires unsafe function or block + --> $DIR/ranged_ints_const.rs:11:34 + | +LL | const fn foo() -> NonZero<u32> { NonZero(0) } + | ^^^^^^^^^^ initializing type with `rustc_layout_scalar_valid_range` attr + | + = note: initializing a layout restricted type's field with a value outside the valid range is undefined behavior + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0133`. |