]> git.proxmox.com Git - rustc.git/blobdiff - src/librustc_typeck/coherence/overlap.rs
New upstream version 1.12.0+dfsg1
[rustc.git] / src / librustc_typeck / coherence / overlap.rs
index dcaa5cfb20a46ff73a8c8f3509ec0bce51be717d..46a9ef8d5babb0edcc4fe4de4e44894e41910425 100644 (file)
@@ -13,7 +13,7 @@
 //! constructor provide a method with the same name.
 
 use hir::def_id::DefId;
-use rustc::traits::{self, ProjectionMode};
+use rustc::traits::{self, Reveal};
 use rustc::ty::{self, TyCtxt};
 use syntax::ast;
 use rustc::dep_graph::DepNode;
@@ -84,7 +84,7 @@ impl<'cx, 'tcx> OverlapChecker<'cx, 'tcx> {
 
         for (i, &impl1_def_id) in impls.iter().enumerate() {
             for &impl2_def_id in &impls[(i+1)..] {
-                self.tcx.infer_ctxt(None, None, ProjectionMode::Topmost).enter(|infcx| {
+                self.tcx.infer_ctxt(None, None, Reveal::ExactMatch).enter(|infcx| {
                     if traits::overlapping_impls(&infcx, impl1_def_id, impl2_def_id).is_some() {
                         self.check_for_common_items_in_impls(impl1_def_id, impl2_def_id)
                     }
@@ -141,12 +141,18 @@ impl<'cx, 'tcx,'v> intravisit::Visitor<'v> for OverlapChecker<'cx, 'tcx> {
                         self.tcx.sess, self.tcx.span_of_impl(impl_def_id).unwrap(), E0119,
                         "conflicting implementations of trait `{}`{}:",
                         overlap.trait_desc,
-                        overlap.self_desc.map_or(String::new(),
-                                                 |ty| format!(" for type `{}`", ty)));
+                        overlap.self_desc.clone().map_or(String::new(),
+                                                         |ty| format!(" for type `{}`", ty)));
 
                     match self.tcx.span_of_impl(overlap.with_impl) {
                         Ok(span) => {
-                            err.span_note(span, "conflicting implementation is here:");
+                            err.span_label(span,
+                                           &format!("first implementation here"));
+                            err.span_label(self.tcx.span_of_impl(impl_def_id).unwrap(),
+                                           &format!("conflicting implementation{}",
+                                                    overlap.self_desc
+                                                        .map_or(String::new(),
+                                                                |ty| format!(" for `{}`", ty))));
                         }
                         Err(cname) => {
                             err.note(&format!("conflicting implementation in crate `{}`",