Further tweak spans for better readability

This commit is contained in:
Esteban Küber 2019-10-12 14:44:16 -07:00
parent 9b4f811b7f
commit 56aa89cdbe
5 changed files with 18 additions and 18 deletions

View File

@ -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");

View File

@ -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<usize> 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

View File

@ -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<usize> 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

View File

@ -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<T, U> Remote1<Pair<T, Local<U>>> for i32 { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
| | |
| | `i32` is not defined in the current crate
| ^^^^^^^^^^^--------------------------^^^^^---
| | | |
| | | `i32` is not defined in the current crate
| | `lib::Pair<T, Local<U>>` is not defined in the current crate
| impl doesn't use only types from inside the current crate
|
= note: `lib::Pair<T, Local<U>>` is not defined in the current crate
= note: define and implement a trait or new type instead
error: aborting due to previous error

View File

@ -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<u32> 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