diff options
Diffstat (limited to 'tests/ui/generic-associated-types')
26 files changed, 86 insertions, 53 deletions
diff --git a/tests/ui/generic-associated-types/bugs/issue-88460.stderr b/tests/ui/generic-associated-types/bugs/issue-88460.stderr index 6612c4b49..a2047f103 100644 --- a/tests/ui/generic-associated-types/bugs/issue-88460.stderr +++ b/tests/ui/generic-associated-types/bugs/issue-88460.stderr @@ -11,7 +11,7 @@ note: required by a bound in `test` --> $DIR/issue-88460.rs:15:27 | LL | fn test<T>(value: T) - | ---- required by a bound in this + | ---- required by a bound in this function ... LL | for<'a> T::Assoc<'a>: Marker, | ^^^^^^ required by this bound in `test` diff --git a/tests/ui/generic-associated-types/collections-project-default.stderr b/tests/ui/generic-associated-types/collections-project-default.stderr index 5701017dc..3c3ae24dd 100644 --- a/tests/ui/generic-associated-types/collections-project-default.stderr +++ b/tests/ui/generic-associated-types/collections-project-default.stderr @@ -5,10 +5,11 @@ LL | fn floatify_sibling<C>(ints: &C) -> <C as Collection<i32>>::Sibling<f32> | ------------------------------------ expected `<C as Collection<i32>>::Sibling<f32>` because of return type ... LL | res - | ^^^ expected Collection::Sibling, found CollectionFamily::Member + | ^^^ expected `Collection::Sibling`, found `CollectionFamily::Member` | = note: expected associated type `<C as Collection<i32>>::Sibling<f32>` found associated type `<<C as Collection<i32>>::Family as CollectionFamily>::Member<f32>` + = note: an associated type was expected, but a different one was found error: aborting due to previous error diff --git a/tests/ui/generic-associated-types/constraint-assoc-type-suggestion.stderr b/tests/ui/generic-associated-types/constraint-assoc-type-suggestion.stderr index 96c4330fe..3b65b32f4 100644 --- a/tests/ui/generic-associated-types/constraint-assoc-type-suggestion.stderr +++ b/tests/ui/generic-associated-types/constraint-assoc-type-suggestion.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/constraint-assoc-type-suggestion.rs:10:23 | LL | let b: Vec<i32> = a; - | -------- ^ expected struct `Vec`, found associated type + | -------- ^ expected `Vec<i32>`, found associated type | | | expected due to this | diff --git a/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.rs b/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.rs index 9eb069637..5738dfa83 100644 --- a/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.rs +++ b/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.rs @@ -5,12 +5,12 @@ trait X { fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {} //~^ ERROR: lifetime in trait object type must be followed by `+` //~| ERROR: parenthesized generic arguments cannot be used - //~| ERROR this associated type takes 0 generic arguments but 1 generic argument - //~| ERROR this associated type takes 1 lifetime argument but 0 lifetime arguments + //~| ERROR associated type takes 0 generic arguments but 1 generic argument + //~| ERROR associated type takes 1 lifetime argument but 0 lifetime arguments fn bar<'a>(arg: Box<dyn X<Y() = ()>>) {} //~^ ERROR: parenthesized generic arguments cannot be used - //~| ERROR this associated type takes 1 lifetime argument but 0 lifetime arguments + //~| ERROR associated type takes 1 lifetime argument but 0 lifetime arguments fn main() {} diff --git a/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr b/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr index 165779796..461853379 100644 --- a/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr +++ b/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr @@ -23,7 +23,7 @@ LL | fn bar<'a>(arg: Box<dyn X<Y() = ()>>) {} | | | help: remove these parentheses -error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied +error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/gat-trait-path-parenthesised-args.rs:5:27 | LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {} @@ -39,7 +39,7 @@ help: add missing lifetime argument LL | fn foo<'a>(arg: Box<dyn X<Y('_, 'a) = &'a ()>>) {} | +++ -error[E0107]: this associated type takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: associated type takes 0 generic arguments but 1 generic argument was supplied --> $DIR/gat-trait-path-parenthesised-args.rs:5:27 | LL | fn foo<'a>(arg: Box<dyn X<Y('a) = &'a ()>>) {} @@ -53,7 +53,7 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ -error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied +error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/gat-trait-path-parenthesised-args.rs:12:27 | LL | fn bar<'a>(arg: Box<dyn X<Y() = ()>>) {} diff --git a/tests/ui/generic-associated-types/issue-101020.stderr b/tests/ui/generic-associated-types/issue-101020.stderr index 1f9273a8c..5c8db617c 100644 --- a/tests/ui/generic-associated-types/issue-101020.stderr +++ b/tests/ui/generic-associated-types/issue-101020.stderr @@ -13,7 +13,7 @@ note: required by a bound in `LendingIterator::consume` --> $DIR/issue-101020.rs:9:33 | LL | fn consume<F>(self, _f: F) - | ------- required by a bound in this + | ------- required by a bound in this associated function ... LL | for<'a> Self::Item<'a>: FuncInput<'a, Self::Item<'a>>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `LendingIterator::consume` diff --git a/tests/ui/generic-associated-types/issue-68656-unsized-values.stderr b/tests/ui/generic-associated-types/issue-68656-unsized-values.stderr index e8770aedf..f0212e985 100644 --- a/tests/ui/generic-associated-types/issue-68656-unsized-values.stderr +++ b/tests/ui/generic-associated-types/issue-68656-unsized-values.stderr @@ -15,8 +15,8 @@ LL | type Item<'a>: std::ops::Deref<Target = T>; | ^^^^^^^^^^ required by this bound in `UnsafeCopy::Item` help: consider further restricting this bound | -LL | impl<T: Copy + std::ops::Deref + Deref<Target = T>> UnsafeCopy<T> for T { - | +++++++++++++++++++ +LL | impl<T: Copy + std::ops::Deref<Target = T>> UnsafeCopy<T> for T { + | ++++++++++++ error: aborting due to previous error diff --git a/tests/ui/generic-associated-types/issue-74684-1.stderr b/tests/ui/generic-associated-types/issue-74684-1.stderr index cacc97307..b93ee3798 100644 --- a/tests/ui/generic-associated-types/issue-74684-1.stderr +++ b/tests/ui/generic-associated-types/issue-74684-1.stderr @@ -4,6 +4,7 @@ error[E0597]: `a` does not live long enough LL | fn bug<'a, T: ?Sized + Fun<F<'a> = [u8]>>(_ : Box<T>) -> &'static T::F<'a> { | -- lifetime `'a` defined here LL | let a = [0; 1]; + | - binding `a` declared here LL | let _x = T::identity(&a); | ------------^^- | | | diff --git a/tests/ui/generic-associated-types/issue-79422.extended.stderr b/tests/ui/generic-associated-types/issue-79422.extended.stderr index d79de0ca6..04184fce9 100644 --- a/tests/ui/generic-associated-types/issue-79422.extended.stderr +++ b/tests/ui/generic-associated-types/issue-79422.extended.stderr @@ -14,11 +14,11 @@ help: add missing lifetime argument LL | as Box<dyn MapLike<u8, u8, VRefCont<'a> = dyn RefCont<'_, u8>>>; | ++++ -error[E0271]: type mismatch resolving `<BTreeMap<u8, u8> as MapLike<u8, u8>>::VRefCont<'_> == (dyn RefCont<'_, u8> + 'static)` +error[E0271]: type mismatch resolving `<BTreeMap<u8, u8> as MapLike<u8, u8>>::VRefCont<'_> == dyn RefCont<'_, u8>` --> $DIR/issue-79422.rs:44:13 | LL | let m = Box::new(std::collections::BTreeMap::<u8, u8>::new()) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch resolving `<BTreeMap<u8, u8> as MapLike<u8, u8>>::VRefCont<'_> == (dyn RefCont<'_, u8> + 'static)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch resolving `<BTreeMap<u8, u8> as MapLike<u8, u8>>::VRefCont<'_> == dyn RefCont<'_, u8>` | note: expected this to be `(dyn RefCont<'_, u8> + 'static)` --> $DIR/issue-79422.rs:28:25 diff --git a/tests/ui/generic-associated-types/issue-88360.fixed b/tests/ui/generic-associated-types/issue-88360.fixed new file mode 100644 index 000000000..3dea8bf7a --- /dev/null +++ b/tests/ui/generic-associated-types/issue-88360.fixed @@ -0,0 +1,20 @@ +// run-rustfix + +trait GatTrait { + type Gat<'a> where Self: 'a; + + fn test(&self) -> Self::Gat<'_>; +} + +trait SuperTrait<T> +where + Self: 'static, + for<'a> Self: GatTrait<Gat<'a> = &'a T>, +{ + fn copy(&self) -> Self::Gat<'_> where T: Copy { + self.test() + //~^ mismatched types + } +} + +fn main() {} diff --git a/tests/ui/generic-associated-types/issue-88360.rs b/tests/ui/generic-associated-types/issue-88360.rs index c02690618..4d4c7ea31 100644 --- a/tests/ui/generic-associated-types/issue-88360.rs +++ b/tests/ui/generic-associated-types/issue-88360.rs @@ -1,3 +1,5 @@ +// run-rustfix + trait GatTrait { type Gat<'a> where Self: 'a; diff --git a/tests/ui/generic-associated-types/issue-88360.stderr b/tests/ui/generic-associated-types/issue-88360.stderr index cd3750344..520aeff18 100644 --- a/tests/ui/generic-associated-types/issue-88360.stderr +++ b/tests/ui/generic-associated-types/issue-88360.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-88360.rs:13:9 + --> $DIR/issue-88360.rs:15:9 | LL | trait SuperTrait<T> | - this type parameter @@ -7,13 +7,15 @@ LL | trait SuperTrait<T> LL | fn copy(&self) -> Self::Gat<'_> where T: Copy { | ------------- expected `&T` because of return type LL | *self.test() - | ^^^^^^^^^^^^ - | | - | expected `&T`, found type parameter `T` - | help: consider borrowing here: `&*self.test()` + | ^^^^^^^^^^^^ expected `&T`, found type parameter `T` | = note: expected reference `&T` found type parameter `T` +help: consider removing deref here + | +LL - *self.test() +LL + self.test() + | error: aborting due to previous error diff --git a/tests/ui/generic-associated-types/method-unsatified-assoc-type-predicate.rs b/tests/ui/generic-associated-types/method-unsatisfied-assoc-type-predicate.rs index 83655341d..83655341d 100644 --- a/tests/ui/generic-associated-types/method-unsatified-assoc-type-predicate.rs +++ b/tests/ui/generic-associated-types/method-unsatisfied-assoc-type-predicate.rs diff --git a/tests/ui/generic-associated-types/method-unsatified-assoc-type-predicate.stderr b/tests/ui/generic-associated-types/method-unsatisfied-assoc-type-predicate.stderr index baef38f6b..4246f8c06 100644 --- a/tests/ui/generic-associated-types/method-unsatified-assoc-type-predicate.stderr +++ b/tests/ui/generic-associated-types/method-unsatisfied-assoc-type-predicate.stderr @@ -1,5 +1,5 @@ error[E0599]: the method `f` exists for struct `S`, but its trait bounds were not satisfied - --> $DIR/method-unsatified-assoc-type-predicate.rs:28:7 + --> $DIR/method-unsatisfied-assoc-type-predicate.rs:28:7 | LL | struct S; | -------- @@ -12,7 +12,7 @@ LL | a.f(); | ^ method cannot be called on `S` due to unsatisfied trait bounds | note: trait bound `<S as X>::Y<i32> = i32` was not satisfied - --> $DIR/method-unsatified-assoc-type-predicate.rs:12:11 + --> $DIR/method-unsatisfied-assoc-type-predicate.rs:12:11 | LL | impl<T: X<Y<i32> = i32>> M for T {} | ^^^^^^^^^^^^ - - diff --git a/tests/ui/generic-associated-types/missing-bounds.fixed b/tests/ui/generic-associated-types/missing-bounds.fixed index ee758f19e..054adbffb 100644 --- a/tests/ui/generic-associated-types/missing-bounds.fixed +++ b/tests/ui/generic-associated-types/missing-bounds.fixed @@ -4,7 +4,7 @@ use std::ops::Add; struct A<B>(B); -impl<B> Add for A<B> where B: Add + Add<Output = B> { +impl<B> Add for A<B> where B: Add<Output = B> { type Output = Self; fn add(self, rhs: Self) -> Self { @@ -14,7 +14,7 @@ impl<B> Add for A<B> where B: Add + Add<Output = B> { struct C<B>(B); -impl<B: Add + Add<Output = B>> Add for C<B> { +impl<B: Add<Output = B>> Add for C<B> { type Output = Self; fn add(self, rhs: Self) -> Self { @@ -34,7 +34,7 @@ impl<B: std::ops::Add<Output = B>> Add for D<B> { struct E<B>(B); -impl<B: Add + Add<Output = B>> Add for E<B> where B: Add<Output = B> { +impl<B: Add<Output = B>> Add for E<B> where B: Add<Output = B> { //~^ ERROR equality constraints are not yet supported in `where` clauses type Output = Self; diff --git a/tests/ui/generic-associated-types/missing-bounds.stderr b/tests/ui/generic-associated-types/missing-bounds.stderr index 9f669b9a5..535edec57 100644 --- a/tests/ui/generic-associated-types/missing-bounds.stderr +++ b/tests/ui/generic-associated-types/missing-bounds.stderr @@ -37,8 +37,8 @@ LL | struct A<B>(B); | ^ help: consider further restricting this bound | -LL | impl<B> Add for A<B> where B: Add + Add<Output = B> { - | +++++++++++++++++ +LL | impl<B> Add for A<B> where B: Add<Output = B> { + | ++++++++++++ error[E0308]: mismatched types --> $DIR/missing-bounds.rs:21:14 @@ -60,8 +60,8 @@ LL | struct C<B>(B); | ^ help: consider further restricting this bound | -LL | impl<B: Add + Add<Output = B>> Add for C<B> { - | +++++++++++++++++ +LL | impl<B: Add<Output = B>> Add for C<B> { + | ++++++++++++ error[E0369]: cannot add `B` to `B` --> $DIR/missing-bounds.rs:31:21 @@ -96,8 +96,8 @@ LL | struct E<B>(B); | ^ help: consider further restricting this bound | -LL | impl<B: Add + Add<Output = B>> Add for E<B> where <B as Add>::Output = B { - | +++++++++++++++++ +LL | impl<B: Add<Output = B>> Add for E<B> where <B as Add>::Output = B { + | ++++++++++++ error: aborting due to 5 previous errors diff --git a/tests/ui/generic-associated-types/missing_lifetime_args.rs b/tests/ui/generic-associated-types/missing_lifetime_args.rs index 78def8092..331511ba6 100644 --- a/tests/ui/generic-associated-types/missing_lifetime_args.rs +++ b/tests/ui/generic-associated-types/missing_lifetime_args.rs @@ -12,9 +12,9 @@ fn foo<'c, 'd>(_arg: Box<dyn X<Y = (&'c u32, &'d u32)>>) {} //~^ ERROR missing generics for associated type fn bar<'a, 'b, 'c>(_arg: Foo<'a, 'b>) {} -//~^ ERROR this struct takes 3 lifetime arguments but 2 lifetime +//~^ ERROR struct takes 3 lifetime arguments but 2 lifetime fn f<'a>(_arg: Foo<'a>) {} -//~^ ERROR this struct takes 3 lifetime arguments but 1 lifetime +//~^ ERROR struct takes 3 lifetime arguments but 1 lifetime fn main() {} diff --git a/tests/ui/generic-associated-types/missing_lifetime_args.stderr b/tests/ui/generic-associated-types/missing_lifetime_args.stderr index 8f74b12c0..1a7a2e787 100644 --- a/tests/ui/generic-associated-types/missing_lifetime_args.stderr +++ b/tests/ui/generic-associated-types/missing_lifetime_args.stderr @@ -14,7 +14,7 @@ help: add missing lifetime arguments LL | fn foo<'c, 'd>(_arg: Box<dyn X<Y<'_, '_> = (&'c u32, &'d u32)>>) {} | ++++++++ -error[E0107]: this struct takes 3 lifetime arguments but 2 lifetime arguments were supplied +error[E0107]: struct takes 3 lifetime arguments but 2 lifetime arguments were supplied --> $DIR/missing_lifetime_args.rs:14:26 | LL | fn bar<'a, 'b, 'c>(_arg: Foo<'a, 'b>) {} @@ -32,7 +32,7 @@ help: add missing lifetime argument LL | fn bar<'a, 'b, 'c>(_arg: Foo<'a, 'b, 'a>) {} | ++++ -error[E0107]: this struct takes 3 lifetime arguments but 1 lifetime argument was supplied +error[E0107]: struct takes 3 lifetime arguments but 1 lifetime argument was supplied --> $DIR/missing_lifetime_args.rs:17:16 | LL | fn f<'a>(_arg: Foo<'a>) {} diff --git a/tests/ui/generic-associated-types/missing_lifetime_const.rs b/tests/ui/generic-associated-types/missing_lifetime_const.rs index 8b174b9e9..6e395dfde 100644 --- a/tests/ui/generic-associated-types/missing_lifetime_const.rs +++ b/tests/ui/generic-associated-types/missing_lifetime_const.rs @@ -4,7 +4,7 @@ trait Foo { fn foo<T: Foo>() { let _: <T as Foo>::Assoc<3>; - //~^ ERROR this associated type + //~^ ERROR associated type } fn main() {} diff --git a/tests/ui/generic-associated-types/missing_lifetime_const.stderr b/tests/ui/generic-associated-types/missing_lifetime_const.stderr index 62d2e9f49..41945aabf 100644 --- a/tests/ui/generic-associated-types/missing_lifetime_const.stderr +++ b/tests/ui/generic-associated-types/missing_lifetime_const.stderr @@ -1,4 +1,4 @@ -error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied +error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/missing_lifetime_const.rs:6:24 | LL | let _: <T as Foo>::Assoc<3>; diff --git a/tests/ui/generic-associated-types/parameter_number_and_kind.rs b/tests/ui/generic-associated-types/parameter_number_and_kind.rs index 8428e7763..ae2f7c00e 100644 --- a/tests/ui/generic-associated-types/parameter_number_and_kind.rs +++ b/tests/ui/generic-associated-types/parameter_number_and_kind.rs @@ -9,10 +9,10 @@ trait Foo { // Test parameters in default values type FOk<T> = Self::E<'static, T>; type FErr1 = Self::E<'static, 'static>; - //~^ ERROR this associated type takes 1 lifetime argument but 2 lifetime arguments were supplied - //~| ERROR this associated type takes 1 + //~^ ERROR associated type takes 1 lifetime argument but 2 lifetime arguments were supplied + //~| ERROR associated type takes 1 type FErr2<T> = Self::E<'static, T, u32>; - //~^ ERROR this associated type takes 1 + //~^ ERROR associated type takes 1 } fn main() {} diff --git a/tests/ui/generic-associated-types/parameter_number_and_kind.stderr b/tests/ui/generic-associated-types/parameter_number_and_kind.stderr index c20b9669e..4523044b5 100644 --- a/tests/ui/generic-associated-types/parameter_number_and_kind.stderr +++ b/tests/ui/generic-associated-types/parameter_number_and_kind.stderr @@ -1,4 +1,4 @@ -error[E0107]: this associated type takes 1 lifetime argument but 2 lifetime arguments were supplied +error[E0107]: associated type takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/parameter_number_and_kind.rs:11:24 | LL | type FErr1 = Self::E<'static, 'static>; @@ -12,7 +12,7 @@ note: associated type defined here, with 1 lifetime parameter: `'a` LL | type E<'a, T>; | ^ -- -error[E0107]: this associated type takes 1 generic argument but 0 generic arguments were supplied +error[E0107]: associated type takes 1 generic argument but 0 generic arguments were supplied --> $DIR/parameter_number_and_kind.rs:11:24 | LL | type FErr1 = Self::E<'static, 'static>; @@ -28,7 +28,7 @@ help: add missing generic argument LL | type FErr1 = Self::E<'static, 'static, T>; | +++ -error[E0107]: this associated type takes 1 generic argument but 2 generic arguments were supplied +error[E0107]: associated type takes 1 generic argument but 2 generic arguments were supplied --> $DIR/parameter_number_and_kind.rs:14:27 | LL | type FErr2<T> = Self::E<'static, T, u32>; diff --git a/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.rs b/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.rs index 1622b92aa..c58f9cf1d 100644 --- a/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.rs +++ b/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.rs @@ -4,8 +4,8 @@ trait X { const _: () = { fn f2<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {} - //~^ ERROR this associated type takes 1 lifetime argument but 0 lifetime arguments - //~| ERROR this associated type takes 0 generic arguments but 1 generic argument + //~^ ERROR associated type takes 1 lifetime argument but 0 lifetime arguments + //~| ERROR associated type takes 0 generic arguments but 1 generic argument }; fn main() {} diff --git a/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr b/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr index 0a09ec5dc..fab5b474d 100644 --- a/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr +++ b/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr @@ -1,4 +1,4 @@ -error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied +error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/trait-path-type-error-once-implemented.rs:6:29 | LL | fn f2<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {} @@ -14,7 +14,7 @@ help: add missing lifetime argument LL | fn f2<'a>(arg : Box<dyn X<Y<'_, 1> = &'a ()>>) {} | +++ -error[E0107]: this associated type takes 0 generic arguments but 1 generic argument was supplied +error[E0107]: associated type takes 0 generic arguments but 1 generic argument was supplied --> $DIR/trait-path-type-error-once-implemented.rs:6:29 | LL | fn f2<'a>(arg : Box<dyn X<Y<1> = &'a ()>>) {} diff --git a/tests/ui/generic-associated-types/unsatified-item-lifetime-bound.rs b/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.rs index 1cc09aa6d..060ee8821 100644 --- a/tests/ui/generic-associated-types/unsatified-item-lifetime-bound.rs +++ b/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.rs @@ -1,3 +1,5 @@ +#![warn(unused_lifetimes)] + pub trait X { type Y<'a: 'static>; //~^ WARNING unnecessary lifetime parameter diff --git a/tests/ui/generic-associated-types/unsatified-item-lifetime-bound.stderr b/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.stderr index fbd79879d..a69cd0028 100644 --- a/tests/ui/generic-associated-types/unsatified-item-lifetime-bound.stderr +++ b/tests/ui/generic-associated-types/unsatisfied-item-lifetime-bound.stderr @@ -1,45 +1,50 @@ warning: unnecessary lifetime parameter `'a` - --> $DIR/unsatified-item-lifetime-bound.rs:2:12 + --> $DIR/unsatisfied-item-lifetime-bound.rs:4:12 | LL | type Y<'a: 'static>; | ^^ | = help: you can use the `'static` lifetime directly, in place of `'a` +note: the lint level is defined here + --> $DIR/unsatisfied-item-lifetime-bound.rs:1:9 + | +LL | #![warn(unused_lifetimes)] + | ^^^^^^^^^^^^^^^^ error[E0478]: lifetime bound not satisfied - --> $DIR/unsatified-item-lifetime-bound.rs:11:8 + --> $DIR/unsatisfied-item-lifetime-bound.rs:13:8 | LL | f: <T as X>::Y<'a>, | ^^^^^^^^^^^^^^^ | note: lifetime parameter instantiated with the lifetime `'a` as defined here - --> $DIR/unsatified-item-lifetime-bound.rs:10:10 + --> $DIR/unsatisfied-item-lifetime-bound.rs:12:10 | LL | struct B<'a, T: for<'r> X<Y<'r> = &'r ()>> { | ^^ = note: but lifetime parameter must outlive the static lifetime error[E0478]: lifetime bound not satisfied - --> $DIR/unsatified-item-lifetime-bound.rs:16:8 + --> $DIR/unsatisfied-item-lifetime-bound.rs:18:8 | LL | f: <T as X>::Y<'a>, | ^^^^^^^^^^^^^^^ | note: lifetime parameter instantiated with the lifetime `'a` as defined here - --> $DIR/unsatified-item-lifetime-bound.rs:15:10 + --> $DIR/unsatisfied-item-lifetime-bound.rs:17:10 | LL | struct C<'a, T: X> { | ^^ = note: but lifetime parameter must outlive the static lifetime error[E0478]: lifetime bound not satisfied - --> $DIR/unsatified-item-lifetime-bound.rs:21:8 + --> $DIR/unsatisfied-item-lifetime-bound.rs:23:8 | LL | f: <() as X>::Y<'a>, | ^^^^^^^^^^^^^^^^ | note: lifetime parameter instantiated with the lifetime `'a` as defined here - --> $DIR/unsatified-item-lifetime-bound.rs:20:10 + --> $DIR/unsatisfied-item-lifetime-bound.rs:22:10 | LL | struct D<'a> { | ^^ |