about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2017-11-26 12:37:13 -0800
committerEsteban Küber <esteban@kuber.com.ar>2017-11-27 06:00:20 -0800
commit8a93deca9a41e7c185b96ca55f132b18d7e22f3a (patch)
tree22a10871ee89fc2dce759320e5e1467a249128d2
parent0b2d21e32b40dfc25f09db5a12864d060ac1070a (diff)
downloadrust-8a93deca9a41e7c185b96ca55f132b18d7e22f3a.tar.gz
rust-8a93deca9a41e7c185b96ca55f132b18d7e22f3a.zip
Make main span in impl-trait ciclic reference point to def_span
-rw-r--r--src/librustc/ty/maps/plumbing.rs1
-rw-r--r--src/test/ui/impl-trait/auto-trait-leak.stderr10
2 files changed, 3 insertions, 8 deletions
diff --git a/src/librustc/ty/maps/plumbing.rs b/src/librustc/ty/maps/plumbing.rs
index 3440282db2d..e292862faa0 100644
--- a/src/librustc/ty/maps/plumbing.rs
+++ b/src/librustc/ty/maps/plumbing.rs
@@ -81,6 +81,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
         // (And cycle errors around impls tend to occur during the
         // collect/coherence phases anyhow.)
         item_path::with_forced_impl_filename_line(|| {
+            let span = self.sess.codemap().def_span(span);
             let mut err =
                 struct_span_err!(self.sess, span, E0391,
                                  "unsupported cyclic reference between types/traits detected");
diff --git a/src/test/ui/impl-trait/auto-trait-leak.stderr b/src/test/ui/impl-trait/auto-trait-leak.stderr
index ac5c79be6a9..1c03e9d8526 100644
--- a/src/test/ui/impl-trait/auto-trait-leak.stderr
+++ b/src/test/ui/impl-trait/auto-trait-leak.stderr
@@ -23,14 +23,8 @@ error[E0277]: the trait bound `std::rc::Rc<std::cell::Cell<i32>>: std::marker::S
 error[E0391]: unsupported cyclic reference between types/traits detected
   --> $DIR/auto-trait-leak.rs:52:1
    |
-52 | / fn cycle1() -> impl Clone {
-53 | |     //~^ ERROR unsupported cyclic reference between types/traits detected
-54 | |     //~| cyclic reference
-55 | |     //~| NOTE the cycle begins when processing `cycle1`...
-...  |
-60 | |     Rc::new(Cell::new(5))
-61 | | }
-   | |_^ cyclic reference
+52 | fn cycle1() -> impl Clone {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^ cyclic reference
    |
 note: the cycle begins when processing `cycle1`...
   --> $DIR/auto-trait-leak.rs:52:1