Add regression test for #87258
This commit is contained in:
parent
1b61b1b445
commit
f9344296c1
24
src/test/ui/generic-associated-types/issue-87258_a.rs
Normal file
24
src/test/ui/generic-associated-types/issue-87258_a.rs
Normal file
@ -0,0 +1,24 @@
|
||||
#![feature(type_alias_impl_trait)]
|
||||
#![feature(generic_associated_types)]
|
||||
|
||||
// See https://github.com/rust-lang/rust/issues/87258#issuecomment-883293367
|
||||
|
||||
trait Trait1 {}
|
||||
|
||||
struct Struct<'b>(&'b ());
|
||||
|
||||
impl<'d> Trait1 for Struct<'d> {}
|
||||
|
||||
pub trait Trait2 {
|
||||
type FooFuture<'a>: Trait1;
|
||||
fn foo<'a>() -> Self::FooFuture<'a>;
|
||||
}
|
||||
|
||||
impl<'c, S: Trait2> Trait2 for &'c mut S {
|
||||
type FooFuture<'a> = impl Trait1;
|
||||
fn foo<'a>() -> Self::FooFuture<'a> { //~ ERROR
|
||||
Struct(unimplemented!())
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
11
src/test/ui/generic-associated-types/issue-87258_a.stderr
Normal file
11
src/test/ui/generic-associated-types/issue-87258_a.stderr
Normal file
@ -0,0 +1,11 @@
|
||||
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
|
||||
--> $DIR/issue-87258_a.rs:19:21
|
||||
|
|
||||
LL | fn foo<'a>() -> Self::FooFuture<'a> {
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: hidden type `Struct<'_>` captures lifetime '_#7r
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0700`.
|
26
src/test/ui/generic-associated-types/issue-87258_b.rs
Normal file
26
src/test/ui/generic-associated-types/issue-87258_b.rs
Normal file
@ -0,0 +1,26 @@
|
||||
#![feature(type_alias_impl_trait)]
|
||||
#![feature(generic_associated_types)]
|
||||
|
||||
// See https://github.com/rust-lang/rust/issues/87258#issuecomment-883293367
|
||||
|
||||
trait Trait1 {}
|
||||
|
||||
struct Struct<'b>(&'b ());
|
||||
|
||||
impl<'d> Trait1 for Struct<'d> {}
|
||||
|
||||
pub trait Trait2 {
|
||||
type FooFuture<'a>: Trait1;
|
||||
fn foo<'a>() -> Self::FooFuture<'a>;
|
||||
}
|
||||
|
||||
type Helper<'xenon, 'yttrium, KABOOM: Trait2> = impl Trait1;
|
||||
|
||||
impl<'c, S: Trait2> Trait2 for &'c mut S {
|
||||
type FooFuture<'a> = Helper<'c, 'a, S>;
|
||||
fn foo<'a>() -> Self::FooFuture<'a> { //~ ERROR
|
||||
Struct(unimplemented!())
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
11
src/test/ui/generic-associated-types/issue-87258_b.stderr
Normal file
11
src/test/ui/generic-associated-types/issue-87258_b.stderr
Normal file
@ -0,0 +1,11 @@
|
||||
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
|
||||
--> $DIR/issue-87258_b.rs:21:21
|
||||
|
|
||||
LL | fn foo<'a>() -> Self::FooFuture<'a> {
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: hidden type `Struct<'_>` captures lifetime '_#7r
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0700`.
|
Loading…
Reference in New Issue
Block a user