]> git.lizzy.rs Git - rust.git/commitdiff
generalize the message about the creation of layout restricted types
authorOliver Scherer <github35764891676564198441@oli-obk.de>
Sun, 4 Nov 2018 11:48:51 +0000 (12:48 +0100)
committerOliver Scherer <github35764891676564198441@oli-obk.de>
Tue, 4 Dec 2018 09:17:36 +0000 (10:17 +0100)
src/librustc_mir/transform/check_unsafety.rs
src/test/ui/unsafe/ranged_ints.stderr

index 05052c8a8c8c901e4d47a0ddaef63f68c9a0b16a..2a80f27ecab5a30e3dd448b8b3d153ebbbd602ed 100644 (file)
@@ -144,8 +144,8 @@ fn visit_rvalue(&mut self,
                         (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,
                         ),
                     }
index c28adba9ee5360ca1ba8760759a848115ad5a15e..f59a930b5a901682a08adcda20e43a7bf3ea094d 100644 (file)
@@ -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