about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tests/ui/const-generics/late-bound-vars/in_closure.rs10
-rw-r--r--tests/ui/const-generics/late-bound-vars/in_closure.stderr4
-rw-r--r--tests/ui/const-generics/late-bound-vars/late-bound-in-return-issue-77357.rs13
-rw-r--r--tests/ui/const-generics/late-bound-vars/late-bound-in-return-issue-77357.stderr8
-rw-r--r--tests/ui/const-generics/late-bound-vars/late-bound-in-where-issue-83993.rs15
-rw-r--r--tests/ui/const-generics/late-bound-vars/late-bound-in-where-issue-83993.stderr10
-rw-r--r--tests/ui/const-generics/late-bound-vars/simple.rs2
7 files changed, 50 insertions, 12 deletions
diff --git a/tests/ui/const-generics/late-bound-vars/in_closure.rs b/tests/ui/const-generics/late-bound-vars/in_closure.rs
index 349e82fa45a..443c755c601 100644
--- a/tests/ui/const-generics/late-bound-vars/in_closure.rs
+++ b/tests/ui/const-generics/late-bound-vars/in_closure.rs
@@ -1,13 +1,5 @@
 // known-bug: unknown
-
-// If we want this to compile, then we'd need to do something like RPITs do,
-// where nested associated constants have early-bound versions of their captured
-// late-bound vars inserted into their generics. This gives us substitutable
-// lifetimes to actually use when borrow-checking the associated const, which is
-// lowered as a totally separate body from its parent. Since this doesn't exist,
-// so we should just error rather than resolving this late-bound var with no
-// binder to actually attach it to, or worse, as a free region that can't even be
-// substituted correctly, and ICEing. - @compiler-errors
+// see comment on `tests/ui/const-generics/late-bound-vars/simple.rs`
 
 #![feature(generic_const_exprs)]
 #![allow(incomplete_features)]
diff --git a/tests/ui/const-generics/late-bound-vars/in_closure.stderr b/tests/ui/const-generics/late-bound-vars/in_closure.stderr
index 275dd742ebd..e15496454a0 100644
--- a/tests/ui/const-generics/late-bound-vars/in_closure.stderr
+++ b/tests/ui/const-generics/late-bound-vars/in_closure.stderr
@@ -1,5 +1,5 @@
 error: cannot capture late-bound lifetime in constant
-  --> $DIR/in_closure.rs:24:29
+  --> $DIR/in_closure.rs:16:29
    |
 LL | fn test<'a>() {
    |         -- lifetime defined here
@@ -8,7 +8,7 @@ LL |         let _: [u8; inner::<'a>()];
    |                             ^^
 
 error: cannot capture late-bound lifetime in constant
-  --> $DIR/in_closure.rs:25:29
+  --> $DIR/in_closure.rs:17:29
    |
 LL | fn test<'a>() {
    |         -- lifetime defined here
diff --git a/tests/ui/const-generics/late-bound-vars/late-bound-in-return-issue-77357.rs b/tests/ui/const-generics/late-bound-vars/late-bound-in-return-issue-77357.rs
new file mode 100644
index 00000000000..b81aa50d9a9
--- /dev/null
+++ b/tests/ui/const-generics/late-bound-vars/late-bound-in-return-issue-77357.rs
@@ -0,0 +1,13 @@
+// known-bug: unknown
+// see comment on `tests/ui/const-generics/late-bound-vars/simple.rs`
+
+#![feature(generic_const_exprs)]
+#![allow(incomplete_features)]
+
+trait MyTrait<T> {}
+
+fn bug<'a, T>() -> &'static dyn MyTrait<[(); { |x: &'a u32| { x }; 4 }]> {
+    todo!()
+}
+
+fn main() {}
diff --git a/tests/ui/const-generics/late-bound-vars/late-bound-in-return-issue-77357.stderr b/tests/ui/const-generics/late-bound-vars/late-bound-in-return-issue-77357.stderr
new file mode 100644
index 00000000000..21c8fe6865c
--- /dev/null
+++ b/tests/ui/const-generics/late-bound-vars/late-bound-in-return-issue-77357.stderr
@@ -0,0 +1,8 @@
+error: cannot capture late-bound lifetime in constant
+  --> $DIR/late-bound-in-return-issue-77357.rs:9:53
+   |
+LL | fn bug<'a, T>() -> &'static dyn MyTrait<[(); { |x: &'a u32| { x }; 4 }]> {
+   |        -- lifetime defined here                     ^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/const-generics/late-bound-vars/late-bound-in-where-issue-83993.rs b/tests/ui/const-generics/late-bound-vars/late-bound-in-where-issue-83993.rs
new file mode 100644
index 00000000000..89f01748fc9
--- /dev/null
+++ b/tests/ui/const-generics/late-bound-vars/late-bound-in-where-issue-83993.rs
@@ -0,0 +1,15 @@
+// known-bug: unknown
+// see comment on `tests/ui/const-generics/late-bound-vars/simple.rs`
+
+#![feature(generic_const_exprs)]
+#![allow(incomplete_features)]
+
+fn bug<'a>()
+where
+    for<'b> [(); {
+        let x: &'b ();
+        0
+    }]:
+{}
+
+fn main() {}
diff --git a/tests/ui/const-generics/late-bound-vars/late-bound-in-where-issue-83993.stderr b/tests/ui/const-generics/late-bound-vars/late-bound-in-where-issue-83993.stderr
new file mode 100644
index 00000000000..a66dc8db914
--- /dev/null
+++ b/tests/ui/const-generics/late-bound-vars/late-bound-in-where-issue-83993.stderr
@@ -0,0 +1,10 @@
+error: cannot capture late-bound lifetime in constant
+  --> $DIR/late-bound-in-where-issue-83993.rs:10:17
+   |
+LL |     for<'b> [(); {
+   |         -- lifetime defined here
+LL |         let x: &'b ();
+   |                 ^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/const-generics/late-bound-vars/simple.rs b/tests/ui/const-generics/late-bound-vars/simple.rs
index c459419115a..a562bd8cb41 100644
--- a/tests/ui/const-generics/late-bound-vars/simple.rs
+++ b/tests/ui/const-generics/late-bound-vars/simple.rs
@@ -5,7 +5,7 @@
 // late-bound vars inserted into their generics. This gives us substitutable
 // lifetimes to actually use when borrow-checking the associated const, which is
 // lowered as a totally separate body from its parent. Since this doesn't exist,
-// so we should just error rather than resolving this late-bound var with no
+// we should just error rather than resolving this late-bound var with no
 // binder to actually attach it to, or worse, as a free region that can't even be
 // substituted correctly, and ICEing. - @compiler-errors