fixyfixfix
This commit is contained in:
parent
88935e0bea
commit
c0889a6005
6 changed files with 141 additions and 29 deletions
|
|
@ -1,18 +0,0 @@
|
|||
error[E0581]: return type references an anonymous lifetime, which is not constrained by the fn input types
|
||||
--> $DIR/issue-47511.rs:8:15
|
||||
|
|
||||
LL | fn f(_: X) -> X {
|
||||
| ^
|
||||
|
|
||||
= note: lifetimes appearing in an associated or opaque type are not considered constrained
|
||||
= note: consider introducing a named lifetime parameter
|
||||
|
||||
error[E0581]: return type references lifetime `'a`, which is not constrained by the fn input types
|
||||
--> $DIR/issue-47511.rs:12:23
|
||||
|
|
||||
LL | fn g<'a>(_: X<'a>) -> X<'a> {
|
||||
| ^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0581`.
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
// check-pass
|
||||
|
||||
trait Gats<'a> {
|
||||
type Assoc;
|
||||
type Assoc2;
|
||||
}
|
||||
|
||||
trait Trait: for<'a> Gats<'a> {
|
||||
fn foo<'a>(_: &mut <Self as Gats<'a>>::Assoc) -> <Self as Gats<'a>>::Assoc2;
|
||||
}
|
||||
|
||||
impl<'a> Gats<'a> for () {
|
||||
type Assoc = &'a u32;
|
||||
type Assoc2 = ();
|
||||
}
|
||||
|
||||
type GatsAssoc<'a, T> = <T as Gats<'a>>::Assoc;
|
||||
type GatsAssoc2<'a, T> = <T as Gats<'a>>::Assoc2;
|
||||
|
||||
impl Trait for () {
|
||||
fn foo<'a>(_: &mut GatsAssoc<'a, Self>) -> GatsAssoc2<'a, Self> {}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -1,9 +1,4 @@
|
|||
// check-fail
|
||||
// known-bug: #47511
|
||||
|
||||
// Regression test for #47511: anonymous lifetimes can appear
|
||||
// unconstrained in a return type, but only if they appear just once
|
||||
// in the input, as the input to a projection.
|
||||
// check-pass
|
||||
|
||||
fn f(_: X) -> X {
|
||||
unimplemented!()
|
||||
12
src/test/ui/late-bound-lifetimes/mismatched_arg_count.rs
Normal file
12
src/test/ui/late-bound-lifetimes/mismatched_arg_count.rs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
// ensures that we don't ICE when there are too many args supplied to the alias.
|
||||
|
||||
trait Trait<'a> {
|
||||
type Assoc;
|
||||
}
|
||||
|
||||
type Alias<'a, T> = <T as Trait<'a>>::Assoc;
|
||||
|
||||
fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {}
|
||||
//~^ error: this type alias takes 1 lifetime argument but 2 lifetime arguments were supplied
|
||||
|
||||
fn main() {}
|
||||
17
src/test/ui/late-bound-lifetimes/mismatched_arg_count.stderr
Normal file
17
src/test/ui/late-bound-lifetimes/mismatched_arg_count.stderr
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
error[E0107]: this type alias takes 1 lifetime argument but 2 lifetime arguments were supplied
|
||||
--> $DIR/mismatched_arg_count.rs:9:29
|
||||
|
|
||||
LL | fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {}
|
||||
| ^^^^^ -- help: remove this lifetime argument
|
||||
| |
|
||||
| expected 1 lifetime argument
|
||||
|
|
||||
note: type alias defined here, with 1 lifetime parameter: `'a`
|
||||
--> $DIR/mismatched_arg_count.rs:7:6
|
||||
|
|
||||
LL | type Alias<'a, T> = <T as Trait<'a>>::Assoc;
|
||||
| ^^^^^ --
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0107`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue