Make main span in impl-trait ciclic reference point to def_span

This commit is contained in:
Esteban Küber 2017-11-26 12:37:13 -08:00
parent 0b2d21e32b
commit 8a93deca9a
2 changed files with 3 additions and 8 deletions

View File

@ -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");

View File

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