about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_hir_analysis/src/check/wfcheck.rs30
-rw-r--r--tests/ui/associated-inherent-types/issue-111879-0.stderr4
-rw-r--r--tests/ui/associated-inherent-types/normalization-overflow.stderr4
-rw-r--r--tests/ui/associated-inherent-types/regionck-1.stderr13
-rw-r--r--tests/ui/const-generics/issues/issue-71202.stderr2
-rw-r--r--tests/ui/generic-associated-types/bugs/issue-87735.stderr9
-rw-r--r--tests/ui/generic-associated-types/bugs/issue-88526.stderr9
-rw-r--r--tests/ui/generic-associated-types/issue-84931.stderr9
-rw-r--r--tests/ui/generic-const-items/evaluatable-bounds.stderr2
-rw-r--r--tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-89118.stderr4
-rw-r--r--tests/ui/implied-bounds/impl-header-unnormalized-types.stderr4
-rw-r--r--tests/ui/regions/lifetime-not-long-enough-suggestion-regression-test-124563.stderr4
-rw-r--r--tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.stderr4
-rw-r--r--tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.stderr4
-rw-r--r--tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-type-rev.stderr4
-rw-r--r--tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.stderr4
-rw-r--r--tests/ui/rfcs/rfc-2093-infer-outlives/regions-struct-not-wf.stderr12
-rw-r--r--tests/ui/specialization/issue-51892.stderr4
-rw-r--r--tests/ui/wf/hir-wf-check-erase-regions.stderr4
-rw-r--r--tests/ui/wf/wf-impl-associated-type-region.stderr4
-rw-r--r--tests/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr8
-rw-r--r--tests/ui/wf/wf-trait-associated-type-region.stderr4
22 files changed, 67 insertions, 79 deletions
diff --git a/compiler/rustc_hir_analysis/src/check/wfcheck.rs b/compiler/rustc_hir_analysis/src/check/wfcheck.rs
index 846e1315e9a..3404070a82d 100644
--- a/compiler/rustc_hir_analysis/src/check/wfcheck.rs
+++ b/compiler/rustc_hir_analysis/src/check/wfcheck.rs
@@ -328,23 +328,14 @@ fn check_trait_item<'tcx>(
 ) -> Result<(), ErrorGuaranteed> {
     let def_id = trait_item.owner_id.def_id;
 
-    let span = match trait_item.kind {
-        hir::TraitItemKind::Type(_bounds, Some(ty)) => ty.span,
-        _ => trait_item.span,
-    };
-
     // Check that an item definition in a subtrait is shadowing a supertrait item.
     lint_item_shadowing_supertrait_item(tcx, def_id);
 
-    let mut res = check_associated_item(tcx, def_id, span);
+    let mut res = check_associated_item(tcx, def_id);
 
     if matches!(trait_item.kind, hir::TraitItemKind::Fn(..)) {
         for &assoc_ty_def_id in tcx.associated_types_for_impl_traits_in_associated_fn(def_id) {
-            res = res.and(check_associated_item(
-                tcx,
-                assoc_ty_def_id.expect_local(),
-                tcx.def_span(assoc_ty_def_id),
-            ));
+            res = res.and(check_associated_item(tcx, assoc_ty_def_id.expect_local()));
         }
     }
     res
@@ -827,12 +818,7 @@ fn check_impl_item<'tcx>(
     tcx: TyCtxt<'tcx>,
     impl_item: &'tcx hir::ImplItem<'tcx>,
 ) -> Result<(), ErrorGuaranteed> {
-    let span = match impl_item.kind {
-        // Constrain binding and overflow error spans to `<Ty>` in `type foo = <Ty>`.
-        hir::ImplItemKind::Type(ty) if ty.span != DUMMY_SP => ty.span,
-        _ => impl_item.span,
-    };
-    check_associated_item(tcx, impl_item.owner_id.def_id, span)
+    check_associated_item(tcx, impl_item.owner_id.def_id)
 }
 
 fn check_param_wf(tcx: TyCtxt<'_>, param: &ty::GenericParamDef) -> Result<(), ErrorGuaranteed> {
@@ -960,12 +946,8 @@ fn check_param_wf(tcx: TyCtxt<'_>, param: &ty::GenericParamDef) -> Result<(), Er
     }
 }
 
-#[instrument(level = "debug", skip(tcx, span))]
-fn check_associated_item(
-    tcx: TyCtxt<'_>,
-    item_id: LocalDefId,
-    span: Span,
-) -> Result<(), ErrorGuaranteed> {
+#[instrument(level = "debug", skip(tcx))]
+fn check_associated_item(tcx: TyCtxt<'_>, item_id: LocalDefId) -> Result<(), ErrorGuaranteed> {
     let loc = Some(WellFormedLoc::Ty(item_id));
     enter_wf_checking_ctxt(tcx, item_id, |wfcx| {
         let item = tcx.associated_item(item_id);
@@ -982,6 +964,8 @@ fn check_associated_item(
             }
         };
 
+        let span = tcx.def_span(item_id);
+
         match item.kind {
             ty::AssocKind::Const { .. } => {
                 let ty = tcx.type_of(item.def_id).instantiate_identity();
diff --git a/tests/ui/associated-inherent-types/issue-111879-0.stderr b/tests/ui/associated-inherent-types/issue-111879-0.stderr
index f60fd58c23b..144f6486b3b 100644
--- a/tests/ui/associated-inherent-types/issue-111879-0.stderr
+++ b/tests/ui/associated-inherent-types/issue-111879-0.stderr
@@ -1,8 +1,8 @@
 error: overflow evaluating associated type `Carrier<'b>::Focus<i32>`
-  --> $DIR/issue-111879-0.rs:9:25
+  --> $DIR/issue-111879-0.rs:9:5
    |
 LL |     pub type Focus<T> = &'a mut for<'b> fn(Carrier<'b>::Focus<i32>);
-   |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^^^^^^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/associated-inherent-types/normalization-overflow.stderr b/tests/ui/associated-inherent-types/normalization-overflow.stderr
index 7f991a53c9b..05aad31c5f4 100644
--- a/tests/ui/associated-inherent-types/normalization-overflow.stderr
+++ b/tests/ui/associated-inherent-types/normalization-overflow.stderr
@@ -1,8 +1,8 @@
 error: overflow evaluating associated type `T::This`
-  --> $DIR/normalization-overflow.rs:9:17
+  --> $DIR/normalization-overflow.rs:9:5
    |
 LL |     type This = Self::This;
-   |                 ^^^^^^^^^^
+   |     ^^^^^^^^^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/associated-inherent-types/regionck-1.stderr b/tests/ui/associated-inherent-types/regionck-1.stderr
index 62a00868248..4e0ecc3c80e 100644
--- a/tests/ui/associated-inherent-types/regionck-1.stderr
+++ b/tests/ui/associated-inherent-types/regionck-1.stderr
@@ -1,10 +1,11 @@
 error[E0309]: the parameter type `T` may not live long enough
-  --> $DIR/regionck-1.rs:9:30
+  --> $DIR/regionck-1.rs:9:5
    |
 LL |     type NoTyOutliv<'a, T> = &'a T;
-   |                     --       ^^^^^ ...so that the reference type `&'a T` does not outlive the data it points at
-   |                     |
-   |                     the parameter type `T` must be valid for the lifetime `'a` as defined here...
+   |     ^^^^^^^^^^^^^^^^--^^^^
+   |     |               |
+   |     |               the parameter type `T` must be valid for the lifetime `'a` as defined here...
+   |     ...so that the reference type `&'a T` does not outlive the data it points at
    |
 help: consider adding an explicit lifetime bound
    |
@@ -12,10 +13,10 @@ LL |     type NoTyOutliv<'a, T: 'a> = &'a T;
    |                          ++++
 
 error[E0491]: in type `&'a &'b ()`, reference has a longer lifetime than the data it references
-  --> $DIR/regionck-1.rs:10:31
+  --> $DIR/regionck-1.rs:10:5
    |
 LL |     type NoReOutliv<'a, 'b> = &'a &'b ();
-   |                               ^^^^^^^^^^
+   |     ^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: the pointer is valid for the lifetime `'a` as defined here
   --> $DIR/regionck-1.rs:10:21
diff --git a/tests/ui/const-generics/issues/issue-71202.stderr b/tests/ui/const-generics/issues/issue-71202.stderr
index b7c3db494a5..dd0611a7223 100644
--- a/tests/ui/const-generics/issues/issue-71202.stderr
+++ b/tests/ui/const-generics/issues/issue-71202.stderr
@@ -7,7 +7,7 @@ LL | |             const VALUE: bool = false;
 ...  |
 LL | |         <IsCopy<T>>::VALUE
 LL | |     } as usize] = [];
-   | |_____________________^
+   | |_______________^
    |
 help: try adding a `where` bound
    |
diff --git a/tests/ui/generic-associated-types/bugs/issue-87735.stderr b/tests/ui/generic-associated-types/bugs/issue-87735.stderr
index 1b955431363..c3f4f7a73f3 100644
--- a/tests/ui/generic-associated-types/bugs/issue-87735.stderr
+++ b/tests/ui/generic-associated-types/bugs/issue-87735.stderr
@@ -5,12 +5,13 @@ LL | impl<'b, T, U> AsRef2 for Foo<T>
    |             ^ unconstrained type parameter
 
 error[E0309]: the parameter type `U` may not live long enough
-  --> $DIR/issue-87735.rs:34:21
+  --> $DIR/issue-87735.rs:34:3
    |
 LL |   type Output<'a> = FooRef<'a, U> where Self: 'a;
-   |               --    ^^^^^^^^^^^^^ ...so that the type `U` will meet its required lifetime bounds...
-   |               |
-   |               the parameter type `U` must be valid for the lifetime `'a` as defined here...
+   |   ^^^^^^^^^^^^--^
+   |   |           |
+   |   |           the parameter type `U` must be valid for the lifetime `'a` as defined here...
+   |   ...so that the type `U` will meet its required lifetime bounds...
    |
 note: ...that is required by this bound
   --> $DIR/issue-87735.rs:23:22
diff --git a/tests/ui/generic-associated-types/bugs/issue-88526.stderr b/tests/ui/generic-associated-types/bugs/issue-88526.stderr
index 5da3e3ff64a..5e39eb7a6b9 100644
--- a/tests/ui/generic-associated-types/bugs/issue-88526.stderr
+++ b/tests/ui/generic-associated-types/bugs/issue-88526.stderr
@@ -5,12 +5,13 @@ LL | impl<'q, Q, I, F> A for TestB<Q, F>
    |             ^ unconstrained type parameter
 
 error[E0309]: the parameter type `F` may not live long enough
-  --> $DIR/issue-88526.rs:16:18
+  --> $DIR/issue-88526.rs:16:5
    |
 LL |     type I<'a> = &'a F;
-   |            --    ^^^^^ ...so that the reference type `&'a F` does not outlive the data it points at
-   |            |
-   |            the parameter type `F` must be valid for the lifetime `'a` as defined here...
+   |     ^^^^^^^--^
+   |     |      |
+   |     |      the parameter type `F` must be valid for the lifetime `'a` as defined here...
+   |     ...so that the reference type `&'a F` does not outlive the data it points at
    |
 help: consider adding an explicit lifetime bound
    |
diff --git a/tests/ui/generic-associated-types/issue-84931.stderr b/tests/ui/generic-associated-types/issue-84931.stderr
index 71d112277a3..01819481108 100644
--- a/tests/ui/generic-associated-types/issue-84931.stderr
+++ b/tests/ui/generic-associated-types/issue-84931.stderr
@@ -18,12 +18,13 @@ LL |     type Item<'a> = &'a mut T where Self: 'a;
    |                               ++++++++++++++
 
 error[E0309]: the parameter type `T` may not live long enough
-  --> $DIR/issue-84931.rs:14:21
+  --> $DIR/issue-84931.rs:14:5
    |
 LL |     type Item<'a> = &'a mut T;
-   |               --    ^^^^^^^^^ ...so that the reference type `&'a mut T` does not outlive the data it points at
-   |               |
-   |               the parameter type `T` must be valid for the lifetime `'a` as defined here...
+   |     ^^^^^^^^^^--^
+   |     |         |
+   |     |         the parameter type `T` must be valid for the lifetime `'a` as defined here...
+   |     ...so that the reference type `&'a mut T` does not outlive the data it points at
    |
 help: consider adding an explicit lifetime bound
    |
diff --git a/tests/ui/generic-const-items/evaluatable-bounds.stderr b/tests/ui/generic-const-items/evaluatable-bounds.stderr
index ca26d633658..8bc4a3d236f 100644
--- a/tests/ui/generic-const-items/evaluatable-bounds.stderr
+++ b/tests/ui/generic-const-items/evaluatable-bounds.stderr
@@ -2,7 +2,7 @@ error: unconstrained generic constant
   --> $DIR/evaluatable-bounds.rs:14:5
    |
 LL |     const ARRAY: [i32; Self::LEN];
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 help: try adding a `where` bound
    |
diff --git a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-89118.stderr b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-89118.stderr
index 7fe803550bd..5ded3a5e76c 100644
--- a/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-89118.stderr
+++ b/tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-89118.stderr
@@ -53,10 +53,10 @@ LL |     Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>;
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `EthernetWorker`
 
 error[E0277]: the trait bound `for<'a> &'a (): BufferMut` is not satisfied
-  --> $DIR/issue-89118.rs:22:20
+  --> $DIR/issue-89118.rs:22:5
    |
 LL |     type Handler = Ctx<C::Dispatcher>;
-   |                    ^^^^^^^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()`
+   |     ^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()`
    |
 help: this trait has no implementations, consider adding one
   --> $DIR/issue-89118.rs:1:1
diff --git a/tests/ui/implied-bounds/impl-header-unnormalized-types.stderr b/tests/ui/implied-bounds/impl-header-unnormalized-types.stderr
index 07cb0aecda8..dcb68fbf2cd 100644
--- a/tests/ui/implied-bounds/impl-header-unnormalized-types.stderr
+++ b/tests/ui/implied-bounds/impl-header-unnormalized-types.stderr
@@ -1,8 +1,8 @@
 error[E0491]: in type `&'a &'b ()`, reference has a longer lifetime than the data it references
-  --> $DIR/impl-header-unnormalized-types.rs:15:18
+  --> $DIR/impl-header-unnormalized-types.rs:15:5
    |
 LL |     type Assoc = &'a &'b ();
-   |                  ^^^^^^^^^^
+   |     ^^^^^^^^^^
    |
 note: the pointer is valid for the lifetime `'a` as defined here
   --> $DIR/impl-header-unnormalized-types.rs:14:6
diff --git a/tests/ui/regions/lifetime-not-long-enough-suggestion-regression-test-124563.stderr b/tests/ui/regions/lifetime-not-long-enough-suggestion-regression-test-124563.stderr
index 9f1315070eb..e94074548e9 100644
--- a/tests/ui/regions/lifetime-not-long-enough-suggestion-regression-test-124563.stderr
+++ b/tests/ui/regions/lifetime-not-long-enough-suggestion-regression-test-124563.stderr
@@ -1,8 +1,8 @@
 error[E0478]: lifetime bound not satisfied
-  --> $DIR/lifetime-not-long-enough-suggestion-regression-test-124563.rs:19:16
+  --> $DIR/lifetime-not-long-enough-suggestion-regression-test-124563.rs:19:5
    |
 LL |     type Bar = BarImpl<'a, 'b, T>;
-   |                ^^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^
    |
 note: lifetime parameter instantiated with the lifetime `'a` as defined here
   --> $DIR/lifetime-not-long-enough-suggestion-regression-test-124563.rs:14:6
diff --git a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.stderr b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.stderr
index 591585c88f5..01a3f528359 100644
--- a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.stderr
+++ b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.stderr
@@ -1,8 +1,8 @@
 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:20
+  --> $DIR/regions-outlives-nominal-type-region-rev.rs:17:9
    |
 LL |         type Out = &'a Foo<'b>;
-   |                    ^^^^^^^^^^^
+   |         ^^^^^^^^
    |
 note: the pointer is valid for the lifetime `'a` as defined here
   --> $DIR/regions-outlives-nominal-type-region-rev.rs:16:10
diff --git a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.stderr b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.stderr
index 0404b52d9ef..ff4c5f07284 100644
--- a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.stderr
+++ b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.stderr
@@ -1,8 +1,8 @@
 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:20
+  --> $DIR/regions-outlives-nominal-type-region.rs:17:9
    |
 LL |         type Out = &'a Foo<'b>;
-   |                    ^^^^^^^^^^^
+   |         ^^^^^^^^
    |
 note: the pointer is valid for the lifetime `'a` as defined here
   --> $DIR/regions-outlives-nominal-type-region.rs:16:10
diff --git a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-type-rev.stderr b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-type-rev.stderr
index 62415e250ec..a0ede2aeada 100644
--- a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-type-rev.stderr
+++ b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-type-rev.stderr
@@ -1,8 +1,8 @@
 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:20
+  --> $DIR/regions-outlives-nominal-type-type-rev.rs:17:9
    |
 LL |         type Out = &'a Foo<&'b i32>;
-   |                    ^^^^^^^^^^^^^^^^
+   |         ^^^^^^^^
    |
 note: the pointer is valid for the lifetime `'a` as defined here
   --> $DIR/regions-outlives-nominal-type-type-rev.rs:16:10
diff --git a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.stderr b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.stderr
index 464d7968b74..23d3f4ac606 100644
--- a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.stderr
+++ b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.stderr
@@ -1,8 +1,8 @@
 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:20
+  --> $DIR/regions-outlives-nominal-type-type.rs:17:9
    |
 LL |         type Out = &'a Foo<&'b i32>;
-   |                    ^^^^^^^^^^^^^^^^
+   |         ^^^^^^^^
    |
 note: the pointer is valid for the lifetime `'a` as defined here
   --> $DIR/regions-outlives-nominal-type-type.rs:16:10
diff --git a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-struct-not-wf.stderr b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-struct-not-wf.stderr
index eb17ce736f7..73c0bbc44fb 100644
--- a/tests/ui/rfcs/rfc-2093-infer-outlives/regions-struct-not-wf.stderr
+++ b/tests/ui/rfcs/rfc-2093-infer-outlives/regions-struct-not-wf.stderr
@@ -1,10 +1,10 @@
 error[E0309]: the parameter type `T` may not live long enough
-  --> $DIR/regions-struct-not-wf.rs:13:16
+  --> $DIR/regions-struct-not-wf.rs:13:5
    |
 LL | impl<'a, T> Trait<'a, T> for usize {
    |      -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
 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
    |
 help: consider adding an explicit lifetime bound
    |
@@ -12,12 +12,12 @@ LL | impl<'a, T: 'a> Trait<'a, T> for usize {
    |           ++++
 
 error[E0309]: the parameter type `T` may not live long enough
-  --> $DIR/regions-struct-not-wf.rs:21:16
+  --> $DIR/regions-struct-not-wf.rs:21:5
    |
 LL | impl<'a, T> Trait<'a, T> for u32 {
    |      -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
 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
   --> $DIR/regions-struct-not-wf.rs:16:20
@@ -30,10 +30,10 @@ LL | impl<'a, T: 'a> Trait<'a, T> for u32 {
    |           ++++
 
 error[E0491]: in type `&'a &'b T`, reference has a longer lifetime than the data it references
-  --> $DIR/regions-struct-not-wf.rs:25:16
+  --> $DIR/regions-struct-not-wf.rs:25:5
    |
 LL |     type Out = &'a &'b T;
-   |                ^^^^^^^^^
+   |     ^^^^^^^^
    |
 note: the pointer is valid for the lifetime `'a` as defined here
   --> $DIR/regions-struct-not-wf.rs:24:6
diff --git a/tests/ui/specialization/issue-51892.stderr b/tests/ui/specialization/issue-51892.stderr
index b1cabc0ac0e..f327f10438d 100644
--- a/tests/ui/specialization/issue-51892.stderr
+++ b/tests/ui/specialization/issue-51892.stderr
@@ -1,8 +1,8 @@
 error: unconstrained generic constant
-  --> $DIR/issue-51892.rs:14:17
+  --> $DIR/issue-51892.rs:14:5
    |
 LL |     type Type = [u8; std::mem::size_of::<<T as Trait>::Type>()];
-   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^
    |
 help: try adding a `where` bound
    |
diff --git a/tests/ui/wf/hir-wf-check-erase-regions.stderr b/tests/ui/wf/hir-wf-check-erase-regions.stderr
index e4d48bf82c0..07304cd448e 100644
--- a/tests/ui/wf/hir-wf-check-erase-regions.stderr
+++ b/tests/ui/wf/hir-wf-check-erase-regions.stderr
@@ -11,10 +11,10 @@ note: required by a bound in `std::iter::IntoIterator::IntoIter`
   --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
 
 error[E0277]: `&'a T` is not an iterator
-  --> $DIR/hir-wf-check-erase-regions.rs:7:21
+  --> $DIR/hir-wf-check-erase-regions.rs:7:5
    |
 LL |     type IntoIter = std::iter::Flatten<std::slice::Iter<'a, T>>;
-   |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&'a T` is not an iterator
+   |     ^^^^^^^^^^^^^ `&'a T` is not an iterator
    |
    = help: the trait `Iterator` is not implemented for `&'a T`
    = help: the trait `Iterator` is implemented for `&mut I`
diff --git a/tests/ui/wf/wf-impl-associated-type-region.stderr b/tests/ui/wf/wf-impl-associated-type-region.stderr
index f17d33474f4..86e35b86fb1 100644
--- a/tests/ui/wf/wf-impl-associated-type-region.stderr
+++ b/tests/ui/wf/wf-impl-associated-type-region.stderr
@@ -1,10 +1,10 @@
 error[E0309]: the parameter type `T` may not live long enough
-  --> $DIR/wf-impl-associated-type-region.rs:10:16
+  --> $DIR/wf-impl-associated-type-region.rs:10:5
    |
 LL | impl<'a, T> Foo<'a> for T {
    |      -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
 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
    |
 help: consider adding an explicit lifetime bound
    |
diff --git a/tests/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr b/tests/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr
index e0cf42fd10c..f2989ae97b5 100644
--- a/tests/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr
+++ b/tests/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr
@@ -1,10 +1,10 @@
 error[E0309]: the parameter type `T` may not live long enough
-  --> $DIR/wf-outlives-ty-in-fn-or-trait.rs:9:16
+  --> $DIR/wf-outlives-ty-in-fn-or-trait.rs:9:5
    |
 LL | impl<'a, T> Trait<'a, T> for usize {
    |      -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
 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
    |
 help: consider adding an explicit lifetime bound
    |
@@ -12,12 +12,12 @@ LL | impl<'a, T: 'a> Trait<'a, T> for usize {
    |           ++++
 
 error[E0309]: the parameter type `T` may not live long enough
-  --> $DIR/wf-outlives-ty-in-fn-or-trait.rs:19:16
+  --> $DIR/wf-outlives-ty-in-fn-or-trait.rs:19:5
    |
 LL | impl<'a, T> Trait<'a, T> for u32 {
    |      -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
 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
    |
 help: consider adding an explicit lifetime bound
    |
diff --git a/tests/ui/wf/wf-trait-associated-type-region.stderr b/tests/ui/wf/wf-trait-associated-type-region.stderr
index d6647b2cb96..9589e1d7853 100644
--- a/tests/ui/wf/wf-trait-associated-type-region.stderr
+++ b/tests/ui/wf/wf-trait-associated-type-region.stderr
@@ -1,11 +1,11 @@
 error[E0309]: the associated type `<Self as SomeTrait<'a>>::Type1` may not live long enough
-  --> $DIR/wf-trait-associated-type-region.rs:9:18
+  --> $DIR/wf-trait-associated-type-region.rs:9:5
    |
 LL | trait SomeTrait<'a> {
    |                 -- the associated type `<Self as SomeTrait<'a>>::Type1` must be valid for the lifetime `'a` as defined here...
 LL |     type Type1;
 LL |     type Type2 = &'a Self::Type1;
-   |                  ^^^^^^^^^^^^^^^ ...so that the reference type `&'a <Self as SomeTrait<'a>>::Type1` does not outlive the data it points at
+   |     ^^^^^^^^^^ ...so that the reference type `&'a <Self as SomeTrait<'a>>::Type1` does not outlive the data it points at
    |
 help: consider adding an explicit lifetime bound
    |