Skip to content

Commit f479a7a

Browse files
Restore some removed tests
1 parent 52aff53 commit f479a7a

7 files changed

+50
-12
lines changed

tests/ui/const-generics/late-bound-vars/in_closure.rs

+1-9
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
// known-bug: unknown
2-
3-
// If we want this to compile, then we'd need to do something like RPITs do,
4-
// where nested associated constants have early-bound versions of their captured
5-
// late-bound vars inserted into their generics. This gives us substitutable
6-
// lifetimes to actually use when borrow-checking the associated const, which is
7-
// lowered as a totally separate body from its parent. Since this doesn't exist,
8-
// so we should just error rather than resolving this late-bound var with no
9-
// binder to actually attach it to, or worse, as a free region that can't even be
10-
// substituted correctly, and ICEing. - @compiler-errors
2+
// see comment on `tests/ui/const-generics/late-bound-vars/simple.rs`
113

124
#![feature(generic_const_exprs)]
135
#![allow(incomplete_features)]

tests/ui/const-generics/late-bound-vars/in_closure.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: cannot capture late-bound lifetime in constant
2-
--> $DIR/in_closure.rs:24:29
2+
--> $DIR/in_closure.rs:16:29
33
|
44
LL | fn test<'a>() {
55
| -- lifetime defined here
@@ -8,7 +8,7 @@ LL | let _: [u8; inner::<'a>()];
88
| ^^
99

1010
error: cannot capture late-bound lifetime in constant
11-
--> $DIR/in_closure.rs:25:29
11+
--> $DIR/in_closure.rs:17:29
1212
|
1313
LL | fn test<'a>() {
1414
| -- lifetime defined here
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// known-bug: unknown
2+
// see comment on `tests/ui/const-generics/late-bound-vars/simple.rs`
3+
4+
#![feature(generic_const_exprs)]
5+
#![allow(incomplete_features)]
6+
7+
trait MyTrait<T> {}
8+
9+
fn bug<'a, T>() -> &'static dyn MyTrait<[(); { |x: &'a u32| { x }; 4 }]> {
10+
todo!()
11+
}
12+
13+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: cannot capture late-bound lifetime in constant
2+
--> $DIR/late-bound-in-return-issue-77357.rs:9:53
3+
|
4+
LL | fn bug<'a, T>() -> &'static dyn MyTrait<[(); { |x: &'a u32| { x }; 4 }]> {
5+
| -- lifetime defined here ^^
6+
7+
error: aborting due to previous error
8+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// known-bug: unknown
2+
// see comment on `tests/ui/const-generics/late-bound-vars/simple.rs`
3+
4+
#![feature(generic_const_exprs)]
5+
#![allow(incomplete_features)]
6+
7+
fn bug<'a>()
8+
where
9+
for<'b> [(); {
10+
let x: &'b ();
11+
0
12+
}]:
13+
{}
14+
15+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: cannot capture late-bound lifetime in constant
2+
--> $DIR/late-bound-in-where-issue-83993.rs:10:17
3+
|
4+
LL | for<'b> [(); {
5+
| -- lifetime defined here
6+
LL | let x: &'b ();
7+
| ^^
8+
9+
error: aborting due to previous error
10+

tests/ui/const-generics/late-bound-vars/simple.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// late-bound vars inserted into their generics. This gives us substitutable
66
// lifetimes to actually use when borrow-checking the associated const, which is
77
// lowered as a totally separate body from its parent. Since this doesn't exist,
8-
// so we should just error rather than resolving this late-bound var with no
8+
// we should just error rather than resolving this late-bound var with no
99
// binder to actually attach it to, or worse, as a free region that can't even be
1010
// substituted correctly, and ICEing. - @compiler-errors
1111

0 commit comments

Comments
 (0)