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::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