Skip to content

Commit 7e3c8cf

Browse files
committed
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` ```
2 parents 18ff06e + 6c094b9 commit 7e3c8cf

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/librustc_typeck/coherence/overlap.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -147,20 +147,18 @@ impl<'cx, 'tcx> OverlapChecker<'cx, 'tcx> {
147147
"conflicting implementations for trait `{}`",
148148
self.tcx.item_path_str(trait_def_id));
149149

150-
self.report_overlap_note(impl1, impl2);
150+
self.report_overlap_note(impl2);
151151
}
152152

153-
fn report_overlap_note(&self, impl1: DefId, impl2: DefId) {
153+
fn report_overlap_note(&self, impl2: DefId) {
154154

155155
if impl2.is_local() {
156156
span_note!(self.tcx.sess, self.span_of_impl(impl2),
157157
"note conflicting implementation here");
158158
} else {
159159
let crate_store = &self.tcx.sess.cstore;
160160
let cdata = crate_store.get_crate_data(impl2.krate);
161-
span_note!(self.tcx.sess, self.span_of_impl(impl1),
162-
"conflicting implementation in crate `{}`",
163-
cdata.name);
161+
self.tcx.sess.note(&format!("conflicting implementation in crate `{}`", cdata.name));
164162
}
165163
}
166164

0 commit comments

Comments
 (0)