|
11 | 11 | use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
|
12 | 12 | use rustc::hir;
|
13 | 13 | use rustc::hir::itemlikevisit::ItemLikeVisitor;
|
14 |
| -use rustc::lint; |
15 | 14 | use rustc::traits::{self, Reveal};
|
16 | 15 | use rustc::ty::{self, TyCtxt};
|
17 | 16 |
|
@@ -53,12 +52,16 @@ impl<'a, 'tcx> InherentOverlapChecker<'a, 'tcx> {
|
53 | 52 |
|
54 | 53 | for &item2 in &impl_items2[..] {
|
55 | 54 | if (name, namespace) == name_and_namespace(item2) {
|
56 |
| - let msg = format!("duplicate definitions with name `{}`", name); |
57 |
| - let node_id = self.tcx.hir.as_local_node_id(item1).unwrap(); |
58 |
| - self.tcx.sess.add_lint(lint::builtin::OVERLAPPING_INHERENT_IMPLS, |
59 |
| - node_id, |
60 |
| - self.tcx.span_of_impl(item1).unwrap(), |
61 |
| - msg); |
| 55 | + struct_span_err!(self.tcx.sess, |
| 56 | + self.tcx.span_of_impl(item1).unwrap(), |
| 57 | + E0592, |
| 58 | + "duplicate definitions with name `{}`", |
| 59 | + name) |
| 60 | + .span_label(self.tcx.span_of_impl(item1).unwrap(), |
| 61 | + &format!("duplicate definitions for `{}`", name)) |
| 62 | + .span_label(self.tcx.span_of_impl(item2).unwrap(), |
| 63 | + &format!("other definition for `{}`", name)) |
| 64 | + .emit(); |
62 | 65 | }
|
63 | 66 | }
|
64 | 67 | }
|
|
0 commit comments