]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/derives/deriving-with-repr-packed.rs
Extend `BYTE_SLICE_IN_PACKED_STRUCT_WITH_DERIVE`.
[rust.git] / tests / ui / derives / deriving-with-repr-packed.rs
index eddf41f55536e4e7ecb5ceeff537a22fd7910b84..58be4519720178b8fab1f5504fc43607bc8e05a9 100644 (file)
@@ -1,5 +1,3 @@
-#![deny(unaligned_references)]
-
 // Check that deriving certain builtin traits on certain packed structs cause
 // errors. To avoid potentially misaligned references, field copies must be
 // used, which involves adding `T: Copy` bounds.
@@ -35,4 +33,14 @@ struct FlexZeroSlice {
     //~^^ this was previously accepted
 }
 
+// Again, currently allowed, but will be phased out.
+#[derive(Debug)]
+#[repr(packed)]
+struct WithStr {
+    width: u8,
+    data: str,
+    //~^ WARNING string slice in a packed struct that derives a built-in trait
+    //~^^ this was previously accepted
+}
+
 fn main() {}