about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2019-10-11 12:37:48 -0700
committerEsteban Küber <esteban@kuber.com.ar>2019-10-28 09:56:53 -0700
commitadfe9a45d60198316952baa5088ae77a8a5e919a (patch)
tree261872f1c9bc15784d7ac861884a1f5b77d63023
parent03a50ae9b87021d4a166c70d2c932f1cb0aa8f28 (diff)
downloadrust-adfe9a45d60198316952baa5088ae77a8a5e919a.tar.gz
rust-adfe9a45d60198316952baa5088ae77a8a5e919a.zip
Call out the types that are non local on E0117
-rw-r--r--src/librustc/traits/coherence.rs11
-rw-r--r--src/librustc_typeck/coherence/orphan.rs24
-rw-r--r--src/test/ui/coherence/coherence-cow.re_a.stderr2
-rw-r--r--src/test/ui/coherence/coherence-cow.re_b.stderr2
-rw-r--r--src/test/ui/coherence/coherence-cow.re_c.stderr2
-rw-r--r--src/test/ui/coherence/coherence-fundamental-trait-objects.old.stderr2
-rw-r--r--src/test/ui/coherence/coherence-fundamental-trait-objects.re.stderr2
-rw-r--r--src/test/ui/coherence/coherence-impl-trait-for-marker-trait-negative.stderr2
-rw-r--r--src/test/ui/coherence/coherence-impl-trait-for-marker-trait-positive.stderr2
-rw-r--r--src/test/ui/coherence/coherence-impls-copy.old.stderr8
-rw-r--r--src/test/ui/coherence/coherence-impls-copy.re.stderr8
-rw-r--r--src/test/ui/coherence/coherence-impls-send.old.stderr6
-rw-r--r--src/test/ui/coherence/coherence-impls-send.re.stderr6
-rw-r--r--src/test/ui/coherence/coherence-impls-sized.old.stderr6
-rw-r--r--src/test/ui/coherence/coherence-impls-sized.re.stderr6
-rw-r--r--src/test/ui/coherence/coherence-orphan.old.stderr5
-rw-r--r--src/test/ui/coherence/coherence-orphan.re.stderr5
-rw-r--r--src/test/ui/coherence/coherence-overlapping-pairs.re.stderr2
-rw-r--r--src/test/ui/coherence/coherence-pair-covered-uncovered-1.re.stderr3
-rw-r--r--src/test/ui/coherence/coherence-pair-covered-uncovered.re.stderr2
-rw-r--r--src/test/ui/coherence/coherence-vec-local-2.re.stderr2
-rw-r--r--src/test/ui/coherence/coherence-vec-local.old.stderr2
-rw-r--r--src/test/ui/coherence/coherence-vec-local.re.stderr2
-rw-r--r--src/test/ui/coherence/coherence_local_err_struct.old.stderr2
-rw-r--r--src/test/ui/coherence/coherence_local_err_struct.re.stderr2
-rw-r--r--src/test/ui/coherence/coherence_local_err_tuple.old.stderr2
-rw-r--r--src/test/ui/coherence/coherence_local_err_tuple.re.stderr2
-rw-r--r--src/test/ui/coherence/impl-foreign[foreign]-for-foreign.stderr3
-rw-r--r--src/test/ui/dropck/drop-on-non-struct.stderr2
-rw-r--r--src/test/ui/error-codes/E0117.stderr2
-rw-r--r--src/test/ui/error-codes/E0206.stderr2
-rw-r--r--src/test/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr6
32 files changed, 74 insertions, 61 deletions
diff --git a/src/librustc/traits/coherence.rs b/src/librustc/traits/coherence.rs
index 2734fce4ea5..da095ed5f36 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>>),
     UncoveredTy(Ty<'tcx>),
 }
 
@@ -390,6 +390,7 @@ fn orphan_check_trait_ref<'tcx>(
             }
         }
 
+        let mut non_local_spans = vec![];
         for input_ty in
             trait_ref.input_types().flat_map(|ty| uncover_fundamental_ty(tcx, ty, in_crate))
         {
@@ -401,11 +402,13 @@ fn orphan_check_trait_ref<'tcx>(
                 debug!("orphan_check_trait_ref: uncovered ty: `{:?}`", input_ty);
                 return Err(OrphanCheckErr::UncoveredTy(input_ty))
             }
+            non_local_spans.push(input_ty);
         }
         // 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
@@ -438,10 +441,12 @@ fn orphan_check_trait_ref<'tcx>(
                 debug!("orphan_check_trait_ref: uncovered type `{:?}`", param);
                 return Err(OrphanCheckErr::UncoveredTy(param));
             }
+
+            non_local_spans.push(input_ty);
         }
         // 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))
     }
 }
 
diff --git a/src/librustc_typeck/coherence/orphan.rs b/src/librustc_typeck/coherence/orphan.rs
index 667fa50a7cf..c19b588eb07 100644
--- a/src/librustc_typeck/coherence/orphan.rs
+++ b/src/librustc_typeck/coherence/orphan.rs
@@ -33,16 +33,20 @@ 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 types inside crate");
+                    for ty in &tys {
+                        err.note(&format!("`{}` is not defined in the current create", ty));
+                    }
+                    err.note("define and implement a trait or new type instead");
+                    err.emit();
                     return;
                 }
                 Err(traits::OrphanCheckErr::UncoveredTy(param_ty)) => {
diff --git a/src/test/ui/coherence/coherence-cow.re_a.stderr b/src/test/ui/coherence/coherence-cow.re_a.stderr
index b0ec55a9bc5..be4fe4c8f6d 100644
--- a/src/test/ui/coherence/coherence-cow.re_a.stderr
+++ b/src/test/ui/coherence/coherence-cow.re_a.stderr
@@ -4,7 +4,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl<T> Remote for Pair<T,Cover<T>> { }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `lib::Pair<T, Cover<T>>` is not defined in the current create
    = 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..3d248e8b589 100644
--- a/src/test/ui/coherence/coherence-cow.re_b.stderr
+++ b/src/test/ui/coherence/coherence-cow.re_b.stderr
@@ -4,7 +4,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl<T> Remote for Pair<Cover<T>,T> { }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `lib::Pair<Cover<T>, T>` is not defined in the current create
    = 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..e07c21aa915 100644
--- a/src/test/ui/coherence/coherence-cow.re_c.stderr
+++ b/src/test/ui/coherence/coherence-cow.re_c.stderr
@@ -4,7 +4,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl<T,U> Remote for Pair<Cover<T>,U> { }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `lib::Pair<Cover<T>, U>` is not defined in the current create
    = 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.old.stderr b/src/test/ui/coherence/coherence-fundamental-trait-objects.old.stderr
index 2d1247e831e..e96c30bb0d6 100644
--- a/src/test/ui/coherence/coherence-fundamental-trait-objects.old.stderr
+++ b/src/test/ui/coherence/coherence-fundamental-trait-objects.old.stderr
@@ -4,7 +4,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl Misc for dyn Fundamental<Local> {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `(dyn coherence_fundamental_trait_lib::Fundamental<Local> + 'static)` is not defined in the current create
    = 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..e96c30bb0d6 100644
--- a/src/test/ui/coherence/coherence-fundamental-trait-objects.re.stderr
+++ b/src/test/ui/coherence/coherence-fundamental-trait-objects.re.stderr
@@ -4,7 +4,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl Misc for dyn Fundamental<Local> {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `(dyn coherence_fundamental_trait_lib::Fundamental<Local> + 'static)` is not defined in the current create
    = 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..8832203dd55 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
@@ -16,7 +16,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl !Send for dyn Marker2 {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `(dyn Marker2 + 'static)` is not defined in the current create
    = 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..0fe1b933394 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
@@ -16,7 +16,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | unsafe impl Send for dyn Marker2 {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `(dyn Marker2 + 'static)` is not defined in the current create
    = 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..9556e4f8e33 100644
--- a/src/test/ui/coherence/coherence-impls-copy.old.stderr
+++ b/src/test/ui/coherence/coherence-impls-copy.old.stderr
@@ -51,7 +51,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl Copy for i32 {}
    | ^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `i32` is not defined in the current create
    = 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
@@ -60,7 +60,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl Copy for (MyType, MyType) {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `(MyType, MyType)` is not defined in the current create
    = 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
@@ -69,7 +69,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl Copy for [MyType] {}
    | ^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `[MyType]` is not defined in the current create
    = 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
@@ -78,7 +78,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl Copy for &'static [NotSync] {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `&'static [NotSync]` is not defined in the current create
    = 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..d5374aaed01 100644
--- a/src/test/ui/coherence/coherence-impls-copy.re.stderr
+++ b/src/test/ui/coherence/coherence-impls-copy.re.stderr
@@ -51,7 +51,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl Copy for i32 {}
    | ^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `i32` is not defined in the current create
    = 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
@@ -60,7 +60,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl Copy for (MyType, MyType) {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `(MyType, MyType)` is not defined in the current create
    = 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
@@ -69,7 +69,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl Copy for [MyType] {}
    | ^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `[MyType]` is not defined in the current create
    = 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
@@ -78,7 +78,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl Copy for &'static [NotSync] {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `[NotSync]` is not defined in the current create
    = 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..e30b8b11f19 100644
--- a/src/test/ui/coherence/coherence-impls-send.old.stderr
+++ b/src/test/ui/coherence/coherence-impls-send.old.stderr
@@ -4,7 +4,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | unsafe impl Send for (MyType, MyType) {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `(MyType, MyType)` is not defined in the current create
    = 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`
@@ -19,7 +19,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | unsafe impl Send for [MyType] {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `[MyType]` is not defined in the current create
    = 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
@@ -28,7 +28,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | unsafe impl Send for &'static [NotSync] {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `&'static [NotSync]` is not defined in the current create
    = 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..b6ff4b23fd3 100644
--- a/src/test/ui/coherence/coherence-impls-send.re.stderr
+++ b/src/test/ui/coherence/coherence-impls-send.re.stderr
@@ -4,7 +4,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | unsafe impl Send for (MyType, MyType) {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `(MyType, MyType)` is not defined in the current create
    = 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`
@@ -19,7 +19,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | unsafe impl Send for [MyType] {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `[MyType]` is not defined in the current create
    = 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
@@ -28,7 +28,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | unsafe impl Send for &'static [NotSync] {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `[NotSync]` is not defined in the current create
    = 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..a0b025b8a49 100644
--- a/src/test/ui/coherence/coherence-impls-sized.old.stderr
+++ b/src/test/ui/coherence/coherence-impls-sized.old.stderr
@@ -40,7 +40,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl Sized for (MyType, MyType) {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `(MyType, MyType)` is not defined in the current create
    = 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
@@ -49,7 +49,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl Sized for [MyType] {}
    | ^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `[MyType]` is not defined in the current create
    = 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
@@ -58,7 +58,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl Sized for &'static [NotSync] {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `&'static [NotSync]` is not defined in the current create
    = 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..6515b98ba4a 100644
--- a/src/test/ui/coherence/coherence-impls-sized.re.stderr
+++ b/src/test/ui/coherence/coherence-impls-sized.re.stderr
@@ -40,7 +40,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl Sized for (MyType, MyType) {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `(MyType, MyType)` is not defined in the current create
    = 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
@@ -49,7 +49,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl Sized for [MyType] {}
    | ^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `[MyType]` is not defined in the current create
    = 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
@@ -58,7 +58,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl Sized for &'static [NotSync] {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `[NotSync]` is not defined in the current create
    = 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-orphan.old.stderr b/src/test/ui/coherence/coherence-orphan.old.stderr
index e6dc17d95a2..83d1bc2d4ad 100644
--- a/src/test/ui/coherence/coherence-orphan.old.stderr
+++ b/src/test/ui/coherence/coherence-orphan.old.stderr
@@ -4,7 +4,8 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl TheTrait<usize> for isize { }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `isize` is not defined in the current create
+   = note: `usize` is not defined in the current create
    = 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
@@ -13,7 +14,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl !Send for Vec<isize> { }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `std::vec::Vec<isize>` is not defined in the current create
    = 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..83d1bc2d4ad 100644
--- a/src/test/ui/coherence/coherence-orphan.re.stderr
+++ b/src/test/ui/coherence/coherence-orphan.re.stderr
@@ -4,7 +4,8 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl TheTrait<usize> for isize { }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `isize` is not defined in the current create
+   = note: `usize` is not defined in the current create
    = 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
@@ -13,7 +14,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl !Send for Vec<isize> { }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `std::vec::Vec<isize>` is not defined in the current create
    = 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.re.stderr b/src/test/ui/coherence/coherence-overlapping-pairs.re.stderr
index a6fa609deb2..577a9576c9d 100644
--- a/src/test/ui/coherence/coherence-overlapping-pairs.re.stderr
+++ b/src/test/ui/coherence/coherence-overlapping-pairs.re.stderr
@@ -4,7 +4,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl<T> Remote for lib::Pair<T,Foo> { }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `lib::Pair<T, Foo>` is not defined in the current create
    = 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.re.stderr b/src/test/ui/coherence/coherence-pair-covered-uncovered-1.re.stderr
index e45cd78363c..44fb85fba08 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
@@ -4,7 +4,8 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl<T, U> Remote1<Pair<T, Local<U>>> for i32 { }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `i32` is not defined in the current create
+   = note: `lib::Pair<T, Local<U>>` is not defined in the current create
    = 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.re.stderr b/src/test/ui/coherence/coherence-pair-covered-uncovered.re.stderr
index 54d5f3058a8..e42470940b2 100644
--- a/src/test/ui/coherence/coherence-pair-covered-uncovered.re.stderr
+++ b/src/test/ui/coherence/coherence-pair-covered-uncovered.re.stderr
@@ -4,7 +4,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl<T,U> Remote for Pair<T,Local<U>> { }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `lib::Pair<T, Local<U>>` is not defined in the current create
    = 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.re.stderr b/src/test/ui/coherence/coherence-vec-local-2.re.stderr
index 6992aa7a0bd..ef31e1f0b25 100644
--- a/src/test/ui/coherence/coherence-vec-local-2.re.stderr
+++ b/src/test/ui/coherence/coherence-vec-local-2.re.stderr
@@ -4,7 +4,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl<T> Remote for Vec<Local<T>> { }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `std::vec::Vec<Local<T>>` is not defined in the current create
    = 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..cb8ac28fab0 100644
--- a/src/test/ui/coherence/coherence-vec-local.old.stderr
+++ b/src/test/ui/coherence/coherence-vec-local.old.stderr
@@ -4,7 +4,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl Remote for Vec<Local> { }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `std::vec::Vec<Local>` is not defined in the current create
    = 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..cb8ac28fab0 100644
--- a/src/test/ui/coherence/coherence-vec-local.re.stderr
+++ b/src/test/ui/coherence/coherence-vec-local.re.stderr
@@ -4,7 +4,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl Remote for Vec<Local> { }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `std::vec::Vec<Local>` is not defined in the current create
    = 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..818195f1841 100644
--- a/src/test/ui/coherence/coherence_local_err_struct.old.stderr
+++ b/src/test/ui/coherence/coherence_local_err_struct.old.stderr
@@ -4,7 +4,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl lib::MyCopy for lib::MyStruct<MyType> { }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `lib::MyStruct<MyType>` is not defined in the current create
    = 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..818195f1841 100644
--- a/src/test/ui/coherence/coherence_local_err_struct.re.stderr
+++ b/src/test/ui/coherence/coherence_local_err_struct.re.stderr
@@ -4,7 +4,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl lib::MyCopy for lib::MyStruct<MyType> { }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `lib::MyStruct<MyType>` is not defined in the current create
    = 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..aebca9cfacc 100644
--- a/src/test/ui/coherence/coherence_local_err_tuple.old.stderr
+++ b/src/test/ui/coherence/coherence_local_err_tuple.old.stderr
@@ -4,7 +4,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl lib::MyCopy for (MyType,) { }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `(MyType,)` is not defined in the current create
    = 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..aebca9cfacc 100644
--- a/src/test/ui/coherence/coherence_local_err_tuple.re.stderr
+++ b/src/test/ui/coherence/coherence_local_err_tuple.re.stderr
@@ -4,7 +4,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl lib::MyCopy for (MyType,) { }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `(MyType,)` is not defined in the current create
    = 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[foreign]-for-foreign.stderr b/src/test/ui/coherence/impl-foreign[foreign]-for-foreign.stderr
index 04e96f29230..cfd46855289 100644
--- a/src/test/ui/coherence/impl-foreign[foreign]-for-foreign.stderr
+++ b/src/test/ui/coherence/impl-foreign[foreign]-for-foreign.stderr
@@ -4,7 +4,8 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl Remote1<u32> for f64 {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `f64` is not defined in the current create
+   = note: `u32` is not defined in the current create
    = note: define and implement a trait or new type instead
 
 error: aborting due to previous error
diff --git a/src/test/ui/dropck/drop-on-non-struct.stderr b/src/test/ui/dropck/drop-on-non-struct.stderr
index 6ff16402b0e..334adb27fda 100644
--- a/src/test/ui/dropck/drop-on-non-struct.stderr
+++ b/src/test/ui/dropck/drop-on-non-struct.stderr
@@ -10,7 +10,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl<'a> Drop for &'a mut isize {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `&'a mut isize` is not defined in the current create
    = 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..ecd0c152f28 100644
--- a/src/test/ui/error-codes/E0117.stderr
+++ b/src/test/ui/error-codes/E0117.stderr
@@ -10,7 +10,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl Drop for u32 {}
    | ^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `u32` is not defined in the current create
    = 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..322fdd9f11d 100644
--- a/src/test/ui/error-codes/E0206.stderr
+++ b/src/test/ui/error-codes/E0206.stderr
@@ -16,7 +16,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl Copy for Foo { }
    | ^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `[u8; _]` is not defined in the current create
    = note: define and implement a trait or new type instead
 
 error: aborting due to 3 previous errors
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..42d6792d0d0 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
@@ -4,7 +4,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl DefaultedTrait for (A,) { }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `(A,)` is not defined in the current create
    = 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
@@ -13,7 +13,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl !DefaultedTrait for (B,) { }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `(B,)` is not defined in the current create
    = 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
@@ -28,7 +28,7 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
 LL | impl DefaultedTrait for lib::Something<C> { }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
    |
-   = note: the impl does not reference only types defined in this crate
+   = note: `lib::Something<C>` is not defined in the current create
    = note: define and implement a trait or new type instead
 
 error: aborting due to 4 previous errors