Skip to content

Commit 56aa89c

Browse files
committed
Further tweak spans for better readability
1 parent 9b4f811 commit 56aa89c

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

src/librustc_typeck/coherence/orphan.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ impl ItemLikeVisitor<'v> for OrphanChecker<'tcx> {
2424
fn visit_item(&mut self, item: &hir::Item) {
2525
let def_id = self.tcx.hir().local_def_id(item.hir_id);
2626
// "Trait" impl
27-
if let hir::ItemKind::Impl(.., generics, Some(_), impl_ty, _) = &item.kind {
27+
if let hir::ItemKind::Impl(.., generics, Some(tr), impl_ty, _) = &item.kind {
2828
debug!("coherence2::orphan check: trait impl {}",
2929
self.tcx.hir().node_to_string(item.hir_id));
3030
let trait_ref = self.tcx.impl_trait_ref(def_id).unwrap();
@@ -47,7 +47,7 @@ impl ItemLikeVisitor<'v> for OrphanChecker<'tcx> {
4747
if *i == 0 {
4848
err.span_label(impl_ty.span, &msg);
4949
} else {
50-
err.note(&msg);
50+
err.span_label(tr.path.span, &msg);
5151
}
5252
}
5353
err.note("define and implement a trait or new type instead");

src/test/ui/coherence/coherence-orphan.old.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
22
--> $DIR/coherence-orphan.rs:13:1
33
|
44
LL | impl TheTrait<usize> for isize { }
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^-----
6-
| | |
7-
| | `isize` is not defined in the current crate
5+
| ^^^^^---------------^^^^^-----
6+
| | | |
7+
| | | `isize` is not defined in the current crate
8+
| | `usize` is not defined in the current crate
89
| impl doesn't use only types from inside the current crate
910
|
10-
= note: `usize` is not defined in the current crate
1111
= note: define and implement a trait or new type instead
1212

1313
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types

src/test/ui/coherence/coherence-orphan.re.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
22
--> $DIR/coherence-orphan.rs:13:1
33
|
44
LL | impl TheTrait<usize> for isize { }
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^-----
6-
| | |
7-
| | `isize` is not defined in the current crate
5+
| ^^^^^---------------^^^^^-----
6+
| | | |
7+
| | | `isize` is not defined in the current crate
8+
| | `usize` is not defined in the current crate
89
| impl doesn't use only types from inside the current crate
910
|
10-
= note: `usize` is not defined in the current crate
1111
= note: define and implement a trait or new type instead
1212

1313
error[E0117]: only traits defined in the current crate can be implemented for arbitrary types

src/test/ui/coherence/coherence-pair-covered-uncovered-1.re.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
22
--> $DIR/coherence-pair-covered-uncovered-1.rs:15:1
33
|
44
LL | impl<T, U> Remote1<Pair<T, Local<U>>> for i32 { }
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
6-
| | |
7-
| | `i32` is not defined in the current crate
5+
| ^^^^^^^^^^^--------------------------^^^^^---
6+
| | | |
7+
| | | `i32` is not defined in the current crate
8+
| | `lib::Pair<T, Local<U>>` is not defined in the current crate
89
| impl doesn't use only types from inside the current crate
910
|
10-
= note: `lib::Pair<T, Local<U>>` is not defined in the current crate
1111
= note: define and implement a trait or new type instead
1212

1313
error: aborting due to previous error

src/test/ui/coherence/impl-foreign[foreign]-for-foreign.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ error[E0117]: only traits defined in the current crate can be implemented for ar
22
--> $DIR/impl-foreign[foreign]-for-foreign.rs:12:1
33
|
44
LL | impl Remote1<u32> for f64 {
5-
| ^^^^^^^^^^^^^^^^^^^^^^---
6-
| | |
7-
| | `f64` is not defined in the current crate
5+
| ^^^^^------------^^^^^---
6+
| | | |
7+
| | | `f64` is not defined in the current crate
8+
| | `u32` is not defined in the current crate
89
| impl doesn't use only types from inside the current crate
910
|
10-
= note: `u32` is not defined in the current crate
1111
= note: define and implement a trait or new type instead
1212

1313
error: aborting due to previous error

0 commit comments

Comments
 (0)