about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-10-28 11:26:48 +0000
committerbors <bors@rust-lang.org>2015-10-28 11:26:48 +0000
commit7e3c8cf17cb069f3178b0927cea2caae06a9f89a (patch)
treeb40b1b72950017733ffa2ba175eb0601cdb96cac /src
parent18ff06ecc1cf4dae9d96c84be9320dfe8f95f491 (diff)
parent6c094b9df901f39da59d7f3237e893671f880032 (diff)
downloadrust-7e3c8cf17cb069f3178b0927cea2caae06a9f89a.tar.gz
rust-7e3c8cf17cb069f3178b0927cea2caae06a9f89a.zip
Auto merge of #29404 - jonas-schievink:external-overlap-print, r=Aatch
This makes the error message in #28981 a bit shorter (152 to 115 lines).

Previous output (the local impl was always printed twice when it conflicted with an external impl):
```
test.rs:3:1: 3:23 error: conflicting implementations for trait `core::ops::Deref` [E0119]
test.rs:3 impl<T> Deref for T {}
          ^~~~~~~~~~~~~~~~~~~~~~
test.rs:3:1: 3:23 help: run `rustc --explain E0119` to see a detailed explanation
test.rs:3:1: 3:23 note: conflicting implementation in crate `std`
test.rs:3 impl<T> Deref for T {}
          ^~~~~~~~~~~~~~~~~~~~~~
```

Output after this patch:
```
test.rs:3:1: 3:23 error: conflicting implementations for trait `core::ops::Deref` [E0119]
test.rs:3 impl<T> Deref for T {}
          ^~~~~~~~~~~~~~~~~~~~~~
test.rs:3:1: 3:23 help: run `rustc --explain E0119` to see a detailed explanation
note: conflicting implementation in crate `std`
```
Diffstat (limited to 'src')
-rw-r--r--src/librustc_typeck/coherence/overlap.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/librustc_typeck/coherence/overlap.rs b/src/librustc_typeck/coherence/overlap.rs
index 706f28f9fe4..54dfd01c92b 100644
--- a/src/librustc_typeck/coherence/overlap.rs
+++ b/src/librustc_typeck/coherence/overlap.rs
@@ -147,10 +147,10 @@ impl<'cx, 'tcx> OverlapChecker<'cx, 'tcx> {
                   "conflicting implementations for trait `{}`",
                   self.tcx.item_path_str(trait_def_id));
 
-        self.report_overlap_note(impl1, impl2);
+        self.report_overlap_note(impl2);
     }
 
-    fn report_overlap_note(&self, impl1: DefId, impl2: DefId) {
+    fn report_overlap_note(&self, impl2: DefId) {
 
         if impl2.is_local() {
             span_note!(self.tcx.sess, self.span_of_impl(impl2),
@@ -158,9 +158,7 @@ impl<'cx, 'tcx> OverlapChecker<'cx, 'tcx> {
         } else {
             let crate_store = &self.tcx.sess.cstore;
             let cdata = crate_store.get_crate_data(impl2.krate);
-            span_note!(self.tcx.sess, self.span_of_impl(impl1),
-                       "conflicting implementation in crate `{}`",
-                       cdata.name);
+            self.tcx.sess.note(&format!("conflicting implementation in crate `{}`", cdata.name));
         }
     }