Skip to content

Commit 8a93dec

Browse files
committed
Make main span in impl-trait ciclic reference point to def_span
1 parent 0b2d21e commit 8a93dec

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

src/librustc/ty/maps/plumbing.rs

+1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
8181
// (And cycle errors around impls tend to occur during the
8282
// collect/coherence phases anyhow.)
8383
item_path::with_forced_impl_filename_line(|| {
84+
let span = self.sess.codemap().def_span(span);
8485
let mut err =
8586
struct_span_err!(self.sess, span, E0391,
8687
"unsupported cyclic reference between types/traits detected");

src/test/ui/impl-trait/auto-trait-leak.stderr

+2-8
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,8 @@ error[E0277]: the trait bound `std::rc::Rc<std::cell::Cell<i32>>: std::marker::S
2323
error[E0391]: unsupported cyclic reference between types/traits detected
2424
--> $DIR/auto-trait-leak.rs:52:1
2525
|
26-
52 | / fn cycle1() -> impl Clone {
27-
53 | | //~^ ERROR unsupported cyclic reference between types/traits detected
28-
54 | | //~| cyclic reference
29-
55 | | //~| NOTE the cycle begins when processing `cycle1`...
30-
... |
31-
60 | | Rc::new(Cell::new(5))
32-
61 | | }
33-
| |_^ cyclic reference
26+
52 | fn cycle1() -> impl Clone {
27+
| ^^^^^^^^^^^^^^^^^^^^^^^^^ cyclic reference
3428
|
3529
note: the cycle begins when processing `cycle1`...
3630
--> $DIR/auto-trait-leak.rs:52:1

0 commit comments

Comments
 (0)