Skip to content

Commit 081c497

Browse files

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed
 

‎src/librustc_mir/transform/check_unsafety.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> {
144144
(Bound::Unbounded, Bound::Unbounded) => {},
145145
_ => self.require_unsafe(
146146
"initializing type with `rustc_layout_scalar_valid_range` attr",
147-
"initializing `NonZero` with a `0` violates layout constraints \
148-
and is undefined behavior",
147+
"initializing a layout restricted type's field with a value outside \
148+
the valid range is undefined behavior",
149149
UnsafetyViolationKind::MinConstFn,
150150
),
151151
}

‎src/test/ui/unsafe/ranged_ints.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0133]: initializing type with `rustc_layout_scalar_valid_range` attr is u
44
LL | let _x = NonZero(0); //~ ERROR initializing type with `rustc_layout_scalar_valid_range` attr
55
| ^^^^^^^^^^ initializing type with `rustc_layout_scalar_valid_range` attr
66
|
7-
= note: initializing `NonZero` with a `0` violates layout constraints and is undefined behavior
7+
= note: initializing a layout restricted type's field with a value outside the valid range is undefined behavior
88

99
error: aborting due to previous error
1010

0 commit comments

Comments
 (0)
Please sign in to comment.