Skip to content

Commit

Permalink
Make main span in impl-trait ciclic reference point to def_span
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Nov 27, 2017
1 parent 0b2d21e commit 8a93dec
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/librustc/ty/maps/plumbing.rs
Expand Up @@ -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");
Expand Down
10 changes: 2 additions & 8 deletions src/test/ui/impl-trait/auto-trait-leak.stderr
Expand Up @@ -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
Expand Down

0 comments on commit 8a93dec

Please sign in to comment.