about summary refs log tree commit diff
path: root/tests/ui/inline-const
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2025-01-08 09:23:40 +0100
committerRalf Jung <post@ralfj.de>2025-01-08 09:23:40 +0100
commit2d180714e14b34e36bf883bdf706ebaf5fa96754 (patch)
tree36b4829675d832d323283fc37457f6509f8a519c /tests/ui/inline-const
parentfc4a52f598f6259a98964aa3290e9e74e396c1e3 (diff)
parent67f49010adf4ec3238564ec072b3652179813dd1 (diff)
downloadrust-2d180714e14b34e36bf883bdf706ebaf5fa96754.tar.gz
rust-2d180714e14b34e36bf883bdf706ebaf5fa96754.zip
Merge from rustc
Diffstat (limited to 'tests/ui/inline-const')
-rw-r--r--tests/ui/inline-const/collect-scopes-in-pat.rs16
-rw-r--r--tests/ui/inline-const/const-expr-lifetime-err.stderr7
-rw-r--r--tests/ui/inline-const/const-match-pat-lifetime-err.stderr2
3 files changed, 20 insertions, 5 deletions
diff --git a/tests/ui/inline-const/collect-scopes-in-pat.rs b/tests/ui/inline-const/collect-scopes-in-pat.rs
new file mode 100644
index 00000000000..024fde53741
--- /dev/null
+++ b/tests/ui/inline-const/collect-scopes-in-pat.rs
@@ -0,0 +1,16 @@
+// @compile-flags: -Zlint-mir
+//@ check-pass
+
+#![feature(inline_const_pat)]
+
+fn main() {
+    match 1 {
+        const {
+            || match 0 {
+                x => 0,
+            };
+            0
+        } => (),
+        _ => (),
+    }
+}
diff --git a/tests/ui/inline-const/const-expr-lifetime-err.stderr b/tests/ui/inline-const/const-expr-lifetime-err.stderr
index be3fc8d28c5..031bf98262a 100644
--- a/tests/ui/inline-const/const-expr-lifetime-err.stderr
+++ b/tests/ui/inline-const/const-expr-lifetime-err.stderr
@@ -6,10 +6,9 @@ LL | fn foo<'a>() {
 LL |     let y = ();
    |         - binding `y` declared here
 LL |     equate(InvariantRef::new(&y), const { InvariantRef::<'a>::NEW });
-   |            ------------------^^-
-   |            |                 |
-   |            |                 borrowed value does not live long enough
-   |            argument requires that `y` is borrowed for `'a`
+   |                              ^^           ----------------------- using this value as a constant requires that `y` is borrowed for `'a`
+   |                              |
+   |                              borrowed value does not live long enough
 LL |
 LL | }
    | - `y` dropped here while still borrowed
diff --git a/tests/ui/inline-const/const-match-pat-lifetime-err.stderr b/tests/ui/inline-const/const-match-pat-lifetime-err.stderr
index 95fe7085e50..7eea1846057 100644
--- a/tests/ui/inline-const/const-match-pat-lifetime-err.stderr
+++ b/tests/ui/inline-const/const-match-pat-lifetime-err.stderr
@@ -9,7 +9,7 @@ LL |     match InvariantRef::new(&y) {
    |                             ^^ borrowed value does not live long enough
 LL |
 LL |         const { InvariantRef::<'a>::NEW } => (),
-   |         --------------------------------- type annotation requires that `y` is borrowed for `'a`
+   |                 ----------------------- using this value as a constant requires that `y` is borrowed for `'a`
 LL |     }
 LL | }
    | - `y` dropped here while still borrowed