generalize the message about the creation of layout restricted types
This commit is contained in:
parent
c4a850078c
commit
081c49783f
2 changed files with 3 additions and 3 deletions
|
|
@ -144,8 +144,8 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> {
|
|||
(Bound::Unbounded, Bound::Unbounded) => {},
|
||||
_ => self.require_unsafe(
|
||||
"initializing type with `rustc_layout_scalar_valid_range` attr",
|
||||
"initializing `NonZero` with a `0` violates layout constraints \
|
||||
and is undefined behavior",
|
||||
"initializing a layout restricted type's field with a value outside \
|
||||
the valid range is undefined behavior",
|
||||
UnsafetyViolationKind::MinConstFn,
|
||||
),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ error[E0133]: initializing type with `rustc_layout_scalar_valid_range` attr is u
|
|||
LL | let _x = NonZero(0); //~ ERROR initializing type with `rustc_layout_scalar_valid_range` attr
|
||||
| ^^^^^^^^^^ initializing type with `rustc_layout_scalar_valid_range` attr
|
||||
|
|
||||
= note: initializing `NonZero` with a `0` violates layout constraints and is undefined behavior
|
||||
= note: initializing a layout restricted type's field with a value outside the valid range is undefined behavior
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue