about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2025-04-20 09:16:44 +0000
committerGitHub <noreply@github.com>2025-04-20 09:16:44 +0000
commit94a9e4425caf6a344d602f605a51b3b7d7e53bc9 (patch)
tree86e8c949dd03ba798d41d1167573ff51f51e06e4 /tests
parentdc58d1e9913878ced193abba117a49e6b1cdf44c (diff)
parent669d51106f01761e093378501e126424f0f6a664 (diff)
downloadrust-94a9e4425caf6a344d602f605a51b3b7d7e53bc9.tar.gz
rust-94a9e4425caf6a344d602f605a51b3b7d7e53bc9.zip
Merge pull request #4281 from rust-lang/rustup-2025-04-20
Automatic Rustup
Diffstat (limited to 'tests')
-rw-r--r--tests/mir-opt/building/match/exponential_or.match_tuple.SimplifyCfg-initial.after.mir34
-rw-r--r--tests/mir-opt/dead-store-elimination/place_mention.rs2
-rw-r--r--tests/mir-opt/inline/inline_coroutine.main.Inline.panic-abort.diff2
-rw-r--r--tests/mir-opt/inline/inline_coroutine.main.Inline.panic-unwind.diff2
-rw-r--r--tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-abort.diff6
-rw-r--r--tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-unwind.diff6
-rw-r--r--tests/mir-opt/or_pattern.single_switchint.SimplifyCfg-initial.after.mir38
-rw-r--r--tests/mir-opt/read_from_trivial_switch.main.SimplifyCfg-initial.diff49
-rw-r--r--tests/mir-opt/read_from_trivial_switch.rs15
-rw-r--r--tests/pretty/postfix-yield.rs3
-rw-r--r--tests/rustdoc-json/impls/auto.rs4
-rw-r--r--tests/rustdoc-json/span.rs4
-rw-r--r--tests/ui/async-await/pin-ergonomics/reborrow-once.stderr2
-rw-r--r--tests/ui/coroutine/postfix-yield.rs2
-rw-r--r--tests/ui/feature-gates/feature-gate-unsafe_pin_internals.rs16
-rw-r--r--tests/ui/feature-gates/feature-gate-unsafe_pin_internals.stderr15
-rw-r--r--tests/ui/lint/break-with-label-and-unsafe-block.rs11
-rw-r--r--tests/ui/pattern/uninit-trivial.rs8
-rw-r--r--tests/ui/pattern/uninit-trivial.stderr16
-rw-r--r--tests/ui/pin-macro/cant_access_internals.rs12
-rw-r--r--tests/ui/pin-macro/cant_access_internals.stderr12
-rw-r--r--tests/ui/pin-macro/lifetime_errors_on_promotion_misusage.rs4
-rw-r--r--tests/ui/pin-macro/lifetime_errors_on_promotion_misusage.stderr20
-rw-r--r--tests/ui/pin-macro/pin_move.stderr5
24 files changed, 174 insertions, 114 deletions
diff --git a/tests/mir-opt/building/match/exponential_or.match_tuple.SimplifyCfg-initial.after.mir b/tests/mir-opt/building/match/exponential_or.match_tuple.SimplifyCfg-initial.after.mir
index d52241b459e..2a965fe67b9 100644
--- a/tests/mir-opt/building/match/exponential_or.match_tuple.SimplifyCfg-initial.after.mir
+++ b/tests/mir-opt/building/match/exponential_or.match_tuple.SimplifyCfg-initial.after.mir
@@ -24,43 +24,47 @@ fn match_tuple(_1: (u32, bool, Option<i32>, u32)) -> u32 {
 
     bb1: {
         _0 = const 0_u32;
-        goto -> bb10;
+        goto -> bb11;
     }
 
     bb2: {
-        _2 = discriminant((_1.2: std::option::Option<i32>));
-        switchInt(move _2) -> [0: bb4, 1: bb3, otherwise: bb1];
+        switchInt(copy (_1.1: bool)) -> [0: bb3, otherwise: bb3];
     }
 
     bb3: {
-        switchInt(copy (((_1.2: std::option::Option<i32>) as Some).0: i32)) -> [1: bb4, 8: bb4, otherwise: bb1];
+        _2 = discriminant((_1.2: std::option::Option<i32>));
+        switchInt(move _2) -> [0: bb5, 1: bb4, otherwise: bb1];
     }
 
     bb4: {
-        _5 = Le(const 6_u32, copy (_1.3: u32));
-        switchInt(move _5) -> [0: bb5, otherwise: bb7];
+        switchInt(copy (((_1.2: std::option::Option<i32>) as Some).0: i32)) -> [1: bb5, 8: bb5, otherwise: bb1];
     }
 
     bb5: {
-        _3 = Le(const 13_u32, copy (_1.3: u32));
-        switchInt(move _3) -> [0: bb1, otherwise: bb6];
+        _5 = Le(const 6_u32, copy (_1.3: u32));
+        switchInt(move _5) -> [0: bb6, otherwise: bb8];
     }
 
     bb6: {
-        _4 = Le(copy (_1.3: u32), const 16_u32);
-        switchInt(move _4) -> [0: bb1, otherwise: bb8];
+        _3 = Le(const 13_u32, copy (_1.3: u32));
+        switchInt(move _3) -> [0: bb1, otherwise: bb7];
     }
 
     bb7: {
-        _6 = Le(copy (_1.3: u32), const 9_u32);
-        switchInt(move _6) -> [0: bb5, otherwise: bb8];
+        _4 = Le(copy (_1.3: u32), const 16_u32);
+        switchInt(move _4) -> [0: bb1, otherwise: bb9];
     }
 
     bb8: {
-        falseEdge -> [real: bb9, imaginary: bb1];
+        _6 = Le(copy (_1.3: u32), const 9_u32);
+        switchInt(move _6) -> [0: bb6, otherwise: bb9];
     }
 
     bb9: {
+        falseEdge -> [real: bb10, imaginary: bb1];
+    }
+
+    bb10: {
         StorageLive(_7);
         _7 = copy (_1.0: u32);
         StorageLive(_8);
@@ -74,10 +78,10 @@ fn match_tuple(_1: (u32, bool, Option<i32>, u32)) -> u32 {
         StorageDead(_9);
         StorageDead(_8);
         StorageDead(_7);
-        goto -> bb10;
+        goto -> bb11;
     }
 
-    bb10: {
+    bb11: {
         return;
     }
 }
diff --git a/tests/mir-opt/dead-store-elimination/place_mention.rs b/tests/mir-opt/dead-store-elimination/place_mention.rs
index 5e4a286a208..1848a028297 100644
--- a/tests/mir-opt/dead-store-elimination/place_mention.rs
+++ b/tests/mir-opt/dead-store-elimination/place_mention.rs
@@ -2,7 +2,7 @@
 // and don't remove it as a dead store.
 //
 //@ test-mir-pass: DeadStoreElimination-initial
-//@ compile-flags: -Zmir-keep-place-mention
+//@ compile-flags: -Zmir-preserve-ub
 
 // EMIT_MIR place_mention.main.DeadStoreElimination-initial.diff
 fn main() {
diff --git a/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-abort.diff
index 56d4d50e967..151580da19e 100644
--- a/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-abort.diff
+++ b/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-abort.diff
@@ -33,7 +33,7 @@
 -         _4 = g() -> [return: bb1, unwind unreachable];
 +         _4 = {coroutine@$DIR/inline_coroutine.rs:20:5: 20:8 (#0)};
 +         _3 = &mut _4;
-+         _2 = Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:20:5: 20:8}> { __pointer: copy _3 };
++         _2 = Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:20:5: 20:8}> { pointer: copy _3 };
 +         StorageDead(_3);
 +         StorageLive(_5);
 +         _5 = const false;
diff --git a/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-unwind.diff
index 751916a00f1..6196fc0d0c6 100644
--- a/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-unwind.diff
@@ -33,7 +33,7 @@
 -         _4 = g() -> [return: bb1, unwind continue];
 +         _4 = {coroutine@$DIR/inline_coroutine.rs:20:5: 20:8 (#0)};
 +         _3 = &mut _4;
-+         _2 = Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:20:5: 20:8}> { __pointer: copy _3 };
++         _2 = Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:20:5: 20:8}> { pointer: copy _3 };
 +         StorageDead(_3);
 +         StorageLive(_5);
 +         _5 = const false;
diff --git a/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-abort.diff b/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-abort.diff
index e49d7cea28e..1e9a6dd4f5c 100644
--- a/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-abort.diff
+++ b/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-abort.diff
@@ -121,7 +121,7 @@
 -     }
 - 
 -     bb2: {
-+         _4 = Pin::<&mut {async fn body of ActionPermit<'_, T>::perform()}> { __pointer: copy _5 };
++         _4 = Pin::<&mut {async fn body of ActionPermit<'_, T>::perform()}> { pointer: copy _5 };
           StorageDead(_5);
           StorageLive(_6);
           StorageLive(_7);
@@ -218,7 +218,7 @@
 +         _37 = deref_copy (_8.0: &mut {async fn body of ActionPermit<'_, T>::perform()});
 +         _21 = &mut (((*_37) as variant#3).1: std::future::Ready<()>);
 +         _20 = &mut (*_21);
-+         _19 = Pin::<&mut std::future::Ready<()>> { __pointer: copy _20 };
++         _19 = Pin::<&mut std::future::Ready<()>> { pointer: copy _20 };
 +         StorageDead(_20);
 +         StorageLive(_22);
 +         StorageLive(_23);
@@ -239,7 +239,7 @@
 +         _48 = &mut (_19.0: &mut std::future::Ready<()>);
 +         _45 = copy (_19.0: &mut std::future::Ready<()>);
 +         StorageDead(_48);
-+         _47 = Pin::<&mut std::future::Ready<()>> { __pointer: copy _45 };
++         _47 = Pin::<&mut std::future::Ready<()>> { pointer: copy _45 };
 +         StorageDead(_47);
 +         _44 = &mut ((*_45).0: std::option::Option<()>);
 +         StorageLive(_49);
diff --git a/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-unwind.diff b/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-unwind.diff
index e7aed556f2d..94b89a310ba 100644
--- a/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-unwind.diff
+++ b/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-unwind.diff
@@ -123,7 +123,7 @@
 -     }
 - 
 -     bb2: {
-+         _4 = Pin::<&mut {async fn body of ActionPermit<'_, T>::perform()}> { __pointer: copy _5 };
++         _4 = Pin::<&mut {async fn body of ActionPermit<'_, T>::perform()}> { pointer: copy _5 };
           StorageDead(_5);
           StorageLive(_6);
           StorageLive(_7);
@@ -235,7 +235,7 @@
 +         _37 = deref_copy (_8.0: &mut {async fn body of ActionPermit<'_, T>::perform()});
 +         _21 = &mut (((*_37) as variant#3).1: std::future::Ready<()>);
 +         _20 = &mut (*_21);
-+         _19 = Pin::<&mut std::future::Ready<()>> { __pointer: copy _20 };
++         _19 = Pin::<&mut std::future::Ready<()>> { pointer: copy _20 };
 +         StorageDead(_20);
 +         StorageLive(_22);
 +         StorageLive(_23);
@@ -256,7 +256,7 @@
 +         _50 = &mut (_19.0: &mut std::future::Ready<()>);
 +         _47 = copy (_19.0: &mut std::future::Ready<()>);
 +         StorageDead(_50);
-+         _49 = Pin::<&mut std::future::Ready<()>> { __pointer: copy _47 };
++         _49 = Pin::<&mut std::future::Ready<()>> { pointer: copy _47 };
 +         StorageDead(_49);
 +         _46 = &mut ((*_47).0: std::option::Option<()>);
 +         StorageLive(_51);
diff --git a/tests/mir-opt/or_pattern.single_switchint.SimplifyCfg-initial.after.mir b/tests/mir-opt/or_pattern.single_switchint.SimplifyCfg-initial.after.mir
index 889ff6f9f5e..be0931eaa61 100644
--- a/tests/mir-opt/or_pattern.single_switchint.SimplifyCfg-initial.after.mir
+++ b/tests/mir-opt/or_pattern.single_switchint.SimplifyCfg-initial.after.mir
@@ -14,7 +14,7 @@ fn single_switchint() -> () {
     }
 
     bb1: {
-        switchInt(copy (_2.0: i32)) -> [3: bb8, 4: bb8, otherwise: bb7];
+        switchInt(copy (_2.0: i32)) -> [3: bb9, 4: bb9, otherwise: bb8];
     }
 
     bb2: {
@@ -22,7 +22,7 @@ fn single_switchint() -> () {
     }
 
     bb3: {
-        falseEdge -> [real: bb12, imaginary: bb4];
+        falseEdge -> [real: bb14, imaginary: bb4];
     }
 
     bb4: {
@@ -30,43 +30,51 @@ fn single_switchint() -> () {
     }
 
     bb5: {
-        falseEdge -> [real: bb11, imaginary: bb6];
+        falseEdge -> [real: bb13, imaginary: bb6];
     }
 
     bb6: {
-        falseEdge -> [real: bb10, imaginary: bb1];
+        switchInt(copy (_2.1: bool)) -> [0: bb7, otherwise: bb7];
     }
 
     bb7: {
-        _1 = const 5_i32;
-        goto -> bb13;
+        falseEdge -> [real: bb12, imaginary: bb1];
     }
 
     bb8: {
-        falseEdge -> [real: bb9, imaginary: bb7];
+        _1 = const 5_i32;
+        goto -> bb15;
     }
 
     bb9: {
-        _1 = const 4_i32;
-        goto -> bb13;
+        switchInt(copy (_2.1: bool)) -> [0: bb10, otherwise: bb10];
     }
 
     bb10: {
-        _1 = const 3_i32;
-        goto -> bb13;
+        falseEdge -> [real: bb11, imaginary: bb8];
     }
 
     bb11: {
-        _1 = const 2_i32;
-        goto -> bb13;
+        _1 = const 4_i32;
+        goto -> bb15;
     }
 
     bb12: {
-        _1 = const 1_i32;
-        goto -> bb13;
+        _1 = const 3_i32;
+        goto -> bb15;
     }
 
     bb13: {
+        _1 = const 2_i32;
+        goto -> bb15;
+    }
+
+    bb14: {
+        _1 = const 1_i32;
+        goto -> bb15;
+    }
+
+    bb15: {
         StorageDead(_2);
         StorageDead(_1);
         _0 = const ();
diff --git a/tests/mir-opt/read_from_trivial_switch.main.SimplifyCfg-initial.diff b/tests/mir-opt/read_from_trivial_switch.main.SimplifyCfg-initial.diff
new file mode 100644
index 00000000000..87758408a1c
--- /dev/null
+++ b/tests/mir-opt/read_from_trivial_switch.main.SimplifyCfg-initial.diff
@@ -0,0 +1,49 @@
+- // MIR for `main` before SimplifyCfg-initial
++ // MIR for `main` after SimplifyCfg-initial
+  
+  fn main() -> () {
+      let mut _0: ();
+      let _1: &i32;
+      let _2: i32;
+      scope 1 {
+          debug ref_ => _1;
+          scope 2 {
+          }
+      }
+  
+      bb0: {
+          StorageLive(_1);
+          StorageLive(_2);
+          _2 = const 1_i32;
+          _1 = &_2;
+          FakeRead(ForLet(None), _1);
+          PlaceMention(_1);
+-         switchInt(copy (*_1)) -> [0: bb2, otherwise: bb1];
++         switchInt(copy (*_1)) -> [0: bb1, otherwise: bb1];
+      }
+  
+      bb1: {
+-         goto -> bb5;
+-     }
+- 
+-     bb2: {
+-         goto -> bb5;
+-     }
+- 
+-     bb3: {
+-         goto -> bb1;
+-     }
+- 
+-     bb4: {
+-         FakeRead(ForMatchedPlace(None), _1);
+-         unreachable;
+-     }
+- 
+-     bb5: {
+          _0 = const ();
+          StorageDead(_2);
+          StorageDead(_1);
+          return;
+      }
+  }
+  
diff --git a/tests/mir-opt/read_from_trivial_switch.rs b/tests/mir-opt/read_from_trivial_switch.rs
new file mode 100644
index 00000000000..1c64c1d45e8
--- /dev/null
+++ b/tests/mir-opt/read_from_trivial_switch.rs
@@ -0,0 +1,15 @@
+// Ensure that we don't optimize out `SwitchInt` reads even if that terminator
+// branches to the same basic block on every target, since the operand may have
+// side-effects that affect analysis of the MIR.
+//
+// See <https://github.com/rust-lang/miri/issues/4237>.
+
+//@ test-mir-pass: SimplifyCfg-initial
+//@ compile-flags: -Zmir-preserve-ub
+
+// EMIT_MIR read_from_trivial_switch.main.SimplifyCfg-initial.diff
+fn main() {
+    let ref_ = &1i32;
+    // CHECK: switchInt
+    let &(0 | _) = ref_;
+}
diff --git a/tests/pretty/postfix-yield.rs b/tests/pretty/postfix-yield.rs
index f76e8142ae8..60380a4071c 100644
--- a/tests/pretty/postfix-yield.rs
+++ b/tests/pretty/postfix-yield.rs
@@ -2,7 +2,8 @@
 //@ edition: 2024
 //@ pp-exact
 
-#![feature(gen_blocks, coroutines, coroutine_trait, yield_expr)]
+#![feature(gen_blocks, coroutines, coroutine_trait, yield_expr,
+stmt_expr_attributes)]
 
 use std::ops::{Coroutine, CoroutineState};
 use std::pin::pin;
diff --git a/tests/rustdoc-json/impls/auto.rs b/tests/rustdoc-json/impls/auto.rs
index f94f7338480..ce47d1be690 100644
--- a/tests/rustdoc-json/impls/auto.rs
+++ b/tests/rustdoc-json/impls/auto.rs
@@ -15,8 +15,8 @@ impl Foo {
 }
 
 // Testing spans, so all tests below code
-//@ is "$.index[?(@.docs=='has span')].span.begin" "[13, 0]"
-//@ is "$.index[?(@.docs=='has span')].span.end" "[15, 1]"
+//@ is "$.index[?(@.docs=='has span')].span.begin" "[13, 1]"
+//@ is "$.index[?(@.docs=='has span')].span.end" "[15, 2]"
 // FIXME: this doesn't work due to https://github.com/freestrings/jsonpath/issues/91
 // is "$.index[?(@.inner.impl.is_synthetic==true)].span" null
 pub struct Foo;
diff --git a/tests/rustdoc-json/span.rs b/tests/rustdoc-json/span.rs
new file mode 100644
index 00000000000..c96879d0e68
--- /dev/null
+++ b/tests/rustdoc-json/span.rs
@@ -0,0 +1,4 @@
+pub mod bar {}
+// This test ensures that spans are 1-indexed.
+//@ is "$.index[?(@.name=='span')].span.begin" "[1, 1]"
+//@ is "$.index[?(@.name=='bar')].span.begin" "[1, 1]"
diff --git a/tests/ui/async-await/pin-ergonomics/reborrow-once.stderr b/tests/ui/async-await/pin-ergonomics/reborrow-once.stderr
index a1ea2b4a57a..dc8e424ad2a 100644
--- a/tests/ui/async-await/pin-ergonomics/reborrow-once.stderr
+++ b/tests/ui/async-await/pin-ergonomics/reborrow-once.stderr
@@ -1,4 +1,4 @@
-error[E0499]: cannot borrow `*x.__pointer` as mutable more than once at a time
+error[E0499]: cannot borrow `*x.pointer` as mutable more than once at a time
   --> $DIR/reborrow-once.rs:12:14
    |
 LL |     twice(x, x);
diff --git a/tests/ui/coroutine/postfix-yield.rs b/tests/ui/coroutine/postfix-yield.rs
index ff843138c8c..f2fdcebdaa9 100644
--- a/tests/ui/coroutine/postfix-yield.rs
+++ b/tests/ui/coroutine/postfix-yield.rs
@@ -3,7 +3,7 @@
 //@ run-pass
 //@ edition: 2024
 
-#![feature(gen_blocks, coroutines, coroutine_trait, yield_expr)]
+#![feature(gen_blocks, coroutines, coroutine_trait, yield_expr, stmt_expr_attributes)]
 
 use std::ops::{Coroutine, CoroutineState};
 use std::pin::pin;
diff --git a/tests/ui/feature-gates/feature-gate-unsafe_pin_internals.rs b/tests/ui/feature-gates/feature-gate-unsafe_pin_internals.rs
deleted file mode 100644
index deb5a2f691b..00000000000
--- a/tests/ui/feature-gates/feature-gate-unsafe_pin_internals.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-//@ edition:2018
-#![forbid(internal_features, unsafe_code)]
-#![feature(unsafe_pin_internals)]
-//~^ ERROR the feature `unsafe_pin_internals` is internal to the compiler or standard library
-
-use core::{marker::PhantomPinned, pin::Pin};
-
-/// The `unsafe_pin_internals` is indeed unsound.
-fn non_unsafe_pin_new_unchecked<T>(pointer: &mut T) -> Pin<&mut T> {
-    Pin { __pointer: pointer }
-}
-
-fn main() {
-    let mut self_referential = PhantomPinned;
-    let _: Pin<&mut PhantomPinned> = non_unsafe_pin_new_unchecked(&mut self_referential);
-}
diff --git a/tests/ui/feature-gates/feature-gate-unsafe_pin_internals.stderr b/tests/ui/feature-gates/feature-gate-unsafe_pin_internals.stderr
deleted file mode 100644
index fc9bcd90e52..00000000000
--- a/tests/ui/feature-gates/feature-gate-unsafe_pin_internals.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error: the feature `unsafe_pin_internals` is internal to the compiler or standard library
-  --> $DIR/feature-gate-unsafe_pin_internals.rs:3:12
-   |
-LL | #![feature(unsafe_pin_internals)]
-   |            ^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: using it is strongly discouraged
-note: the lint level is defined here
-  --> $DIR/feature-gate-unsafe_pin_internals.rs:2:11
-   |
-LL | #![forbid(internal_features, unsafe_code)]
-   |           ^^^^^^^^^^^^^^^^^
-
-error: aborting due to 1 previous error
-
diff --git a/tests/ui/lint/break-with-label-and-unsafe-block.rs b/tests/ui/lint/break-with-label-and-unsafe-block.rs
new file mode 100644
index 00000000000..a76a5761475
--- /dev/null
+++ b/tests/ui/lint/break-with-label-and-unsafe-block.rs
@@ -0,0 +1,11 @@
+//@ check-pass
+
+#![deny(break_with_label_and_loop)]
+
+unsafe fn foo() -> i32 { 42 }
+
+fn main () {
+    'label: loop {
+        break 'label unsafe { foo() }
+    };
+}
diff --git a/tests/ui/pattern/uninit-trivial.rs b/tests/ui/pattern/uninit-trivial.rs
new file mode 100644
index 00000000000..6ea6796c1c1
--- /dev/null
+++ b/tests/ui/pattern/uninit-trivial.rs
@@ -0,0 +1,8 @@
+// Regression test for the semantic changes in
+// <https://github.com/rust-lang/rust/pull/139042>.
+
+fn main() {
+    let x;
+    let (0 | _) = x;
+    //~^ ERROR used binding `x` isn't initialized
+}
diff --git a/tests/ui/pattern/uninit-trivial.stderr b/tests/ui/pattern/uninit-trivial.stderr
new file mode 100644
index 00000000000..2ff8557c945
--- /dev/null
+++ b/tests/ui/pattern/uninit-trivial.stderr
@@ -0,0 +1,16 @@
+error[E0381]: used binding `x` isn't initialized
+  --> $DIR/uninit-trivial.rs:6:10
+   |
+LL |     let x;
+   |         - binding declared here but left uninitialized
+LL |     let (0 | _) = x;
+   |          ^^^^^ `x` used here but it isn't initialized
+   |
+help: consider assigning a value
+   |
+LL |     let x = 42;
+   |           ++++
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/tests/ui/pin-macro/cant_access_internals.rs b/tests/ui/pin-macro/cant_access_internals.rs
deleted file mode 100644
index 36a47d0fdf9..00000000000
--- a/tests/ui/pin-macro/cant_access_internals.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-//@ edition:2018
-
-use core::{
-    marker::PhantomPinned,
-    mem,
-    pin::{pin, Pin},
-};
-
-fn main() {
-    let mut phantom_pinned = pin!(PhantomPinned);
-    mem::take(phantom_pinned.__pointer); //~ ERROR use of unstable library feature `unsafe_pin_internals`
-}
diff --git a/tests/ui/pin-macro/cant_access_internals.stderr b/tests/ui/pin-macro/cant_access_internals.stderr
deleted file mode 100644
index 8ad897bbbb9..00000000000
--- a/tests/ui/pin-macro/cant_access_internals.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0658]: use of unstable library feature `unsafe_pin_internals`
-  --> $DIR/cant_access_internals.rs:11:15
-   |
-LL |     mem::take(phantom_pinned.__pointer);
-   |               ^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = help: add `#![feature(unsafe_pin_internals)]` to the crate attributes to enable
-   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
-
-error: aborting due to 1 previous error
-
-For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/pin-macro/lifetime_errors_on_promotion_misusage.rs b/tests/ui/pin-macro/lifetime_errors_on_promotion_misusage.rs
index 8a0244e8145..e505fe43520 100644
--- a/tests/ui/pin-macro/lifetime_errors_on_promotion_misusage.rs
+++ b/tests/ui/pin-macro/lifetime_errors_on_promotion_misusage.rs
@@ -9,14 +9,14 @@ use core::{
 
 fn function_call_stops_borrow_extension() {
     let phantom_pinned = identity(pin!(PhantomPinned));
-    //~^ ERROR temporary value dropped while borrowed
+    //~^ ERROR does not live long enough
     stuff(phantom_pinned)
 }
 
 fn promotion_only_works_for_the_innermost_block() {
     let phantom_pinned = {
         let phantom_pinned = pin!(PhantomPinned);
-        //~^ ERROR temporary value dropped while borrowed
+        //~^ ERROR does not live long enough
         phantom_pinned
     };
     stuff(phantom_pinned)
diff --git a/tests/ui/pin-macro/lifetime_errors_on_promotion_misusage.stderr b/tests/ui/pin-macro/lifetime_errors_on_promotion_misusage.stderr
index 9df7f0ffd0c..43fb82be7c2 100644
--- a/tests/ui/pin-macro/lifetime_errors_on_promotion_misusage.stderr
+++ b/tests/ui/pin-macro/lifetime_errors_on_promotion_misusage.stderr
@@ -1,35 +1,29 @@
-error[E0716]: temporary value dropped while borrowed
+error[E0597]: value does not live long enough
   --> $DIR/lifetime_errors_on_promotion_misusage.rs:11:35
    |
 LL |     let phantom_pinned = identity(pin!(PhantomPinned));
-   |                                   ^^^^^^^^^^^^^^^^^^^ - temporary value is freed at the end of this statement
+   |                                   ^^^^^^^^^^^^^^^^^^^ - value dropped here while still borrowed
    |                                   |
-   |                                   creates a temporary value which is freed while still in use
+   |                                   borrowed value does not live long enough
 LL |
 LL |     stuff(phantom_pinned)
    |           -------------- borrow later used here
    |
    = note: this error originates in the macro `pin` (in Nightly builds, run with -Z macro-backtrace for more info)
-help: consider using a `let` binding to create a longer lived value
-   |
-LL ~     let binding = pin!(PhantomPinned);
-LL ~     let phantom_pinned = identity(binding);
-   |
 
-error[E0716]: temporary value dropped while borrowed
+error[E0597]: value does not live long enough
   --> $DIR/lifetime_errors_on_promotion_misusage.rs:18:30
    |
 LL |     let phantom_pinned = {
    |         -------------- borrow later stored here
 LL |         let phantom_pinned = pin!(PhantomPinned);
-   |                              ^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
+   |                              ^^^^^^^^^^^^^^^^^^^ borrowed value does not live long enough
 ...
 LL |     };
-   |     - temporary value is freed at the end of this statement
+   |     - value dropped here while still borrowed
    |
-   = note: consider using a `let` binding to create a longer lived value
    = note: this error originates in the macro `pin` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 2 previous errors
 
-For more information about this error, try `rustc --explain E0716`.
+For more information about this error, try `rustc --explain E0597`.
diff --git a/tests/ui/pin-macro/pin_move.stderr b/tests/ui/pin-macro/pin_move.stderr
index c9b8ad9b202..3f466020988 100644
--- a/tests/ui/pin-macro/pin_move.stderr
+++ b/tests/ui/pin-macro/pin_move.stderr
@@ -31,6 +31,11 @@ LL |     struct NotCopy<T>(T);
 LL |     let mut pointee = NotCopy(PhantomPinned);
 LL |     pin!(*&mut pointee);
    |          ------------- you could clone this value
+help: consider removing the dereference here
+   |
+LL -     pin!(*&mut pointee);
+LL +     pin!(&mut pointee);
+   |
 
 error: aborting due to 2 previous errors