Skip to content

Commit f13d8dc

Browse files
committed
Use better span when possible
1 parent 05685bd commit f13d8dc

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/librustc_mir/shim.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,13 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> {
341341
let substs = tcx.mk_substs_trait(self_ty, &[]);
342342
let sig = tcx.fn_sig(def_id).subst(tcx, substs);
343343
let sig = tcx.erase_late_bound_regions(&sig);
344-
let span = tcx.def_span(def_id);
344+
let span_def_id = if let Some(did) = self_ty.ty_to_def_id() {
345+
did
346+
} else {
347+
def_id
348+
};
349+
350+
let span = tcx.def_span(span_def_id);
345351

346352
CloneShimBuilder {
347353
tcx,

0 commit comments

Comments
 (0)