Rollup merge of #139461 - compiler-errors:significant-drop-span, r=oli-obk
Stop calling `source_span` query in significant drop order code `source_span` is only meant for incremental tracking. I don't really think we need to highlight the whole drop impl span anyways; it can be quite large. r? oli-obk
This commit is contained in:
commit
0178254f46
7 changed files with 100 additions and 280 deletions
|
@ -143,25 +143,11 @@ pub fn ty_dtor_span<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Option<Span> {
|
|||
| ty::UnsafeBinder(_) => None,
|
||||
|
||||
ty::Adt(adt_def, _) => {
|
||||
let did = adt_def.did();
|
||||
let try_local_did_span = |did: DefId| {
|
||||
if let Some(local) = did.as_local() {
|
||||
tcx.source_span(local)
|
||||
} else {
|
||||
tcx.def_span(did)
|
||||
}
|
||||
};
|
||||
let dtor = if let Some(dtor) = tcx.adt_destructor(did) {
|
||||
dtor.did
|
||||
} else if let Some(dtor) = tcx.adt_async_destructor(did) {
|
||||
return Some(tcx.source_span(dtor.impl_did));
|
||||
if let Some(dtor) = tcx.adt_destructor(adt_def.did()) {
|
||||
Some(tcx.def_span(tcx.parent(dtor.did)))
|
||||
} else {
|
||||
return Some(try_local_did_span(did));
|
||||
};
|
||||
let def_key = tcx.def_key(dtor);
|
||||
let Some(parent_index) = def_key.parent else { return Some(try_local_did_span(dtor)) };
|
||||
let parent_did = DefId { index: parent_index, krate: dtor.krate };
|
||||
Some(try_local_did_span(parent_did))
|
||||
Some(tcx.def_span(adt_def.did()))
|
||||
}
|
||||
}
|
||||
ty::Coroutine(did, _)
|
||||
| ty::CoroutineWitness(did, _)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue