Use a more accurate span on assoc types WF checks

This commit is contained in:
Esteban Kuber 2021-08-06 15:46:20 +00:00
parent eb2226b1f1
commit 3a515aec67
18 changed files with 54 additions and 52 deletions

View File

@ -194,12 +194,13 @@ pub fn check_trait_item(tcx: TyCtxt<'_>, def_id: LocalDefId) {
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id); let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
let trait_item = tcx.hir().expect_trait_item(hir_id); let trait_item = tcx.hir().expect_trait_item(hir_id);
let method_sig = match trait_item.kind { let (method_sig, span) = match trait_item.kind {
hir::TraitItemKind::Fn(ref sig, _) => Some(sig), hir::TraitItemKind::Fn(ref sig, _) => (Some(sig), trait_item.span),
_ => None, hir::TraitItemKind::Type(_bounds, Some(ty)) => (None, ty.span),
_ => (None, trait_item.span),
}; };
check_object_unsafe_self_trait_by_name(tcx, &trait_item); check_object_unsafe_self_trait_by_name(tcx, &trait_item);
check_associated_item(tcx, trait_item.hir_id(), trait_item.span, method_sig); check_associated_item(tcx, trait_item.hir_id(), span, method_sig);
} }
fn could_be_self(trait_def_id: LocalDefId, ty: &hir::Ty<'_>) -> bool { fn could_be_self(trait_def_id: LocalDefId, ty: &hir::Ty<'_>) -> bool {
@ -268,12 +269,13 @@ pub fn check_impl_item(tcx: TyCtxt<'_>, def_id: LocalDefId) {
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id); let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
let impl_item = tcx.hir().expect_impl_item(hir_id); let impl_item = tcx.hir().expect_impl_item(hir_id);
let method_sig = match impl_item.kind { let (method_sig, span) = match impl_item.kind {
hir::ImplItemKind::Fn(ref sig, _) => Some(sig), hir::ImplItemKind::Fn(ref sig, _) => (Some(sig), impl_item.span),
_ => None, hir::ImplItemKind::TyAlias(ty) => (None, ty.span),
_ => (None, impl_item.span),
}; };
check_associated_item(tcx, impl_item.hir_id(), impl_item.span, method_sig); check_associated_item(tcx, impl_item.hir_id(), span, method_sig);
} }
fn check_param_wf(tcx: TyCtxt<'_>, param: &hir::GenericParam<'_>) { fn check_param_wf(tcx: TyCtxt<'_>, param: &hir::GenericParam<'_>) {

View File

@ -1,14 +1,14 @@
error[E0275]: overflow evaluating the requirement `<bool as Tr>::B == _` error[E0275]: overflow evaluating the requirement `<bool as Tr>::B == _`
--> $DIR/defaults-cyclic-fail-1.rs:26:5 --> $DIR/defaults-cyclic-fail-1.rs:26:14
| |
LL | type A = Box<Self::B>; LL | type A = Box<Self::B>;
| ^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^
error[E0275]: overflow evaluating the requirement `<usize as Tr>::A == _` error[E0275]: overflow evaluating the requirement `<usize as Tr>::A == _`
--> $DIR/defaults-cyclic-fail-1.rs:32:5 --> $DIR/defaults-cyclic-fail-1.rs:32:14
| |
LL | type B = &'static Self::A; LL | type B = &'static Self::A;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -1,14 +1,14 @@
error[E0275]: overflow evaluating the requirement `<bool as Tr>::B == _` error[E0275]: overflow evaluating the requirement `<bool as Tr>::B == _`
--> $DIR/defaults-cyclic-fail-2.rs:27:5 --> $DIR/defaults-cyclic-fail-2.rs:27:14
| |
LL | type A = Box<Self::B>; LL | type A = Box<Self::B>;
| ^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^
error[E0275]: overflow evaluating the requirement `<usize as Tr>::A == _` error[E0275]: overflow evaluating the requirement `<usize as Tr>::A == _`
--> $DIR/defaults-cyclic-fail-2.rs:33:5 --> $DIR/defaults-cyclic-fail-2.rs:33:14
| |
LL | type B = &'static Self::A; LL | type B = &'static Self::A;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -1,11 +1,11 @@
error[E0275]: overflow evaluating the requirement `<T as Foo>::Item: Sized` error[E0275]: overflow evaluating the requirement `<T as Foo>::Item: Sized`
--> $DIR/projection-bound-cycle-generic.rs:44:5 --> $DIR/projection-bound-cycle-generic.rs:44:18
| |
LL | struct OnlySized<T> where T: Sized { f: T } LL | struct OnlySized<T> where T: Sized { f: T }
| - required by this bound in `OnlySized` | - required by this bound in `OnlySized`
... ...
LL | type Assoc = OnlySized<<T as Foo>::Item>; LL | type Assoc = OnlySized<<T as Foo>::Item>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error error: aborting due to previous error

View File

@ -1,11 +1,11 @@
error[E0275]: overflow evaluating the requirement `<T as Foo>::Item: Sized` error[E0275]: overflow evaluating the requirement `<T as Foo>::Item: Sized`
--> $DIR/projection-bound-cycle.rs:46:5 --> $DIR/projection-bound-cycle.rs:46:18
| |
LL | struct OnlySized<T> where T: Sized { f: T } LL | struct OnlySized<T> where T: Sized { f: T }
| - required by this bound in `OnlySized` | - required by this bound in `OnlySized`
... ...
LL | type Assoc = OnlySized<<T as Foo>::Item>; LL | type Assoc = OnlySized<<T as Foo>::Item>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error error: aborting due to previous error

View File

@ -1,8 +1,8 @@
error[E0275]: overflow evaluating the requirement `<FooStruct as Foo>::A == _` error[E0275]: overflow evaluating the requirement `<FooStruct as Foo>::A == _`
--> $DIR/issue-21946.rs:8:5 --> $DIR/issue-21946.rs:8:14
| |
LL | type A = <FooStruct as Foo>::A; LL | type A = <FooStruct as Foo>::A;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error error: aborting due to previous error

View File

@ -1,8 +1,8 @@
error[E0275]: overflow evaluating the requirement `<GetNext<T> as Next>::Next == _` error[E0275]: overflow evaluating the requirement `<GetNext<T> as Next>::Next == _`
--> $DIR/issue-23122-1.rs:10:5 --> $DIR/issue-23122-1.rs:10:17
| |
LL | type Next = <GetNext<T> as Next>::Next; LL | type Next = <GetNext<T> as Next>::Next;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error error: aborting due to previous error

View File

@ -1,8 +1,8 @@
error[E0275]: overflow evaluating the requirement `<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<T as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next: Sized` error[E0275]: overflow evaluating the requirement `<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<T as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next: Sized`
--> $DIR/issue-23122-2.rs:9:5 --> $DIR/issue-23122-2.rs:9:17
| |
LL | type Next = <GetNext<T::Next> as Next>::Next; LL | type Next = <GetNext<T::Next> as Next>::Next;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= help: consider adding a `#![recursion_limit="256"]` attribute to your crate (`issue_23122_2`) = help: consider adding a `#![recursion_limit="256"]` attribute to your crate (`issue_23122_2`)
note: required because of the requirements on the impl of `Next` for `GetNext<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<T as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next>` note: required because of the requirements on the impl of `Next` for `GetNext<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<T as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next>`

View File

@ -1,8 +1,8 @@
error[E0491]: in type `&'a Foo<'b>`, reference has a longer lifetime than the data it references error[E0491]: in type `&'a Foo<'b>`, reference has a longer lifetime than the data it references
--> $DIR/regions-outlives-nominal-type-region-rev.rs:17:9 --> $DIR/regions-outlives-nominal-type-region-rev.rs:17:20
| |
LL | type Out = &'a Foo<'b>; LL | type Out = &'a Foo<'b>;
| ^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^
| |
note: the pointer is valid for the lifetime `'a` as defined on the impl at 16:10 note: the pointer is valid for the lifetime `'a` as defined on the impl at 16:10
--> $DIR/regions-outlives-nominal-type-region-rev.rs:16:10 --> $DIR/regions-outlives-nominal-type-region-rev.rs:16:10

View File

@ -1,8 +1,8 @@
error[E0491]: in type `&'a Foo<'b>`, reference has a longer lifetime than the data it references error[E0491]: in type `&'a Foo<'b>`, reference has a longer lifetime than the data it references
--> $DIR/regions-outlives-nominal-type-region.rs:17:9 --> $DIR/regions-outlives-nominal-type-region.rs:17:20
| |
LL | type Out = &'a Foo<'b>; LL | type Out = &'a Foo<'b>;
| ^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^
| |
note: the pointer is valid for the lifetime `'a` as defined on the impl at 16:10 note: the pointer is valid for the lifetime `'a` as defined on the impl at 16:10
--> $DIR/regions-outlives-nominal-type-region.rs:16:10 --> $DIR/regions-outlives-nominal-type-region.rs:16:10

View File

@ -1,8 +1,8 @@
error[E0491]: in type `&'a Foo<&'b i32>`, reference has a longer lifetime than the data it references error[E0491]: in type `&'a Foo<&'b i32>`, reference has a longer lifetime than the data it references
--> $DIR/regions-outlives-nominal-type-type-rev.rs:17:9 --> $DIR/regions-outlives-nominal-type-type-rev.rs:17:20
| |
LL | type Out = &'a Foo<&'b i32>; LL | type Out = &'a Foo<&'b i32>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
| |
note: the pointer is valid for the lifetime `'a` as defined on the impl at 16:10 note: the pointer is valid for the lifetime `'a` as defined on the impl at 16:10
--> $DIR/regions-outlives-nominal-type-type-rev.rs:16:10 --> $DIR/regions-outlives-nominal-type-type-rev.rs:16:10

View File

@ -1,8 +1,8 @@
error[E0491]: in type `&'a Foo<&'b i32>`, reference has a longer lifetime than the data it references error[E0491]: in type `&'a Foo<&'b i32>`, reference has a longer lifetime than the data it references
--> $DIR/regions-outlives-nominal-type-type.rs:17:9 --> $DIR/regions-outlives-nominal-type-type.rs:17:20
| |
LL | type Out = &'a Foo<&'b i32>; LL | type Out = &'a Foo<&'b i32>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
| |
note: the pointer is valid for the lifetime `'a` as defined on the impl at 16:10 note: the pointer is valid for the lifetime `'a` as defined on the impl at 16:10
--> $DIR/regions-outlives-nominal-type-type.rs:16:10 --> $DIR/regions-outlives-nominal-type-type.rs:16:10

View File

@ -1,18 +1,18 @@
error[E0309]: the parameter type `T` may not live long enough error[E0309]: the parameter type `T` may not live long enough
--> $DIR/regions-struct-not-wf.rs:13:5 --> $DIR/regions-struct-not-wf.rs:13:16
| |
LL | impl<'a, T> Trait<'a, T> for usize { LL | impl<'a, T> Trait<'a, T> for usize {
| - help: consider adding an explicit lifetime bound...: `T: 'a` | - help: consider adding an explicit lifetime bound...: `T: 'a`
LL | type Out = &'a T; LL | type Out = &'a T;
| ^^^^^^^^^^^^^^^^^ ...so that the reference type `&'a T` does not outlive the data it points at | ^^^^^ ...so that the reference type `&'a T` does not outlive the data it points at
error[E0309]: the parameter type `T` may not live long enough error[E0309]: the parameter type `T` may not live long enough
--> $DIR/regions-struct-not-wf.rs:21:5 --> $DIR/regions-struct-not-wf.rs:21:16
| |
LL | impl<'a, T> Trait<'a, T> for u32 { LL | impl<'a, T> Trait<'a, T> for u32 {
| - help: consider adding an explicit lifetime bound...: `T: 'a` | - help: consider adding an explicit lifetime bound...: `T: 'a`
LL | type Out = RefOk<'a, T>; LL | type Out = RefOk<'a, T>;
| ^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds... | ^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds...
| |
note: ...that is required by this bound note: ...that is required by this bound
--> $DIR/regions-struct-not-wf.rs:16:20 --> $DIR/regions-struct-not-wf.rs:16:20
@ -21,10 +21,10 @@ LL | struct RefOk<'a, T:'a> {
| ^^ | ^^
error[E0491]: in type `&'a &'b T`, reference has a longer lifetime than the data it references error[E0491]: in type `&'a &'b T`, reference has a longer lifetime than the data it references
--> $DIR/regions-struct-not-wf.rs:25:5 --> $DIR/regions-struct-not-wf.rs:25:16
| |
LL | type Out = &'a &'b T; LL | type Out = &'a &'b T;
| ^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^
| |
note: the pointer is valid for the lifetime `'a` as defined on the impl at 24:6 note: the pointer is valid for the lifetime `'a` as defined on the impl at 24:6
--> $DIR/regions-struct-not-wf.rs:24:6 --> $DIR/regions-struct-not-wf.rs:24:6

View File

@ -1,8 +1,8 @@
error: unconstrained generic constant error: unconstrained generic constant
--> $DIR/issue-51892.rs:15:5 --> $DIR/issue-51892.rs:15:17
| |
LL | type Type = [u8; std::mem::size_of::<<T as Trait>::Type>()]; LL | type Type = [u8; std::mem::size_of::<<T as Trait>::Type>()];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
= help: try adding a `where` bound using this expression: `where [(); std::mem::size_of::<<T as Trait>::Type>()]:` = help: try adding a `where` bound using this expression: `where [(); std::mem::size_of::<<T as Trait>::Type>()]:`

View File

@ -1,8 +1,8 @@
error[E0277]: `&T` is not an iterator error[E0277]: `&T` is not an iterator
--> $DIR/hir-wf-check-erase-regions.rs:7:5 --> $DIR/hir-wf-check-erase-regions.rs:7:21
| |
LL | type IntoIter = std::iter::Flatten<std::slice::Iter<'a, T>>; LL | type IntoIter = std::iter::Flatten<std::slice::Iter<'a, T>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&T` is not an iterator | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&T` is not an iterator
| |
::: $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL ::: $SRC_DIR/core/src/iter/adapters/flatten.rs:LL:COL
| |

View File

@ -1,10 +1,10 @@
error[E0309]: the parameter type `T` may not live long enough error[E0309]: the parameter type `T` may not live long enough
--> $DIR/wf-impl-associated-type-region.rs:10:5 --> $DIR/wf-impl-associated-type-region.rs:10:16
| |
LL | impl<'a, T> Foo<'a> for T { LL | impl<'a, T> Foo<'a> for T {
| - help: consider adding an explicit lifetime bound...: `T: 'a` | - help: consider adding an explicit lifetime bound...: `T: 'a`
LL | type Bar = &'a T; LL | type Bar = &'a T;
| ^^^^^^^^^^^^^^^^^ ...so that the reference type `&'a T` does not outlive the data it points at | ^^^^^ ...so that the reference type `&'a T` does not outlive the data it points at
error: aborting due to previous error error: aborting due to previous error

View File

@ -1,18 +1,18 @@
error[E0309]: the parameter type `T` may not live long enough error[E0309]: the parameter type `T` may not live long enough
--> $DIR/wf-outlives-ty-in-fn-or-trait.rs:9:5 --> $DIR/wf-outlives-ty-in-fn-or-trait.rs:9:16
| |
LL | impl<'a, T> Trait<'a, T> for usize { LL | impl<'a, T> Trait<'a, T> for usize {
| - help: consider adding an explicit lifetime bound...: `T: 'a` | - help: consider adding an explicit lifetime bound...: `T: 'a`
LL | type Out = &'a fn(T); LL | type Out = &'a fn(T);
| ^^^^^^^^^^^^^^^^^^^^^ ...so that the reference type `&'a fn(T)` does not outlive the data it points at | ^^^^^^^^^ ...so that the reference type `&'a fn(T)` does not outlive the data it points at
error[E0309]: the parameter type `T` may not live long enough error[E0309]: the parameter type `T` may not live long enough
--> $DIR/wf-outlives-ty-in-fn-or-trait.rs:19:5 --> $DIR/wf-outlives-ty-in-fn-or-trait.rs:19:16
| |
LL | impl<'a, T> Trait<'a, T> for u32 { LL | impl<'a, T> Trait<'a, T> for u32 {
| - help: consider adding an explicit lifetime bound...: `T: 'a` | - help: consider adding an explicit lifetime bound...: `T: 'a`
LL | type Out = &'a dyn Baz<T>; LL | type Out = &'a dyn Baz<T>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the reference type `&'a (dyn Baz<T> + 'a)` does not outlive the data it points at | ^^^^^^^^^^^^^^ ...so that the reference type `&'a (dyn Baz<T> + 'a)` does not outlive the data it points at
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -1,8 +1,8 @@
error[E0309]: the associated type `<Self as SomeTrait<'a>>::Type1` may not live long enough error[E0309]: the associated type `<Self as SomeTrait<'a>>::Type1` may not live long enough
--> $DIR/wf-trait-associated-type-region.rs:9:5 --> $DIR/wf-trait-associated-type-region.rs:9:18
| |
LL | type Type2 = &'a Self::Type1; LL | type Type2 = &'a Self::Type1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^
| |
= help: consider adding an explicit lifetime bound `<Self as SomeTrait<'a>>::Type1: 'a`... = help: consider adding an explicit lifetime bound `<Self as SomeTrait<'a>>::Type1: 'a`...
= note: ...so that the reference type `&'a <Self as SomeTrait<'a>>::Type1` does not outlive the data it points at = note: ...so that the reference type `&'a <Self as SomeTrait<'a>>::Type1` does not outlive the data it points at