aboutsummaryrefslogtreecommitdiff
path: root/tests/ui/pin_project/safe_packed_borrows.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/pin_project/safe_packed_borrows.rs')
-rw-r--r--tests/ui/pin_project/safe_packed_borrows.rs23
1 files changed, 8 insertions, 15 deletions
diff --git a/tests/ui/pin_project/safe_packed_borrows.rs b/tests/ui/pin_project/safe_packed_borrows.rs
index 8f4f462..db4ac2d 100644
--- a/tests/ui/pin_project/safe_packed_borrows.rs
+++ b/tests/ui/pin_project/safe_packed_borrows.rs
@@ -1,28 +1,21 @@
-#![deny(renamed_and_removed_lints)]
-#![deny(safe_packed_borrows)] //~ ERROR has been renamed to `unaligned_references`
-#![allow(unaligned_references)]
+#![forbid(safe_packed_borrows)]
-// This lint was removed in https://github.com/rust-lang/rust/pull/82525 (nightly-2021-03-28).
-// Refs:
-// - https://github.com/rust-lang/rust/pull/82525
-// - https://github.com/rust-lang/rust/issues/46043
+// Refs: https://github.com/rust-lang/rust/issues/46043
#[repr(packed)]
-struct Packed {
+struct A {
f: u32,
}
#[repr(packed(2))]
-struct PackedN {
+struct B {
f: u32,
}
fn main() {
- let a = Packed { f: 1 };
- &a.f;
- let _ = &a.f;
+ let a = A { f: 1 };
+ &a.f; //~ ERROR borrow of packed field is unsafe and requires unsafe function or block
- let b = PackedN { f: 1 };
- &b.f;
- let _ = &b.f;
+ let b = B { f: 1 };
+ &b.f; //~ ERROR borrow of packed field is unsafe and requires unsafe function or block
}