about summary refs log tree commit diff
path: root/src/librustc/traits/specialize
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2017-12-17 23:46:55 -0800
committerEsteban Küber <esteban@kuber.com.ar>2017-12-17 23:46:55 -0800
commitea64ab7d4eea9b5ba89b21eeed4ad897ff6a2ded (patch)
tree0cafc309cbf87d13ddd3ddbd842a4ce4f0db231a /src/librustc/traits/specialize
parent3cc68bac7c89a81ec83cbd8f0aff9db001425c50 (diff)
downloadrust-ea64ab7d4eea9b5ba89b21eeed4ad897ff6a2ded.tar.gz
rust-ea64ab7d4eea9b5ba89b21eeed4ad897ff6a2ded.zip
Use def span for conflicting impls and recursive fn
Diffstat (limited to 'src/librustc/traits/specialize')
-rw-r--r--src/librustc/traits/specialize/mod.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/librustc/traits/specialize/mod.rs b/src/librustc/traits/specialize/mod.rs
index 6a96d01d5f9..afe29cc0e7b 100644
--- a/src/librustc/traits/specialize/mod.rs
+++ b/src/librustc/traits/specialize/mod.rs
@@ -341,15 +341,18 @@ pub(super) fn specialization_graph_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx
                         }),
                     if used_to_be_allowed { " (E0119)" } else { "" }
                 );
+                let impl_span = tcx.sess.codemap().def_span(
+                    tcx.span_of_impl(impl_def_id).unwrap()
+                );
                 let mut err = if used_to_be_allowed {
                     tcx.struct_span_lint_node(
                         lint::builtin::INCOHERENT_FUNDAMENTAL_IMPLS,
                         tcx.hir.as_local_node_id(impl_def_id).unwrap(),
-                        tcx.span_of_impl(impl_def_id).unwrap(),
+                        impl_span,
                         &msg)
                 } else {
                     struct_span_err!(tcx.sess,
-                                     tcx.span_of_impl(impl_def_id).unwrap(),
+                                     impl_span,
                                      E0119,
                                      "{}",
                                      msg)
@@ -357,8 +360,9 @@ pub(super) fn specialization_graph_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx
 
                 match tcx.span_of_impl(overlap.with_impl) {
                     Ok(span) => {
-                        err.span_label(span, format!("first implementation here"));
-                        err.span_label(tcx.span_of_impl(impl_def_id).unwrap(),
+                        err.span_label(tcx.sess.codemap().def_span(span),
+                                       format!("first implementation here"));
+                        err.span_label(impl_span,
                                        format!("conflicting implementation{}",
                                                 overlap.self_desc
                                                     .map_or(String::new(),