about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc/traits/coherence.rs107
-rw-r--r--src/librustc_typeck/coherence/orphan.rs90
-rw-r--r--src/test/ui/coherence/coherence-all-remote.old.stderr4
-rw-r--r--src/test/ui/coherence/coherence-all-remote.re.stderr4
-rw-r--r--src/test/ui/coherence/coherence-bigint-param.old.stderr4
-rw-r--r--src/test/ui/coherence/coherence-bigint-param.re.stderr4
-rw-r--r--src/test/ui/coherence/coherence-cow.a.stderr4
-rw-r--r--src/test/ui/coherence/coherence-cow.b.stderr4
-rw-r--r--src/test/ui/coherence/coherence-cow.c.stderr4
-rw-r--r--src/test/ui/coherence/coherence-cow.re_a.stderr6
-rw-r--r--src/test/ui/coherence/coherence-cow.re_b.stderr6
-rw-r--r--src/test/ui/coherence/coherence-cow.re_c.stderr6
-rw-r--r--src/test/ui/coherence/coherence-cross-crate-conflict.old.stderr4
-rw-r--r--src/test/ui/coherence/coherence-cross-crate-conflict.re.stderr4
-rw-r--r--src/test/ui/coherence/coherence-fundamental-trait-objects.old.stderr6
-rw-r--r--src/test/ui/coherence/coherence-fundamental-trait-objects.re.stderr6
-rw-r--r--src/test/ui/coherence/coherence-impl-trait-for-marker-trait-negative.stderr6
-rw-r--r--src/test/ui/coherence/coherence-impl-trait-for-marker-trait-positive.stderr6
-rw-r--r--src/test/ui/coherence/coherence-impls-copy.old.stderr24
-rw-r--r--src/test/ui/coherence/coherence-impls-copy.re.stderr24
-rw-r--r--src/test/ui/coherence/coherence-impls-send.old.stderr18
-rw-r--r--src/test/ui/coherence/coherence-impls-send.re.stderr18
-rw-r--r--src/test/ui/coherence/coherence-impls-sized.old.stderr18
-rw-r--r--src/test/ui/coherence/coherence-impls-sized.re.stderr18
-rw-r--r--src/test/ui/coherence/coherence-lone-type-parameter.old.stderr4
-rw-r--r--src/test/ui/coherence/coherence-lone-type-parameter.re.stderr4
-rw-r--r--src/test/ui/coherence/coherence-orphan.old.stderr13
-rw-r--r--src/test/ui/coherence/coherence-orphan.re.stderr13
-rw-r--r--src/test/ui/coherence/coherence-overlapping-pairs.old.stderr4
-rw-r--r--src/test/ui/coherence/coherence-overlapping-pairs.re.stderr6
-rw-r--r--src/test/ui/coherence/coherence-pair-covered-uncovered-1.old.stderr4
-rw-r--r--src/test/ui/coherence/coherence-pair-covered-uncovered-1.re.stderr7
-rw-r--r--src/test/ui/coherence/coherence-pair-covered-uncovered.old.stderr4
-rw-r--r--src/test/ui/coherence/coherence-pair-covered-uncovered.re.stderr6
-rw-r--r--src/test/ui/coherence/coherence-vec-local-2.old.stderr4
-rw-r--r--src/test/ui/coherence/coherence-vec-local-2.re.stderr6
-rw-r--r--src/test/ui/coherence/coherence-vec-local.old.stderr6
-rw-r--r--src/test/ui/coherence/coherence-vec-local.re.stderr6
-rw-r--r--src/test/ui/coherence/coherence_local_err_struct.old.stderr6
-rw-r--r--src/test/ui/coherence/coherence_local_err_struct.re.stderr6
-rw-r--r--src/test/ui/coherence/coherence_local_err_tuple.old.stderr6
-rw-r--r--src/test/ui/coherence/coherence_local_err_tuple.re.stderr6
-rw-r--r--src/test/ui/coherence/impl-foreign-for-foreign.stderr6
-rw-r--r--src/test/ui/coherence/impl-foreign-for-foreign[foreign].stderr21
-rw-r--r--src/test/ui/coherence/impl-foreign-for-fundamental[foreign].stderr12
-rw-r--r--src/test/ui/coherence/impl-foreign[foreign]-for-foreign.stderr7
-rw-r--r--src/test/ui/coherence/impl-foreign[fundemental[foreign]]-for-foreign.stderr21
-rw-r--r--src/test/ui/coherence/impl[t]-foreign-for-foreign[t].stderr12
-rw-r--r--src/test/ui/coherence/impl[t]-foreign-for-fundamental[t].stderr4
-rw-r--r--src/test/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].stderr8
-rw-r--r--src/test/ui/coherence/impl[t]-foreign[foreign]-for-t.stderr4
-rw-r--r--src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-foreign.stderr8
-rw-r--r--src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].stderr8
-rw-r--r--src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-t.stderr8
-rw-r--r--src/test/ui/coherence/impl[t]-foreign[fundamental[t]_local]-for-foreign.stderr8
-rw-r--r--src/test/ui/coherence/impl[t]-foreign[local]-for-fundamental[t].stderr8
-rw-r--r--src/test/ui/coherence/impl[t]-foreign[local]-for-t.stderr4
-rw-r--r--src/test/ui/coherence/impl[t]-foreign[t]-for-foreign.stderr4
-rw-r--r--src/test/ui/coherence/impl[t]-foreign[t]-for-fundamental.stderr8
-rw-r--r--src/test/ui/coherence/impl[t]-foreign[t]-for-t.stderr4
-rw-r--r--src/test/ui/dropck/drop-on-non-struct.stderr6
-rw-r--r--src/test/ui/error-codes/E0117.stderr6
-rw-r--r--src/test/ui/error-codes/E0206.stderr6
-rw-r--r--src/test/ui/error-codes/e0119/complex-impl.stderr4
-rw-r--r--src/test/ui/error-codes/e0119/issue-28981.stderr4
-rw-r--r--src/test/ui/feature-gates/feature-gate-re-rebalance-coherence.stderr4
-rw-r--r--src/test/ui/issues/issue-41974.stderr4
-rw-r--r--src/test/ui/orphan-check-diagnostics.stderr4
-rw-r--r--src/test/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr18
69 files changed, 467 insertions, 250 deletions
diff --git a/src/librustc/traits/coherence.rs b/src/librustc/traits/coherence.rs
index 2734fce4ea5..49a4d17d88d 100644
--- a/src/librustc/traits/coherence.rs
+++ b/src/librustc/traits/coherence.rs
@@ -237,7 +237,7 @@ pub fn trait_ref_is_local_or_fundamental<'tcx>(
 }
 
 pub enum OrphanCheckErr<'tcx> {
-    NoLocalInputType,
+    NonLocalInputType(Vec<(Ty<'tcx>, bool /* Is this the first input type? */)>),
     UncoveredTy(Ty<'tcx>),
 }
 
@@ -355,7 +355,7 @@ pub fn orphan_check(
 /// Note that this function is never called for types that have both type
 /// parameters and inference variables.
 fn orphan_check_trait_ref<'tcx>(
-    tcx: TyCtxt<'_>,
+    tcx: TyCtxt<'tcx>,
     trait_ref: ty::TraitRef<'tcx>,
     in_crate: InCrate,
 ) -> Result<(), OrphanCheckErr<'tcx>> {
@@ -378,40 +378,51 @@ fn orphan_check_trait_ref<'tcx>(
         //      Let Ti be the first such type.
         //     - No uncovered type parameters P1..=Pn may appear in T0..Ti (excluding Ti)
         //
-        fn uncover_fundamental_ty<'a>(
-            tcx: TyCtxt<'_>,
-            ty: Ty<'a>,
+        fn uncover_fundamental_ty<'tcx>(
+            tcx: TyCtxt<'tcx>,
+            ty: Ty<'tcx>,
             in_crate: InCrate,
-        ) -> Vec<Ty<'a>> {
-            if fundamental_ty(ty) && !ty_is_local(tcx, ty, in_crate) {
+        ) -> Vec<Ty<'tcx>> {
+            if fundamental_ty(ty) && ty_is_non_local(tcx, ty, in_crate).is_some() {
                 ty.walk_shallow().flat_map(|ty| uncover_fundamental_ty(tcx, ty, in_crate)).collect()
             } else {
                 vec![ty]
             }
         }
 
-        for input_ty in
-            trait_ref.input_types().flat_map(|ty| uncover_fundamental_ty(tcx, ty, in_crate))
+        let mut non_local_spans = vec![];
+        for (i, input_ty) in trait_ref
+            .input_types()
+            .flat_map(|ty| uncover_fundamental_ty(tcx, ty, in_crate))
+            .enumerate()
         {
             debug!("orphan_check_trait_ref: check ty `{:?}`", input_ty);
-            if ty_is_local(tcx, input_ty, in_crate) {
+            let non_local_tys = ty_is_non_local(tcx, input_ty, in_crate);
+            if non_local_tys.is_none() {
                 debug!("orphan_check_trait_ref: ty_is_local `{:?}`", input_ty);
                 return Ok(());
             } else if let ty::Param(_) = input_ty.kind {
                 debug!("orphan_check_trait_ref: uncovered ty: `{:?}`", input_ty);
                 return Err(OrphanCheckErr::UncoveredTy(input_ty))
             }
+            if let Some(non_local_tys) = non_local_tys {
+                for input_ty in non_local_tys {
+                    non_local_spans.push((input_ty, i == 0));
+                }
+            }
         }
         // If we exit above loop, never found a local type.
         debug!("orphan_check_trait_ref: no local type");
-        Err(OrphanCheckErr::NoLocalInputType)
+        Err(OrphanCheckErr::NonLocalInputType(non_local_spans))
     } else {
+        let mut non_local_spans = vec![];
         // First, create an ordered iterator over all the type
         // parameters to the trait, with the self type appearing
         // first.  Find the first input type that either references a
         // type parameter OR some local type.
-        for input_ty in trait_ref.input_types() {
-            if ty_is_local(tcx, input_ty, in_crate) {
+        for (i, input_ty) in trait_ref.input_types().enumerate() {
+            let non_local_tys = ty_is_non_local(tcx, input_ty, in_crate);
+            if non_local_tys.is_none() {
                 debug!("orphan_check_trait_ref: ty_is_local `{:?}`", input_ty);
 
                 // First local input type. Check that there are no
@@ -438,15 +449,21 @@ fn orphan_check_trait_ref<'tcx>(
                 debug!("orphan_check_trait_ref: uncovered type `{:?}`", param);
                 return Err(OrphanCheckErr::UncoveredTy(param));
             }
+
+            if let Some(non_local_tys) = non_local_tys {
+                for input_ty in non_local_tys {
+                    non_local_spans.push((input_ty, i == 0));
+                }
+            }
         }
         // If we exit above loop, never found a local type.
         debug!("orphan_check_trait_ref: no local type");
-        Err(OrphanCheckErr::NoLocalInputType)
+        Err(OrphanCheckErr::NonLocalInputType(non_local_spans))
     }
 }
 
-fn uncovered_tys<'tcx>(tcx: TyCtxt<'_>, ty: Ty<'tcx>, in_crate: InCrate) -> Vec<Ty<'tcx>> {
-    if ty_is_local_constructor(tcx, ty, in_crate) {
+fn uncovered_tys<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, in_crate: InCrate) -> Vec<Ty<'tcx>> {
+    if ty_is_non_local_constructor(tcx, ty, in_crate).is_none() {
         vec![]
     } else if fundamental_ty(ty) {
         ty.walk_shallow()
@@ -464,9 +481,23 @@ fn is_possibly_remote_type(ty: Ty<'_>, _in_crate: InCrate) -> bool {
     }
 }
 
-fn ty_is_local(tcx: TyCtxt<'_>, ty: Ty<'_>, in_crate: InCrate) -> bool {
-    ty_is_local_constructor(tcx, ty, in_crate) ||
-        fundamental_ty(ty) && ty.walk_shallow().any(|t| ty_is_local(tcx, t, in_crate))
+fn ty_is_non_local<'t>(tcx: TyCtxt<'t>, ty: Ty<'t>, in_crate: InCrate) -> Option<Vec<Ty<'t>>> {
+    match ty_is_non_local_constructor(tcx, ty, in_crate) {
+        Some(ty) => if !fundamental_ty(ty) {
+            Some(vec![ty])
+        } else {
+            let tys: Vec<_> = ty.walk_shallow()
+                .filter_map(|t| ty_is_non_local(tcx, t, in_crate))
+                .flat_map(|i| i)
+                .collect();
+            if tys.is_empty() {
+                None
+            } else {
+                Some(tys)
+            }
+        },
+        None => None,
+    }
 }
 
 fn fundamental_ty(ty: Ty<'_>) -> bool {
@@ -486,8 +517,12 @@ fn def_id_is_local(def_id: DefId, in_crate: InCrate) -> bool {
     }
 }
 
-fn ty_is_local_constructor(tcx: TyCtxt<'_>, ty: Ty<'_>, in_crate: InCrate) -> bool {
-    debug!("ty_is_local_constructor({:?})", ty);
+fn ty_is_non_local_constructor<'tcx>(
+    tcx: TyCtxt<'tcx>,
+    ty: Ty<'tcx>,
+    in_crate: InCrate,
+) -> Option<Ty<'tcx>> {
+    debug!("ty_is_non_local_constructor({:?})", ty);
 
     match ty.kind {
         ty::Bool |
@@ -506,18 +541,26 @@ fn ty_is_local_constructor(tcx: TyCtxt<'_>, ty: Ty<'_>, in_crate: InCrate) -> bo
         ty::Tuple(..) |
         ty::Param(..) |
         ty::Projection(..) => {
-            false
+            Some(ty)
         }
 
         ty::Placeholder(..) | ty::Bound(..) | ty::Infer(..) => match in_crate {
-            InCrate::Local => false,
+            InCrate::Local => Some(ty),
             // The inference variable might be unified with a local
             // type in that remote crate.
-            InCrate::Remote => true,
+            InCrate::Remote => None,
         },
 
-        ty::Adt(def, _) => def_id_is_local(def.did, in_crate),
-        ty::Foreign(did) => def_id_is_local(did, in_crate),
+        ty::Adt(def, _) => if def_id_is_local(def.did, in_crate) {
+            None
+        } else {
+            Some(ty)
+        },
+        ty::Foreign(did) => if def_id_is_local(did, in_crate) {
+            None
+        } else {
+            Some(ty)
+        },
         ty::Opaque(did, _) => {
             // Check the underlying type that this opaque
             // type resolves to.
@@ -525,18 +568,22 @@ fn ty_is_local_constructor(tcx: TyCtxt<'_>, ty: Ty<'_>, in_crate: InCrate) -> bo
             // since we've already managed to successfully
             // resolve all opaque types by this point
             let real_ty = tcx.type_of(did);
-            ty_is_local_constructor(tcx, real_ty, in_crate)
+            ty_is_non_local_constructor(tcx, real_ty, in_crate)
         }
 
         ty::Dynamic(ref tt, ..) => {
             if let Some(principal) = tt.principal() {
-                def_id_is_local(principal.def_id(), in_crate)
+                if def_id_is_local(principal.def_id(), in_crate) {
+                    None
+                } else {
+                    Some(ty)
+                }
             } else {
-                false
+                Some(ty)
             }
         }
 
-        ty::Error => true,
+        ty::Error => None,
 
         ty::UnnormalizedProjection(..) |
         ty::Closure(..) |
diff --git a/src/librustc_typeck/coherence/orphan.rs b/src/librustc_typeck/coherence/orphan.rs
index 667fa50a7cf..f066ca762c0 100644
--- a/src/librustc_typeck/coherence/orphan.rs
+++ b/src/librustc_typeck/coherence/orphan.rs
@@ -24,7 +24,7 @@ impl ItemLikeVisitor<'v> for OrphanChecker<'tcx> {
     fn visit_item(&mut self, item: &hir::Item) {
         let def_id = self.tcx.hir().local_def_id(item.hir_id);
         // "Trait" impl
-        if let hir::ItemKind::Impl(.., Some(_), _, _) = item.kind {
+        if let hir::ItemKind::Impl(.., generics, Some(tr), impl_ty, _) = &item.kind {
             debug!("coherence2::orphan check: trait impl {}",
                    self.tcx.hir().node_to_string(item.hir_id));
             let trait_ref = self.tcx.impl_trait_ref(def_id).unwrap();
@@ -33,32 +33,74 @@ impl ItemLikeVisitor<'v> for OrphanChecker<'tcx> {
             let sp = cm.def_span(item.span);
             match traits::orphan_check(self.tcx, def_id) {
                 Ok(()) => {}
-                Err(traits::OrphanCheckErr::NoLocalInputType) => {
-                    struct_span_err!(self.tcx.sess,
-                                     sp,
-                                     E0117,
-                                     "only traits defined in the current crate can be \
-                                      implemented for arbitrary types")
-                        .span_label(sp, "impl doesn't use types inside crate")
-                        .note("the impl does not reference only types defined in this crate")
-                        .note("define and implement a trait or new type instead")
-                        .emit();
+                Err(traits::OrphanCheckErr::NonLocalInputType(tys)) => {
+                    let mut err = struct_span_err!(
+                        self.tcx.sess,
+                        sp,
+                        E0117,
+                        "only traits defined in the current crate can be implemented for \
+                         arbitrary types"
+                    );
+                    err.span_label(sp, "impl doesn't use only types from inside the current crate");
+                    for (ty, is_target_ty) in &tys {
+                        let mut ty = *ty;
+                        self.tcx.infer_ctxt().enter(|infcx| {
+                            // Remove the lifetimes unnecessary for this error.
+                            ty = infcx.freshen(ty);
+                        });
+                        ty = match ty.kind {
+                            // Remove the type arguments from the output, as they are not relevant.
+                            // You can think of this as the reverse of `resolve_vars_if_possible`.
+                            // That way if we had `Vec<MyType>`, we will properly attribute the
+                            // problem to `Vec<T>` and avoid confusing the user if they were to see
+                            // `MyType` in the error.
+                            ty::Adt(def, _) => self.tcx.mk_adt(def, ty::List::empty()),
+                            _ => ty,
+                        };
+                        let this = "this".to_string();
+                        let (ty, postfix) = match &ty.kind {
+                            ty::Slice(_) => (this, " because slices are always foreign"),
+                            ty::Array(..) => (this, " because arrays are always foreign"),
+                            ty::Tuple(..) => (this, " because tuples are always foreign"),
+                            _ => (format!("`{}`", ty), ""),
+                        };
+                        let msg = format!("{} is not defined in the current crate{}", ty, postfix);
+                        if *is_target_ty {
+                            // Point at `D<A>` in `impl<A, B> for C<B> in D<A>`
+                            err.span_label(impl_ty.span, &msg);
+                        } else {
+                            // Point at `C<B>` in `impl<A, B> for C<B> in D<A>`
+                            err.span_label(tr.path.span, &msg);
+                        }
+                    }
+                    err.note("define and implement a trait or new type instead");
+                    err.emit();
                     return;
                 }
                 Err(traits::OrphanCheckErr::UncoveredTy(param_ty)) => {
-                    struct_span_err!(self.tcx.sess,
-                                     sp,
-                                     E0210,
-                                     "type parameter `{}` must be used as the type parameter \
-                                      for some local type (e.g., `MyStruct<{}>`)",
-                                     param_ty,
-                                     param_ty)
-                        .span_label(sp,
-                                    format!("type parameter `{}` must be used as the type \
-                                             parameter for some local type", param_ty))
-                        .note("only traits defined in the current crate can be implemented \
-                               for a type parameter")
-                        .emit();
+                    let mut sp = sp;
+                    for param in &generics.params {
+                        if param.name.ident().to_string() == param_ty.to_string() {
+                            sp = param.span;
+                        }
+                    }
+                    let mut err = struct_span_err!(
+                        self.tcx.sess,
+                        sp,
+                        E0210,
+                        "type parameter `{}` must be used as the type parameter for some local \
+                         type (e.g., `MyStruct<{}>`)",
+                        param_ty,
+                        param_ty
+                    );
+                    err.span_label(sp, format!(
+                        "type parameter `{}` must be used as the type parameter for some local \
+                         type",
+                        param_ty,
+                    ));
+                    err.note("only traits defined in the current crate can be implemented for a \
+                              type parameter");
+                    err.emit();
                     return;
                 }
             }
diff --git a/src/test/ui/coherence/coherence-all-remote.old.stderr b/src/test/ui/coherence/coherence-all-remote.old.stderr
index 0389a6228ef..0541db2b850 100644
--- a/src/test/ui/coherence/coherence-all-remote.old.stderr
+++ b/src/test/ui/coherence/coherence-all-remote.old.stderr
@@ -1,8 +1,8 @@
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/coherence-all-remote.rs:9:1
+  --> $DIR/coherence-all-remote.rs:9:6
    |
 LL | impl<T> Remote1<T> for isize { }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |      ^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
diff --git a/src/test/ui/coherence/coherence-all-remote.re.stderr b/src/test/ui/coherence/coherence-all-remote.re.stderr
index 0389a6228ef..0541db2b850 100644
--- a/src/test/ui/coherence/coherence-all-remote.re.stderr
+++ b/src/test/ui/coherence/coherence-all-remote.re.stderr
@@ -1,8 +1,8 @@
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/coherence-all-remote.rs:9:1
+  --> $DIR/coherence-all-remote.rs:9:6
    |
 LL | impl<T> Remote1<T> for isize { }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |      ^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
diff --git a/src/test/ui/coherence/coherence-bigint-param.old.stderr b/src/test/ui/coherence/coherence-bigint-param.old.stderr
index 54fec07e65a..816ad949a2b 100644
--- a/src/test/ui/coherence/coherence-bigint-param.old.stderr
+++ b/src/test/ui/coherence/coherence-bigint-param.old.stderr
@@ -1,8 +1,8 @@
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/coherence-bigint-param.rs:11:1
+  --> $DIR/coherence-bigint-param.rs:11:6
    |
 LL | impl<T> Remote1<BigInt> for T { }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |      ^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
diff --git a/src/test/ui/coherence/coherence-bigint-param.re.stderr b/src/test/ui/coherence/coherence-bigint-param.re.stderr
index 54fec07e65a..816ad949a2b 100644
--- a/src/test/ui/coherence/coherence-bigint-param.re.stderr
+++ b/src/test/ui/coherence/coherence-bigint-param.re.stderr
@@ -1,8 +1,8 @@
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/coherence-bigint-param.rs:11:1
+  --> $DIR/coherence-bigint-param.rs:11:6
    |
 LL | impl<T> Remote1<BigInt> for T { }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |      ^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
diff --git a/src/test/ui/coherence/coherence-cow.a.stderr b/src/test/ui/coherence/coherence-cow.a.stderr
index dd9cfab503f..d3f8ba63f07 100644
--- a/src/test/ui/coherence/coherence-cow.a.stderr
+++ b/src/test/ui/coherence/coherence-cow.a.stderr
@@ -1,8 +1,8 @@
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/coherence-cow.rs:18:1
+  --> $DIR/coherence-cow.rs:18:6
    |
 LL | impl<T> Remote for Pair<T,Cover<T>> { }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |      ^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
diff --git a/src/test/ui/coherence/coherence-cow.b.stderr b/src/test/ui/coherence/coherence-cow.b.stderr
index fb3ca3fc6b7..d8db025cbcf 100644
--- a/src/test/ui/coherence/coherence-cow.b.stderr
+++ b/src/test/ui/coherence/coherence-cow.b.stderr
@@ -1,8 +1,8 @@
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/coherence-cow.rs:23:1
+  --> $DIR/coherence-cow.rs:23:6
    |
 LL | impl<T> Remote for Pair<Cover<T>,T> { }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |      ^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
diff --git a/src/test/ui/coherence/coherence-cow.c.stderr b/src/test/ui/coherence/coherence-cow.c.stderr
index f17823b7f89..ff46d7ea280 100644
--- a/src/test/ui/coherence/coherence-cow.c.stderr
+++ b/src/test/ui/coherence/coherence-cow.c.stderr
@@ -1,8 +1,8 @@
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/coherence-cow.rs:28:1
+  --> $DIR/coherence-cow.rs:28:6
    |
 LL | impl<T,U> Remote for Pair<Cover<T>,U> { }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |      ^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
diff --git a/src/test/ui/coherence/coherence-cow.re_a.stderr b/src/test/ui/coherence/coherence-cow.re_a.stderr
index b0ec55a9bc5..06e77b2797d 100644
--- a/src/test/ui/coherence/coherence-cow.re_a.stderr
+++ b/src/test/ui/coherence/coherence-cow.re_a.stderr
@@ -2,9 +2,11 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/coherence-cow.rs:18:1
    |
 LL | impl<T> Remote for Pair<T,Cover<T>> { }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^^^^^----------------
+   | |                  |
+   | |                  `lib::Pair` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error: aborting due to previous error
diff --git a/src/test/ui/coherence/coherence-cow.re_b.stderr b/src/test/ui/coherence/coherence-cow.re_b.stderr
index ce261127093..146232ac02b 100644
--- a/src/test/ui/coherence/coherence-cow.re_b.stderr
+++ b/src/test/ui/coherence/coherence-cow.re_b.stderr
@@ -2,9 +2,11 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/coherence-cow.rs:23:1
    |
 LL | impl<T> Remote for Pair<Cover<T>,T> { }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^^^^^----------------
+   | |                  |
+   | |                  `lib::Pair` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error: aborting due to previous error
diff --git a/src/test/ui/coherence/coherence-cow.re_c.stderr b/src/test/ui/coherence/coherence-cow.re_c.stderr
index 1c2030d8dfe..e0cf6aab7bb 100644
--- a/src/test/ui/coherence/coherence-cow.re_c.stderr
+++ b/src/test/ui/coherence/coherence-cow.re_c.stderr
@@ -2,9 +2,11 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/coherence-cow.rs:28:1
    |
 LL | impl<T,U> Remote for Pair<Cover<T>,U> { }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^^^^^^^----------------
+   | |                    |
+   | |                    `lib::Pair` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error: aborting due to previous error
diff --git a/src/test/ui/coherence/coherence-cross-crate-conflict.old.stderr b/src/test/ui/coherence/coherence-cross-crate-conflict.old.stderr
index 93be2570281..971abe29639 100644
--- a/src/test/ui/coherence/coherence-cross-crate-conflict.old.stderr
+++ b/src/test/ui/coherence/coherence-cross-crate-conflict.old.stderr
@@ -8,10 +8,10 @@ LL | impl<A> Foo for A {
            - impl trait_impl_conflict::Foo for isize;
 
 error[E0210]: type parameter `A` must be used as the type parameter for some local type (e.g., `MyStruct<A>`)
-  --> $DIR/coherence-cross-crate-conflict.rs:12:1
+  --> $DIR/coherence-cross-crate-conflict.rs:12:6
    |
 LL | impl<A> Foo for A {
-   | ^^^^^^^^^^^^^^^^^ type parameter `A` must be used as the type parameter for some local type
+   |      ^ type parameter `A` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
diff --git a/src/test/ui/coherence/coherence-cross-crate-conflict.re.stderr b/src/test/ui/coherence/coherence-cross-crate-conflict.re.stderr
index 93be2570281..971abe29639 100644
--- a/src/test/ui/coherence/coherence-cross-crate-conflict.re.stderr
+++ b/src/test/ui/coherence/coherence-cross-crate-conflict.re.stderr
@@ -8,10 +8,10 @@ LL | impl<A> Foo for A {
            - impl trait_impl_conflict::Foo for isize;
 
 error[E0210]: type parameter `A` must be used as the type parameter for some local type (e.g., `MyStruct<A>`)
-  --> $DIR/coherence-cross-crate-conflict.rs:12:1
+  --> $DIR/coherence-cross-crate-conflict.rs:12:6
    |
 LL | impl<A> Foo for A {
-   | ^^^^^^^^^^^^^^^^^ type parameter `A` must be used as the type parameter for some local type
+   |      ^ type parameter `A` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
diff --git a/src/test/ui/coherence/coherence-fundamental-trait-objects.old.stderr b/src/test/ui/coherence/coherence-fundamental-trait-objects.old.stderr
index 2d1247e831e..a3da52fe484 100644
--- a/src/test/ui/coherence/coherence-fundamental-trait-objects.old.stderr
+++ b/src/test/ui/coherence/coherence-fundamental-trait-objects.old.stderr
@@ -2,9 +2,11 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/coherence-fundamental-trait-objects.rs:15:1
    |
 LL | impl Misc for dyn Fundamental<Local> {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^----------------------
+   | |             |
+   | |             `dyn coherence_fundamental_trait_lib::Fundamental<Local>` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error: aborting due to previous error
diff --git a/src/test/ui/coherence/coherence-fundamental-trait-objects.re.stderr b/src/test/ui/coherence/coherence-fundamental-trait-objects.re.stderr
index 2d1247e831e..a3da52fe484 100644
--- a/src/test/ui/coherence/coherence-fundamental-trait-objects.re.stderr
+++ b/src/test/ui/coherence/coherence-fundamental-trait-objects.re.stderr
@@ -2,9 +2,11 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/coherence-fundamental-trait-objects.rs:15:1
    |
 LL | impl Misc for dyn Fundamental<Local> {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^----------------------
+   | |             |
+   | |             `dyn coherence_fundamental_trait_lib::Fundamental<Local>` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error: aborting due to previous error
diff --git a/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-negative.stderr b/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-negative.stderr
index edadb9b93d6..b8137b36948 100644
--- a/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-negative.stderr
+++ b/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-negative.stderr
@@ -14,9 +14,11 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:22:1
    |
 LL | impl !Send for dyn Marker2 {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^-----------
+   | |              |
+   | |              `dyn Marker2` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `(dyn Object + 'static)`
diff --git a/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-positive.stderr b/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-positive.stderr
index 322e7a5af29..d68337bed00 100644
--- a/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-positive.stderr
+++ b/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-positive.stderr
@@ -14,9 +14,11 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:22:1
    |
 LL | unsafe impl Send for dyn Marker2 {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^^^^^^^-----------
+   | |                    |
+   | |                    `dyn Marker2` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `(dyn Object + 'static)`
diff --git a/src/test/ui/coherence/coherence-impls-copy.old.stderr b/src/test/ui/coherence/coherence-impls-copy.old.stderr
index 5c95cc173f2..742845b1907 100644
--- a/src/test/ui/coherence/coherence-impls-copy.old.stderr
+++ b/src/test/ui/coherence/coherence-impls-copy.old.stderr
@@ -49,36 +49,44 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/coherence-impls-copy.rs:8:1
    |
 LL | impl Copy for i32 {}
-   | ^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^---
+   | |             |
+   | |             `i32` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
   --> $DIR/coherence-impls-copy.rs:32:1
    |
 LL | impl Copy for (MyType, MyType) {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^----------------
+   | |             |
+   | |             this is not defined in the current crate because tuples are always foreign
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
   --> $DIR/coherence-impls-copy.rs:40:1
    |
 LL | impl Copy for [MyType] {}
-   | ^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^--------
+   | |             |
+   | |             this is not defined in the current crate because slices are always foreign
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
   --> $DIR/coherence-impls-copy.rs:45:1
    |
 LL | impl Copy for &'static [NotSync] {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^------------------
+   | |             |
+   | |             this is not defined in the current crate because slices are always foreign
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error: aborting due to 10 previous errors
diff --git a/src/test/ui/coherence/coherence-impls-copy.re.stderr b/src/test/ui/coherence/coherence-impls-copy.re.stderr
index 5c95cc173f2..742845b1907 100644
--- a/src/test/ui/coherence/coherence-impls-copy.re.stderr
+++ b/src/test/ui/coherence/coherence-impls-copy.re.stderr
@@ -49,36 +49,44 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/coherence-impls-copy.rs:8:1
    |
 LL | impl Copy for i32 {}
-   | ^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^---
+   | |             |
+   | |             `i32` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
   --> $DIR/coherence-impls-copy.rs:32:1
    |
 LL | impl Copy for (MyType, MyType) {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^----------------
+   | |             |
+   | |             this is not defined in the current crate because tuples are always foreign
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
   --> $DIR/coherence-impls-copy.rs:40:1
    |
 LL | impl Copy for [MyType] {}
-   | ^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^--------
+   | |             |
+   | |             this is not defined in the current crate because slices are always foreign
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
   --> $DIR/coherence-impls-copy.rs:45:1
    |
 LL | impl Copy for &'static [NotSync] {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^------------------
+   | |             |
+   | |             this is not defined in the current crate because slices are always foreign
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error: aborting due to 10 previous errors
diff --git a/src/test/ui/coherence/coherence-impls-send.old.stderr b/src/test/ui/coherence/coherence-impls-send.old.stderr
index b67f4d517b1..7584b01ca89 100644
--- a/src/test/ui/coherence/coherence-impls-send.old.stderr
+++ b/src/test/ui/coherence/coherence-impls-send.old.stderr
@@ -2,9 +2,11 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/coherence-impls-send.rs:20:1
    |
 LL | unsafe impl Send for (MyType, MyType) {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^^^^^^^----------------
+   | |                    |
+   | |                    this is not defined in the current crate because tuples are always foreign
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `&'static NotSync`
@@ -17,18 +19,22 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/coherence-impls-send.rs:28:1
    |
 LL | unsafe impl Send for [MyType] {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^^^^^^^--------
+   | |                    |
+   | |                    this is not defined in the current crate because slices are always foreign
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
   --> $DIR/coherence-impls-send.rs:32:1
    |
 LL | unsafe impl Send for &'static [NotSync] {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^^^^^^^------------------
+   | |                    |
+   | |                    this is not defined in the current crate because slices are always foreign
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error: aborting due to 4 previous errors
diff --git a/src/test/ui/coherence/coherence-impls-send.re.stderr b/src/test/ui/coherence/coherence-impls-send.re.stderr
index b67f4d517b1..7584b01ca89 100644
--- a/src/test/ui/coherence/coherence-impls-send.re.stderr
+++ b/src/test/ui/coherence/coherence-impls-send.re.stderr
@@ -2,9 +2,11 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/coherence-impls-send.rs:20:1
    |
 LL | unsafe impl Send for (MyType, MyType) {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^^^^^^^----------------
+   | |                    |
+   | |                    this is not defined in the current crate because tuples are always foreign
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `&'static NotSync`
@@ -17,18 +19,22 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/coherence-impls-send.rs:28:1
    |
 LL | unsafe impl Send for [MyType] {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^^^^^^^--------
+   | |                    |
+   | |                    this is not defined in the current crate because slices are always foreign
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
   --> $DIR/coherence-impls-send.rs:32:1
    |
 LL | unsafe impl Send for &'static [NotSync] {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^^^^^^^------------------
+   | |                    |
+   | |                    this is not defined in the current crate because slices are always foreign
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error: aborting due to 4 previous errors
diff --git a/src/test/ui/coherence/coherence-impls-sized.old.stderr b/src/test/ui/coherence/coherence-impls-sized.old.stderr
index a19ecfdc3c5..ef999bcf461 100644
--- a/src/test/ui/coherence/coherence-impls-sized.old.stderr
+++ b/src/test/ui/coherence/coherence-impls-sized.old.stderr
@@ -38,27 +38,33 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/coherence-impls-sized.rs:27:1
    |
 LL | impl Sized for (MyType, MyType) {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^----------------
+   | |              |
+   | |              this is not defined in the current crate because tuples are always foreign
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
   --> $DIR/coherence-impls-sized.rs:39:1
    |
 LL | impl Sized for [MyType] {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^--------
+   | |              |
+   | |              this is not defined in the current crate because slices are always foreign
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
   --> $DIR/coherence-impls-sized.rs:46:1
    |
 LL | impl Sized for &'static [NotSync] {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^------------------
+   | |              |
+   | |              this is not defined in the current crate because slices are always foreign
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error: aborting due to 9 previous errors
diff --git a/src/test/ui/coherence/coherence-impls-sized.re.stderr b/src/test/ui/coherence/coherence-impls-sized.re.stderr
index a19ecfdc3c5..ef999bcf461 100644
--- a/src/test/ui/coherence/coherence-impls-sized.re.stderr
+++ b/src/test/ui/coherence/coherence-impls-sized.re.stderr
@@ -38,27 +38,33 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/coherence-impls-sized.rs:27:1
    |
 LL | impl Sized for (MyType, MyType) {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^----------------
+   | |              |
+   | |              this is not defined in the current crate because tuples are always foreign
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
   --> $DIR/coherence-impls-sized.rs:39:1
    |
 LL | impl Sized for [MyType] {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^--------
+   | |              |
+   | |              this is not defined in the current crate because slices are always foreign
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
   --> $DIR/coherence-impls-sized.rs:46:1
    |
 LL | impl Sized for &'static [NotSync] {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^------------------
+   | |              |
+   | |              this is not defined in the current crate because slices are always foreign
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error: aborting due to 9 previous errors
diff --git a/src/test/ui/coherence/coherence-lone-type-parameter.old.stderr b/src/test/ui/coherence/coherence-lone-type-parameter.old.stderr
index ac77241e9e7..731752045cd 100644
--- a/src/test/ui/coherence/coherence-lone-type-parameter.old.stderr
+++ b/src/test/ui/coherence/coherence-lone-type-parameter.old.stderr
@@ -1,8 +1,8 @@
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/coherence-lone-type-parameter.rs:9:1
+  --> $DIR/coherence-lone-type-parameter.rs:9:6
    |
 LL | impl<T> Remote for T { }
-   | ^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |      ^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
diff --git a/src/test/ui/coherence/coherence-lone-type-parameter.re.stderr b/src/test/ui/coherence/coherence-lone-type-parameter.re.stderr
index ac77241e9e7..731752045cd 100644
--- a/src/test/ui/coherence/coherence-lone-type-parameter.re.stderr
+++ b/src/test/ui/coherence/coherence-lone-type-parameter.re.stderr
@@ -1,8 +1,8 @@
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/coherence-lone-type-parameter.rs:9:1
+  --> $DIR/coherence-lone-type-parameter.rs:9:6
    |
 LL | impl<T> Remote for T { }
-   | ^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |      ^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
diff --git a/src/test/ui/coherence/coherence-orphan.old.stderr b/src/test/ui/coherence/coherence-orphan.old.stderr
index e6dc17d95a2..a353acf0679 100644
--- a/src/test/ui/coherence/coherence-orphan.old.stderr
+++ b/src/test/ui/coherence/coherence-orphan.old.stderr
@@ -2,18 +2,23 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/coherence-orphan.rs:13:1
    |
 LL | impl TheTrait<usize> for isize { }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^---------------^^^^^-----
+   | |    |                   |
+   | |    |                   `isize` is not defined in the current crate
+   | |    `usize` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
   --> $DIR/coherence-orphan.rs:21:1
    |
 LL | impl !Send for Vec<isize> { }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^----------
+   | |              |
+   | |              `std::vec::Vec` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error: aborting due to 2 previous errors
diff --git a/src/test/ui/coherence/coherence-orphan.re.stderr b/src/test/ui/coherence/coherence-orphan.re.stderr
index e6dc17d95a2..a353acf0679 100644
--- a/src/test/ui/coherence/coherence-orphan.re.stderr
+++ b/src/test/ui/coherence/coherence-orphan.re.stderr
@@ -2,18 +2,23 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/coherence-orphan.rs:13:1
    |
 LL | impl TheTrait<usize> for isize { }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^---------------^^^^^-----
+   | |    |                   |
+   | |    |                   `isize` is not defined in the current crate
+   | |    `usize` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
   --> $DIR/coherence-orphan.rs:21:1
    |
 LL | impl !Send for Vec<isize> { }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^----------
+   | |              |
+   | |              `std::vec::Vec` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error: aborting due to 2 previous errors
diff --git a/src/test/ui/coherence/coherence-overlapping-pairs.old.stderr b/src/test/ui/coherence/coherence-overlapping-pairs.old.stderr
index b275af9668d..7c62716f705 100644
--- a/src/test/ui/coherence/coherence-overlapping-pairs.old.stderr
+++ b/src/test/ui/coherence/coherence-overlapping-pairs.old.stderr
@@ -1,8 +1,8 @@
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/coherence-overlapping-pairs.rs:11:1
+  --> $DIR/coherence-overlapping-pairs.rs:11:6
    |
 LL | impl<T> Remote for lib::Pair<T,Foo> { }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |      ^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
diff --git a/src/test/ui/coherence/coherence-overlapping-pairs.re.stderr b/src/test/ui/coherence/coherence-overlapping-pairs.re.stderr
index a6fa609deb2..2277b33fceb 100644
--- a/src/test/ui/coherence/coherence-overlapping-pairs.re.stderr
+++ b/src/test/ui/coherence/coherence-overlapping-pairs.re.stderr
@@ -2,9 +2,11 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/coherence-overlapping-pairs.rs:11:1
    |
 LL | impl<T> Remote for lib::Pair<T,Foo> { }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^^^^^----------------
+   | |                  |
+   | |                  `lib::Pair` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error: aborting due to previous error
diff --git a/src/test/ui/coherence/coherence-pair-covered-uncovered-1.old.stderr b/src/test/ui/coherence/coherence-pair-covered-uncovered-1.old.stderr
index 8b25bee6e2f..9f55df4c974 100644
--- a/src/test/ui/coherence/coherence-pair-covered-uncovered-1.old.stderr
+++ b/src/test/ui/coherence/coherence-pair-covered-uncovered-1.old.stderr
@@ -1,8 +1,8 @@
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/coherence-pair-covered-uncovered-1.rs:15:1
+  --> $DIR/coherence-pair-covered-uncovered-1.rs:15:6
    |
 LL | impl<T, U> Remote1<Pair<T, Local<U>>> for i32 { }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |      ^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
diff --git a/src/test/ui/coherence/coherence-pair-covered-uncovered-1.re.stderr b/src/test/ui/coherence/coherence-pair-covered-uncovered-1.re.stderr
index e45cd78363c..f6e755b6662 100644
--- a/src/test/ui/coherence/coherence-pair-covered-uncovered-1.re.stderr
+++ b/src/test/ui/coherence/coherence-pair-covered-uncovered-1.re.stderr
@@ -2,9 +2,12 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/coherence-pair-covered-uncovered-1.rs:15:1
    |
 LL | impl<T, U> Remote1<Pair<T, Local<U>>> for i32 { }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^--------------------------^^^^^---
+   | |          |                              |
+   | |          |                              `i32` is not defined in the current crate
+   | |          `lib::Pair` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error: aborting due to previous error
diff --git a/src/test/ui/coherence/coherence-pair-covered-uncovered.old.stderr b/src/test/ui/coherence/coherence-pair-covered-uncovered.old.stderr
index 39558d8dcc0..4084061eb4a 100644
--- a/src/test/ui/coherence/coherence-pair-covered-uncovered.old.stderr
+++ b/src/test/ui/coherence/coherence-pair-covered-uncovered.old.stderr
@@ -1,8 +1,8 @@
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/coherence-pair-covered-uncovered.rs:11:1
+  --> $DIR/coherence-pair-covered-uncovered.rs:11:6
    |
 LL | impl<T,U> Remote for Pair<T,Local<U>> { }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |      ^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
diff --git a/src/test/ui/coherence/coherence-pair-covered-uncovered.re.stderr b/src/test/ui/coherence/coherence-pair-covered-uncovered.re.stderr
index 54d5f3058a8..9fa860cb584 100644
--- a/src/test/ui/coherence/coherence-pair-covered-uncovered.re.stderr
+++ b/src/test/ui/coherence/coherence-pair-covered-uncovered.re.stderr
@@ -2,9 +2,11 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/coherence-pair-covered-uncovered.rs:11:1
    |
 LL | impl<T,U> Remote for Pair<T,Local<U>> { }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^^^^^^^----------------
+   | |                    |
+   | |                    `lib::Pair` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error: aborting due to previous error
diff --git a/src/test/ui/coherence/coherence-vec-local-2.old.stderr b/src/test/ui/coherence/coherence-vec-local-2.old.stderr
index 1c1118a58c6..fbcf8fb762a 100644
--- a/src/test/ui/coherence/coherence-vec-local-2.old.stderr
+++ b/src/test/ui/coherence/coherence-vec-local-2.old.stderr
@@ -1,8 +1,8 @@
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/coherence-vec-local-2.rs:14:1
+  --> $DIR/coherence-vec-local-2.rs:14:6
    |
 LL | impl<T> Remote for Vec<Local<T>> { }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |      ^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
diff --git a/src/test/ui/coherence/coherence-vec-local-2.re.stderr b/src/test/ui/coherence/coherence-vec-local-2.re.stderr
index 6992aa7a0bd..48a2848c55f 100644
--- a/src/test/ui/coherence/coherence-vec-local-2.re.stderr
+++ b/src/test/ui/coherence/coherence-vec-local-2.re.stderr
@@ -2,9 +2,11 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/coherence-vec-local-2.rs:14:1
    |
 LL | impl<T> Remote for Vec<Local<T>> { }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^^^^^-------------
+   | |                  |
+   | |                  `std::vec::Vec` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error: aborting due to previous error
diff --git a/src/test/ui/coherence/coherence-vec-local.old.stderr b/src/test/ui/coherence/coherence-vec-local.old.stderr
index b35e7a8ba8b..4b199dd9142 100644
--- a/src/test/ui/coherence/coherence-vec-local.old.stderr
+++ b/src/test/ui/coherence/coherence-vec-local.old.stderr
@@ -2,9 +2,11 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/coherence-vec-local.rs:14:1
    |
 LL | impl Remote for Vec<Local> { }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^^----------
+   | |               |
+   | |               `std::vec::Vec` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error: aborting due to previous error
diff --git a/src/test/ui/coherence/coherence-vec-local.re.stderr b/src/test/ui/coherence/coherence-vec-local.re.stderr
index b35e7a8ba8b..4b199dd9142 100644
--- a/src/test/ui/coherence/coherence-vec-local.re.stderr
+++ b/src/test/ui/coherence/coherence-vec-local.re.stderr
@@ -2,9 +2,11 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/coherence-vec-local.rs:14:1
    |
 LL | impl Remote for Vec<Local> { }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^^----------
+   | |               |
+   | |               `std::vec::Vec` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error: aborting due to previous error
diff --git a/src/test/ui/coherence/coherence_local_err_struct.old.stderr b/src/test/ui/coherence/coherence_local_err_struct.old.stderr
index e1f651493f6..0782f823128 100644
--- a/src/test/ui/coherence/coherence_local_err_struct.old.stderr
+++ b/src/test/ui/coherence/coherence_local_err_struct.old.stderr
@@ -2,9 +2,11 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/coherence_local_err_struct.rs:17:1
    |
 LL | impl lib::MyCopy for lib::MyStruct<MyType> { }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^^^^^^^---------------------
+   | |                    |
+   | |                    `lib::MyStruct` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error: aborting due to previous error
diff --git a/src/test/ui/coherence/coherence_local_err_struct.re.stderr b/src/test/ui/coherence/coherence_local_err_struct.re.stderr
index e1f651493f6..0782f823128 100644
--- a/src/test/ui/coherence/coherence_local_err_struct.re.stderr
+++ b/src/test/ui/coherence/coherence_local_err_struct.re.stderr
@@ -2,9 +2,11 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/coherence_local_err_struct.rs:17:1
    |
 LL | impl lib::MyCopy for lib::MyStruct<MyType> { }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^^^^^^^---------------------
+   | |                    |
+   | |                    `lib::MyStruct` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error: aborting due to previous error
diff --git a/src/test/ui/coherence/coherence_local_err_tuple.old.stderr b/src/test/ui/coherence/coherence_local_err_tuple.old.stderr
index 171daa54861..f01623f7621 100644
--- a/src/test/ui/coherence/coherence_local_err_tuple.old.stderr
+++ b/src/test/ui/coherence/coherence_local_err_tuple.old.stderr
@@ -2,9 +2,11 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/coherence_local_err_tuple.rs:17:1
    |
 LL | impl lib::MyCopy for (MyType,) { }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^^^^^^^---------
+   | |                    |
+   | |                    this is not defined in the current crate because tuples are always foreign
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error: aborting due to previous error
diff --git a/src/test/ui/coherence/coherence_local_err_tuple.re.stderr b/src/test/ui/coherence/coherence_local_err_tuple.re.stderr
index 171daa54861..f01623f7621 100644
--- a/src/test/ui/coherence/coherence_local_err_tuple.re.stderr
+++ b/src/test/ui/coherence/coherence_local_err_tuple.re.stderr
@@ -2,9 +2,11 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/coherence_local_err_tuple.rs:17:1
    |
 LL | impl lib::MyCopy for (MyType,) { }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^^^^^^^---------
+   | |                    |
+   | |                    this is not defined in the current crate because tuples are always foreign
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error: aborting due to previous error
diff --git a/src/test/ui/coherence/impl-foreign-for-foreign.stderr b/src/test/ui/coherence/impl-foreign-for-foreign.stderr
index b03a75a77c3..4d7757799e7 100644
--- a/src/test/ui/coherence/impl-foreign-for-foreign.stderr
+++ b/src/test/ui/coherence/impl-foreign-for-foreign.stderr
@@ -2,9 +2,11 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/impl-foreign-for-foreign.rs:12:1
    |
 LL | impl Remote for i32 {
-   | ^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^^---
+   | |               |
+   | |               `i32` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error: aborting due to previous error
diff --git a/src/test/ui/coherence/impl-foreign-for-foreign[foreign].stderr b/src/test/ui/coherence/impl-foreign-for-foreign[foreign].stderr
index bfaec790b20..4d15f0db65f 100644
--- a/src/test/ui/coherence/impl-foreign-for-foreign[foreign].stderr
+++ b/src/test/ui/coherence/impl-foreign-for-foreign[foreign].stderr
@@ -2,27 +2,36 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/impl-foreign-for-foreign[foreign].rs:12:1
    |
 LL | impl Remote1<Rc<i32>> for i32 {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^----------------^^^^^---
+   | |    |                    |
+   | |    |                    `i32` is not defined in the current crate
+   | |    `std::rc::Rc` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
   --> $DIR/impl-foreign-for-foreign[foreign].rs:16:1
    |
 LL | impl Remote1<Rc<Local>> for f64 {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^------------------^^^^^---
+   | |    |                      |
+   | |    |                      `f64` is not defined in the current crate
+   | |    `std::rc::Rc` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
   --> $DIR/impl-foreign-for-foreign[foreign].rs:20:1
    |
 LL | impl<T> Remote1<Rc<T>> for f32 {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^--------------^^^^^---
+   | |       |                  |
+   | |       |                  `f32` is not defined in the current crate
+   | |       `std::rc::Rc` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error: aborting due to 3 previous errors
diff --git a/src/test/ui/coherence/impl-foreign-for-fundamental[foreign].stderr b/src/test/ui/coherence/impl-foreign-for-fundamental[foreign].stderr
index 2ce4921cf93..d1f4d9849ac 100644
--- a/src/test/ui/coherence/impl-foreign-for-fundamental[foreign].stderr
+++ b/src/test/ui/coherence/impl-foreign-for-fundamental[foreign].stderr
@@ -2,18 +2,22 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/impl-foreign-for-fundamental[foreign].rs:12:1
    |
 LL | impl Remote for Box<i32> {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^^--------
+   | |               |
+   | |               `i32` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
   --> $DIR/impl-foreign-for-fundamental[foreign].rs:16:1
    |
 LL | impl<T> Remote for Box<Rc<T>> {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^^^^^----------
+   | |                  |
+   | |                  `std::rc::Rc` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error: aborting due to 2 previous errors
diff --git a/src/test/ui/coherence/impl-foreign[foreign]-for-foreign.stderr b/src/test/ui/coherence/impl-foreign[foreign]-for-foreign.stderr
index 04e96f29230..07c7632a53f 100644
--- a/src/test/ui/coherence/impl-foreign[foreign]-for-foreign.stderr
+++ b/src/test/ui/coherence/impl-foreign[foreign]-for-foreign.stderr
@@ -2,9 +2,12 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/impl-foreign[foreign]-for-foreign.rs:12:1
    |
 LL | impl Remote1<u32> for f64 {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^------------^^^^^---
+   | |    |                |
+   | |    |                `f64` is not defined in the current crate
+   | |    `u32` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error: aborting due to previous error
diff --git a/src/test/ui/coherence/impl-foreign[fundemental[foreign]]-for-foreign.stderr b/src/test/ui/coherence/impl-foreign[fundemental[foreign]]-for-foreign.stderr
index bf2361a1718..8dcac05c0cc 100644
--- a/src/test/ui/coherence/impl-foreign[fundemental[foreign]]-for-foreign.stderr
+++ b/src/test/ui/coherence/impl-foreign[fundemental[foreign]]-for-foreign.stderr
@@ -2,27 +2,36 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/impl-foreign[fundemental[foreign]]-for-foreign.rs:13:1
    |
 LL | impl Remote1<Box<String>> for i32 {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^--------------------^^^^^---
+   | |    |                        |
+   | |    |                        `i32` is not defined in the current crate
+   | |    `std::string::String` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
   --> $DIR/impl-foreign[fundemental[foreign]]-for-foreign.rs:17:1
    |
 LL | impl Remote1<Box<Rc<i32>>> for f64 {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^---------------------^^^^^---
+   | |    |                         |
+   | |    |                         `f64` is not defined in the current crate
+   | |    `std::rc::Rc` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
   --> $DIR/impl-foreign[fundemental[foreign]]-for-foreign.rs:21:1
    |
 LL | impl<T> Remote1<Box<Rc<T>>> for f32 {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^-------------------^^^^^---
+   | |       |                       |
+   | |       |                       `f32` is not defined in the current crate
+   | |       `std::rc::Rc` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error: aborting due to 3 previous errors
diff --git a/src/test/ui/coherence/impl[t]-foreign-for-foreign[t].stderr b/src/test/ui/coherence/impl[t]-foreign-for-foreign[t].stderr
index d7ffcaf76f9..7e9d3c6e729 100644
--- a/src/test/ui/coherence/impl[t]-foreign-for-foreign[t].stderr
+++ b/src/test/ui/coherence/impl[t]-foreign-for-foreign[t].stderr
@@ -2,18 +2,22 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/impl[t]-foreign-for-foreign[t].rs:13:1
    |
 LL | impl Remote for Rc<Local> {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^^---------
+   | |               |
+   | |               `std::rc::Rc` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
   --> $DIR/impl[t]-foreign-for-foreign[t].rs:18:1
    |
 LL | impl<T> Remote for Arc<T> {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^^^^^------
+   | |                  |
+   | |                  `std::sync::Arc` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error: aborting due to 2 previous errors
diff --git a/src/test/ui/coherence/impl[t]-foreign-for-fundamental[t].stderr b/src/test/ui/coherence/impl[t]-foreign-for-fundamental[t].stderr
index 20ce11ef975..a26b87a3262 100644
--- a/src/test/ui/coherence/impl[t]-foreign-for-fundamental[t].stderr
+++ b/src/test/ui/coherence/impl[t]-foreign-for-fundamental[t].stderr
@@ -1,8 +1,8 @@
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/impl[t]-foreign-for-fundamental[t].rs:12:1
+  --> $DIR/impl[t]-foreign-for-fundamental[t].rs:12:6
    |
 LL | impl<T> Remote for Box<T> {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |      ^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
diff --git a/src/test/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].stderr b/src/test/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].stderr
index 2467097b1a8..cbead462e67 100644
--- a/src/test/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].stderr
+++ b/src/test/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].stderr
@@ -1,16 +1,16 @@
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/impl[t]-foreign[foreign]-for-fundamental[t].rs:12:1
+  --> $DIR/impl[t]-foreign[foreign]-for-fundamental[t].rs:12:6
    |
 LL | impl<T> Remote1<u32> for Box<T> {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |      ^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/impl[t]-foreign[foreign]-for-fundamental[t].rs:16:1
+  --> $DIR/impl[t]-foreign[foreign]-for-fundamental[t].rs:16:10
    |
 LL | impl<'a, T> Remote1<u32> for &'a T {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |          ^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
diff --git a/src/test/ui/coherence/impl[t]-foreign[foreign]-for-t.stderr b/src/test/ui/coherence/impl[t]-foreign[foreign]-for-t.stderr
index 5c28406f113..3d9afdf6cf6 100644
--- a/src/test/ui/coherence/impl[t]-foreign[foreign]-for-t.stderr
+++ b/src/test/ui/coherence/impl[t]-foreign[foreign]-for-t.stderr
@@ -1,8 +1,8 @@
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/impl[t]-foreign[foreign]-for-t.rs:12:1
+  --> $DIR/impl[t]-foreign[foreign]-for-t.rs:12:6
    |
 LL | impl<T> Remote1<u32> for T {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |      ^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
diff --git a/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-foreign.stderr b/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-foreign.stderr
index dd970265079..150b1962acb 100644
--- a/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-foreign.stderr
+++ b/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-foreign.stderr
@@ -1,16 +1,16 @@
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/impl[t]-foreign[fundamental[t]]-for-foreign.rs:12:1
+  --> $DIR/impl[t]-foreign[fundamental[t]]-for-foreign.rs:12:6
    |
 LL | impl<T> Remote1<Box<T>> for u32 {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |      ^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/impl[t]-foreign[fundamental[t]]-for-foreign.rs:16:1
+  --> $DIR/impl[t]-foreign[fundamental[t]]-for-foreign.rs:16:10
    |
 LL | impl<'a, T> Remote1<&'a T> for u32 {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |          ^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
diff --git a/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].stderr b/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].stderr
index eec57fccea7..0d86e74788c 100644
--- a/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].stderr
+++ b/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].stderr
@@ -1,16 +1,16 @@
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/impl[t]-foreign[fundamental[t]]-for-fundamental[t].rs:12:1
+  --> $DIR/impl[t]-foreign[fundamental[t]]-for-fundamental[t].rs:12:10
    |
 LL | impl<'a, T> Remote1<Box<T>> for &'a T {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |          ^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/impl[t]-foreign[fundamental[t]]-for-fundamental[t].rs:15:1
+  --> $DIR/impl[t]-foreign[fundamental[t]]-for-fundamental[t].rs:15:10
    |
 LL | impl<'a, T> Remote1<&'a T> for Box<T> {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |          ^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
diff --git a/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-t.stderr b/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-t.stderr
index e017c3ffe6c..04ac6a868fa 100644
--- a/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-t.stderr
+++ b/src/test/ui/coherence/impl[t]-foreign[fundamental[t]]-for-t.stderr
@@ -1,16 +1,16 @@
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/impl[t]-foreign[fundamental[t]]-for-t.rs:12:1
+  --> $DIR/impl[t]-foreign[fundamental[t]]-for-t.rs:12:6
    |
 LL | impl<T> Remote1<Box<T>> for T {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |      ^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/impl[t]-foreign[fundamental[t]]-for-t.rs:15:1
+  --> $DIR/impl[t]-foreign[fundamental[t]]-for-t.rs:15:10
    |
 LL | impl<'a, T> Remote1<&'a T> for T {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |          ^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
diff --git a/src/test/ui/coherence/impl[t]-foreign[fundamental[t]_local]-for-foreign.stderr b/src/test/ui/coherence/impl[t]-foreign[fundamental[t]_local]-for-foreign.stderr
index 3d8561956ae..f1fdcecf57d 100644
--- a/src/test/ui/coherence/impl[t]-foreign[fundamental[t]_local]-for-foreign.stderr
+++ b/src/test/ui/coherence/impl[t]-foreign[fundamental[t]_local]-for-foreign.stderr
@@ -1,16 +1,16 @@
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/impl[t]-foreign[fundamental[t]_local]-for-foreign.rs:12:1
+  --> $DIR/impl[t]-foreign[fundamental[t]_local]-for-foreign.rs:12:6
    |
 LL | impl<T> Remote2<Box<T>, Local> for u32 {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |      ^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/impl[t]-foreign[fundamental[t]_local]-for-foreign.rs:16:1
+  --> $DIR/impl[t]-foreign[fundamental[t]_local]-for-foreign.rs:16:10
    |
 LL | impl<'a, T> Remote2<&'a T, Local> for u32 {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |          ^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
diff --git a/src/test/ui/coherence/impl[t]-foreign[local]-for-fundamental[t].stderr b/src/test/ui/coherence/impl[t]-foreign[local]-for-fundamental[t].stderr
index 7859665a7bb..99ccbb89fc2 100644
--- a/src/test/ui/coherence/impl[t]-foreign[local]-for-fundamental[t].stderr
+++ b/src/test/ui/coherence/impl[t]-foreign[local]-for-fundamental[t].stderr
@@ -1,16 +1,16 @@
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/impl[t]-foreign[local]-for-fundamental[t].rs:12:1
+  --> $DIR/impl[t]-foreign[local]-for-fundamental[t].rs:12:6
    |
 LL | impl<T> Remote1<Local> for Box<T> {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |      ^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/impl[t]-foreign[local]-for-fundamental[t].rs:16:1
+  --> $DIR/impl[t]-foreign[local]-for-fundamental[t].rs:16:6
    |
 LL | impl<T> Remote1<Local> for &T {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |      ^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
diff --git a/src/test/ui/coherence/impl[t]-foreign[local]-for-t.stderr b/src/test/ui/coherence/impl[t]-foreign[local]-for-t.stderr
index be7de8cccb4..08cf414c139 100644
--- a/src/test/ui/coherence/impl[t]-foreign[local]-for-t.stderr
+++ b/src/test/ui/coherence/impl[t]-foreign[local]-for-t.stderr
@@ -1,8 +1,8 @@
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/impl[t]-foreign[local]-for-t.rs:12:1
+  --> $DIR/impl[t]-foreign[local]-for-t.rs:12:6
    |
 LL | impl<T> Remote1<Local> for T {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |      ^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
diff --git a/src/test/ui/coherence/impl[t]-foreign[t]-for-foreign.stderr b/src/test/ui/coherence/impl[t]-foreign[t]-for-foreign.stderr
index 5544729b5d6..e9d1ea8a815 100644
--- a/src/test/ui/coherence/impl[t]-foreign[t]-for-foreign.stderr
+++ b/src/test/ui/coherence/impl[t]-foreign[t]-for-foreign.stderr
@@ -1,8 +1,8 @@
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/impl[t]-foreign[t]-for-foreign.rs:12:1
+  --> $DIR/impl[t]-foreign[t]-for-foreign.rs:12:6
    |
 LL | impl<T> Remote1<T> for u32 {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |      ^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
diff --git a/src/test/ui/coherence/impl[t]-foreign[t]-for-fundamental.stderr b/src/test/ui/coherence/impl[t]-foreign[t]-for-fundamental.stderr
index be8cc29a6e5..d8b0d25a578 100644
--- a/src/test/ui/coherence/impl[t]-foreign[t]-for-fundamental.stderr
+++ b/src/test/ui/coherence/impl[t]-foreign[t]-for-fundamental.stderr
@@ -1,16 +1,16 @@
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/impl[t]-foreign[t]-for-fundamental.rs:12:1
+  --> $DIR/impl[t]-foreign[t]-for-fundamental.rs:12:6
    |
 LL | impl<T> Remote1<T> for Box<T> {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |      ^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
 error[E0210]: type parameter `B` must be used as the type parameter for some local type (e.g., `MyStruct<B>`)
-  --> $DIR/impl[t]-foreign[t]-for-fundamental.rs:16:1
+  --> $DIR/impl[t]-foreign[t]-for-fundamental.rs:16:13
    |
 LL | impl<'a, A, B> Remote1<A> for &'a B {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `B` must be used as the type parameter for some local type
+   |             ^ type parameter `B` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
diff --git a/src/test/ui/coherence/impl[t]-foreign[t]-for-t.stderr b/src/test/ui/coherence/impl[t]-foreign[t]-for-t.stderr
index de857afd20b..7b651e66c3d 100644
--- a/src/test/ui/coherence/impl[t]-foreign[t]-for-t.stderr
+++ b/src/test/ui/coherence/impl[t]-foreign[t]-for-t.stderr
@@ -1,8 +1,8 @@
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/impl[t]-foreign[t]-for-t.rs:12:1
+  --> $DIR/impl[t]-foreign[t]-for-t.rs:12:6
    |
 LL | impl<T> Remote1<T> for T {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |      ^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
diff --git a/src/test/ui/dropck/drop-on-non-struct.stderr b/src/test/ui/dropck/drop-on-non-struct.stderr
index 6ff16402b0e..a374b0d2636 100644
--- a/src/test/ui/dropck/drop-on-non-struct.stderr
+++ b/src/test/ui/dropck/drop-on-non-struct.stderr
@@ -8,9 +8,11 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/drop-on-non-struct.rs:1:1
    |
 LL | impl<'a> Drop for &'a mut isize {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^^^^-------------
+   | |                 |
+   | |                 `isize` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error: aborting due to 2 previous errors
diff --git a/src/test/ui/error-codes/E0117.stderr b/src/test/ui/error-codes/E0117.stderr
index 6c0bbc2b628..f0cfc8a2533 100644
--- a/src/test/ui/error-codes/E0117.stderr
+++ b/src/test/ui/error-codes/E0117.stderr
@@ -8,9 +8,11 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/E0117.rs:1:1
    |
 LL | impl Drop for u32 {}
-   | ^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^---
+   | |             |
+   | |             `u32` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error: aborting due to 2 previous errors
diff --git a/src/test/ui/error-codes/E0206.stderr b/src/test/ui/error-codes/E0206.stderr
index cd5d74854ef..e4ad4ffb45f 100644
--- a/src/test/ui/error-codes/E0206.stderr
+++ b/src/test/ui/error-codes/E0206.stderr
@@ -14,9 +14,11 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/E0206.rs:3:1
    |
 LL | impl Copy for Foo { }
-   | ^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^---
+   | |             |
+   | |             this is not defined in the current crate because arrays are always foreign
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error: aborting due to 3 previous errors
diff --git a/src/test/ui/error-codes/e0119/complex-impl.stderr b/src/test/ui/error-codes/e0119/complex-impl.stderr
index 7ed89a5b1ae..f7516d20af4 100644
--- a/src/test/ui/error-codes/e0119/complex-impl.stderr
+++ b/src/test/ui/error-codes/e0119/complex-impl.stderr
@@ -9,10 +9,10 @@ LL | impl<R> External for (Q, R) {}
              where <U as std::ops::FnOnce<(T,)>>::Output == V, <V as std::iter::Iterator>::Item == T, 'b : 'a, T : 'a, U: std::ops::FnOnce<(T,)>, U : 'static, V: std::iter::Iterator, V: std::clone::Clone, W: std::ops::Add, <W as std::ops::Add>::Output: std::marker::Copy;
 
 error[E0210]: type parameter `R` must be used as the type parameter for some local type (e.g., `MyStruct<R>`)
-  --> $DIR/complex-impl.rs:9:1
+  --> $DIR/complex-impl.rs:9:6
    |
 LL | impl<R> External for (Q, R) {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `R` must be used as the type parameter for some local type
+   |      ^ type parameter `R` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
diff --git a/src/test/ui/error-codes/e0119/issue-28981.stderr b/src/test/ui/error-codes/e0119/issue-28981.stderr
index 70c83e1412d..ec8e8144d42 100644
--- a/src/test/ui/error-codes/e0119/issue-28981.stderr
+++ b/src/test/ui/error-codes/e0119/issue-28981.stderr
@@ -9,10 +9,10 @@ LL | impl<Foo> Deref for Foo { }
              where T: ?Sized;
 
 error[E0210]: type parameter `Foo` must be used as the type parameter for some local type (e.g., `MyStruct<Foo>`)
-  --> $DIR/issue-28981.rs:5:1
+  --> $DIR/issue-28981.rs:5:6
    |
 LL | impl<Foo> Deref for Foo { }
-   | ^^^^^^^^^^^^^^^^^^^^^^^ type parameter `Foo` must be used as the type parameter for some local type
+   |      ^^^ type parameter `Foo` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
diff --git a/src/test/ui/feature-gates/feature-gate-re-rebalance-coherence.stderr b/src/test/ui/feature-gates/feature-gate-re-rebalance-coherence.stderr
index 5972e610e47..504bfb56979 100644
--- a/src/test/ui/feature-gates/feature-gate-re-rebalance-coherence.stderr
+++ b/src/test/ui/feature-gates/feature-gate-re-rebalance-coherence.stderr
@@ -1,8 +1,8 @@
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/feature-gate-re-rebalance-coherence.rs:10:1
+  --> $DIR/feature-gate-re-rebalance-coherence.rs:10:10
    |
 LL | impl<'a, T:'a, Tab> QueryFragment<Oracle> for BatchInsert<'a, T, Tab> {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |          ^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
diff --git a/src/test/ui/issues/issue-41974.stderr b/src/test/ui/issues/issue-41974.stderr
index 20121878a07..12d4da71599 100644
--- a/src/test/ui/issues/issue-41974.stderr
+++ b/src/test/ui/issues/issue-41974.stderr
@@ -16,10 +16,10 @@ LL | impl<T> Drop for T where T: A {
    |                  ^ implementing Drop requires a struct
 
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/issue-41974.rs:7:1
+  --> $DIR/issue-41974.rs:7:6
    |
 LL | impl<T> Drop for T where T: A {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |      ^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
diff --git a/src/test/ui/orphan-check-diagnostics.stderr b/src/test/ui/orphan-check-diagnostics.stderr
index 3f868422c7f..cb21b26bba7 100644
--- a/src/test/ui/orphan-check-diagnostics.stderr
+++ b/src/test/ui/orphan-check-diagnostics.stderr
@@ -1,8 +1,8 @@
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/orphan-check-diagnostics.rs:11:1
+  --> $DIR/orphan-check-diagnostics.rs:11:6
    |
 LL | impl<T> RemoteTrait for T where T: LocalTrait {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+   |      ^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter
 
diff --git a/src/test/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr b/src/test/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr
index 65186844965..a54826787da 100644
--- a/src/test/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr
+++ b/src/test/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr
@@ -2,18 +2,22 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:13:1
    |
 LL | impl DefaultedTrait for (A,) { }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^^^^^^^^^^----
+   | |                       |
+   | |                       this is not defined in the current crate because tuples are always foreign
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
   --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:16:1
    |
 LL | impl !DefaultedTrait for (B,) { }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^----
+   | |                        |
+   | |                        this is not defined in the current crate because tuples are always foreign
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error[E0321]: cross-crate traits with a default impl, like `lib::DefaultedTrait`, can only be implemented for a struct/enum type defined in the current crate
@@ -26,9 +30,11 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
   --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:21:1
    |
 LL | impl DefaultedTrait for lib::Something<C> { }
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+   | ^^^^^^^^^^^^^^^^^^^^^^^^-----------------
+   | |                       |
+   | |                       `lib::Something` is not defined in the current crate
+   | impl doesn't use only types from inside the current crate
    |
-   = note: the impl does not reference only types defined in this crate
    = note: define and implement a trait or new type instead
 
 error: aborting due to 4 previous errors