Restore some removed tests

This commit is contained in:
Michael Goulet 2023-09-02 22:53:59 +00:00
parent 52aff53812
commit f479a7aa8d
7 changed files with 50 additions and 12 deletions

View File

@ -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)]

View File

@ -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

View File

@ -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() {}

View File

@ -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

View File

@ -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() {}

View File

@ -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

View File

@ -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