Skip to content

Commit

Permalink
Restore some removed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Sep 5, 2023
1 parent 52aff53 commit f479a7a
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 12 deletions.
10 changes: 1 addition & 9 deletions tests/ui/const-generics/late-bound-vars/in_closure.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/const-generics/late-bound-vars/in_closure.stderr
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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() {}
Original file line number Diff line number Diff line change
@@ -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

Original file line number Diff line number Diff line change
@@ -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() {}
Original file line number Diff line number Diff line change
@@ -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

2 changes: 1 addition & 1 deletion tests/ui/const-generics/late-bound-vars/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit f479a7a

Please sign in to comment.