summaryrefslogtreecommitdiffstats
path: root/src/test/ui/binding/issue-53114-safety-checks.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/ui/binding/issue-53114-safety-checks.rs
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/binding/issue-53114-safety-checks.rs')
-rw-r--r--src/test/ui/binding/issue-53114-safety-checks.rs51
1 files changed, 0 insertions, 51 deletions
diff --git a/src/test/ui/binding/issue-53114-safety-checks.rs b/src/test/ui/binding/issue-53114-safety-checks.rs
deleted file mode 100644
index d0eb28c57..000000000
--- a/src/test/ui/binding/issue-53114-safety-checks.rs
+++ /dev/null
@@ -1,51 +0,0 @@
-// Issue #53114: NLL's borrow check had some deviations from the old borrow
-// checker, and both had some deviations from our ideal state. This test
-// captures the behavior of how `_` bindings are handled with respect to how we
-// flag expressions that are meant to request unsafe blocks.
-
-#[derive(Copy, Clone)]
-struct I(i64);
-#[derive(Copy, Clone)]
-struct F(f64);
-
-union U { a: I, b: F }
-
-#[repr(packed)]
-struct P {
- a: &'static i8,
- b: &'static u32,
-}
-
-fn let_wild_gets_unsafe_field() {
- let u1 = U { a: I(0) };
- let u2 = U { a: I(1) };
- let p = P { a: &2, b: &3 };
- let _ = &p.b; //~ ERROR reference to packed field
- //~^ WARN will become a hard error
- let _ = u1.a; // #53114: should eventually signal error as well
- let _ = &u2.a; //~ ERROR [E0133]
-
- // variation on above with `_` in substructure
- let (_,) = (&p.b,); //~ ERROR reference to packed field
- //~^ WARN will become a hard error
- let (_,) = (u1.a,); //~ ERROR [E0133]
- let (_,) = (&u2.a,); //~ ERROR [E0133]
-}
-
-fn match_unsafe_field_to_wild() {
- let u1 = U { a: I(0) };
- let u2 = U { a: I(1) };
- let p = P { a: &2, b: &3 };
- match &p.b { _ => { } } //~ ERROR reference to packed field
- //~^ WARN will become a hard error
- match u1.a { _ => { } } //~ ERROR [E0133]
- match &u2.a { _ => { } } //~ ERROR [E0133]
-
- // variation on above with `_` in substructure
- match (&p.b,) { (_,) => { } } //~ ERROR reference to packed field
- //~^ WARN will become a hard error
- match (u1.a,) { (_,) => { } } //~ ERROR [E0133]
- match (&u2.a,) { (_,) => { } } //~ ERROR [E0133]
-}
-
-fn main() { }