Make the test actually show the problematic case

This commit is contained in:
Oli Scherer 2022-09-23 07:15:55 +00:00
parent 90ec6f847f
commit e9d219e97c
2 changed files with 19 additions and 19 deletions

View File

@ -1,18 +1,27 @@
trait Mirror<'a> {
type Item;
#![feature(type_alias_impl_trait)]
// known-bug: #99840
// this should not compile
// check-pass
type Alias = impl Sized;
fn constrain() -> Alias {
1i32
}
impl<'a, T> Mirror<'a> for T {
type Item = T;
trait HideIt {
type Assoc;
}
trait AnotherTrait {
type Blah;
impl HideIt for () {
type Assoc = Alias;
}
impl<'a> AnotherTrait for <u32 as Mirror<'a>>::Item {
//~^ ERROR: the lifetime parameter `'a` is not constrained
type Blah = &'a u32;
}
pub trait Yay {}
impl Yay for <() as HideIt>::Assoc {}
// impl Yay for i32 {} // this already errors
// impl Yay for u32 {} // this also already errors
fn main() {}

View File

@ -1,9 +0,0 @@
error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
--> $DIR/implied_lifetime_wf_check.rs:13:6
|
LL | impl<'a> AnotherTrait for <u32 as Mirror<'a>>::Item {
| ^^ unconstrained lifetime parameter
error: aborting due to previous error
For more information about this error, try `rustc --explain E0207`.