mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Call def_span inside span_if_local.
This commit is contained in:
parent
16f9f7c7b1
commit
df59705301
@ -1012,7 +1012,7 @@ impl<'hir> Map<'hir> {
|
||||
}
|
||||
|
||||
pub fn span_if_local(self, id: DefId) -> Option<Span> {
|
||||
id.as_local().and_then(|id| self.opt_span(self.local_def_id_to_hir_id(id)))
|
||||
if id.is_local() { Some(self.tcx.def_span(id)) } else { None }
|
||||
}
|
||||
|
||||
pub fn res_span(self, res: Res) -> Option<Span> {
|
||||
|
@ -121,7 +121,11 @@ pub fn provide(providers: &mut Providers) {
|
||||
providers.hir_attrs =
|
||||
|tcx, id| tcx.hir_crate(()).owners[id].as_owner().map_or(AttributeMap::EMPTY, |o| &o.attrs);
|
||||
providers.source_span = |tcx, def_id| tcx.resolutions(()).definitions.def_span(def_id);
|
||||
providers.def_span = |tcx, def_id| tcx.hir().span_if_local(def_id).unwrap_or(DUMMY_SP);
|
||||
providers.def_span = |tcx, def_id| {
|
||||
let def_id = def_id.expect_local();
|
||||
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
|
||||
tcx.hir().opt_span(hir_id).unwrap_or(DUMMY_SP)
|
||||
};
|
||||
providers.def_ident_span = |tcx, def_id| {
|
||||
let def_id = def_id.expect_local();
|
||||
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
|
||||
|
Loading…
Reference in New Issue
Block a user