From 56aa89cdbec7d020dbeff76d0a2f6d0f28a1c12f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sat, 12 Oct 2019 14:44:16 -0700 Subject: [PATCH] Further tweak spans for better readability --- src/librustc_typeck/coherence/orphan.rs | 4 ++-- src/test/ui/coherence/coherence-orphan.old.stderr | 8 ++++---- src/test/ui/coherence/coherence-orphan.re.stderr | 8 ++++---- .../coherence-pair-covered-uncovered-1.re.stderr | 8 ++++---- .../ui/coherence/impl-foreign[foreign]-for-foreign.stderr | 8 ++++---- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/librustc_typeck/coherence/orphan.rs b/src/librustc_typeck/coherence/orphan.rs index 3bcea6d173aa..7024927bf8df 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(.., generics, Some(_), impl_ty, _) = &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(); @@ -47,7 +47,7 @@ impl ItemLikeVisitor<'v> for OrphanChecker<'tcx> { if *i == 0 { err.span_label(impl_ty.span, &msg); } else { - err.note(&msg); + err.span_label(tr.path.span, &msg); } } err.note("define and implement a trait or new type instead"); diff --git a/src/test/ui/coherence/coherence-orphan.old.stderr b/src/test/ui/coherence/coherence-orphan.old.stderr index 3594224abac4..8d3605983179 100644 --- a/src/test/ui/coherence/coherence-orphan.old.stderr +++ b/src/test/ui/coherence/coherence-orphan.old.stderr @@ -2,12 +2,12 @@ error[E0117]: only traits defined in the current crate can be implemented for ar --> $DIR/coherence-orphan.rs:13:1 | LL | impl TheTrait for isize { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^----- - | | | - | | `isize` is not defined in the current 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: `usize` is not defined in the current 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 diff --git a/src/test/ui/coherence/coherence-orphan.re.stderr b/src/test/ui/coherence/coherence-orphan.re.stderr index 3594224abac4..8d3605983179 100644 --- a/src/test/ui/coherence/coherence-orphan.re.stderr +++ b/src/test/ui/coherence/coherence-orphan.re.stderr @@ -2,12 +2,12 @@ error[E0117]: only traits defined in the current crate can be implemented for ar --> $DIR/coherence-orphan.rs:13:1 | LL | impl TheTrait for isize { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^----- - | | | - | | `isize` is not defined in the current 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: `usize` is not defined in the current 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 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 3af9d93833d2..db9989c66649 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,12 +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 Remote1>> for i32 { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--- - | | | - | | `i32` is not defined in the current 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: `lib::Pair>` is not defined in the current 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[foreign]-for-foreign.stderr b/src/test/ui/coherence/impl-foreign[foreign]-for-foreign.stderr index 0a36f7cf3c69..07c7632a53ff 100644 --- a/src/test/ui/coherence/impl-foreign[foreign]-for-foreign.stderr +++ b/src/test/ui/coherence/impl-foreign[foreign]-for-foreign.stderr @@ -2,12 +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 for f64 { - | ^^^^^^^^^^^^^^^^^^^^^^--- - | | | - | | `f64` is not defined in the current 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: `u32` is not defined in the current crate = note: define and implement a trait or new type instead error: aborting due to previous error