aboutsummaryrefslogtreecommitdiff
path: root/tests/ui/pin_project/safe_packed_borrows.rs
diff options
context:
space:
mode:
authorJoel Galenson <jgalenson@google.com>2021-05-27 15:42:45 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-05-27 15:42:45 +0000
commitb845c5fd84f50f28cd5cce350eac405562744e3b (patch)
treea2808291a9d00789d7f23e0e6bc9e133aace307a /tests/ui/pin_project/safe_packed_borrows.rs
parent2985289ffb56db1a2cf157e4b6874d18496b2c35 (diff)
parentc95dc516440636acb2e9f0b61e3a4595a90c4d2e (diff)
downloadpin-project-b845c5fd84f50f28cd5cce350eac405562744e3b.tar.gz
Upgrade rust/crates/pin-project to 1.0.7 am: c95dc51644android-s-beta-4android-s-beta-3android-s-beta-4
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/pin-project/+/1713049 Change-Id: I83082aeac5db98559efa3c9c5ccf4df14e0ff691
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, 15 insertions, 8 deletions
diff --git a/tests/ui/pin_project/safe_packed_borrows.rs b/tests/ui/pin_project/safe_packed_borrows.rs
index db4ac2d..8f4f462 100644
--- a/tests/ui/pin_project/safe_packed_borrows.rs
+++ b/tests/ui/pin_project/safe_packed_borrows.rs
@@ -1,21 +1,28 @@
-#![forbid(safe_packed_borrows)]
+#![deny(renamed_and_removed_lints)]
+#![deny(safe_packed_borrows)] //~ ERROR has been renamed to `unaligned_references`
+#![allow(unaligned_references)]
-// Refs: https://github.com/rust-lang/rust/issues/46043
+// 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
#[repr(packed)]
-struct A {
+struct Packed {
f: u32,
}
#[repr(packed(2))]
-struct B {
+struct PackedN {
f: u32,
}
fn main() {
- let a = A { f: 1 };
- &a.f; //~ ERROR borrow of packed field is unsafe and requires unsafe function or block
+ let a = Packed { f: 1 };
+ &a.f;
+ let _ = &a.f;
- let b = B { f: 1 };
- &b.f; //~ ERROR borrow of packed field is unsafe and requires unsafe function or block
+ let b = PackedN { f: 1 };
+ &b.f;
+ let _ = &b.f;
}