1
Fork 0

Implement def_ident_span in rustc_middle.

This commit is contained in:
Camille GILLOT 2022-04-08 18:53:16 +02:00
parent c3384ea35c
commit 16f9f7c7b1
3 changed files with 29 additions and 34 deletions

View file

@ -122,6 +122,11 @@ pub fn provide(providers: &mut Providers) {
|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_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);
tcx.hir().opt_ident_span(hir_id)
};
providers.fn_arg_names = |tcx, id| {
let hir = tcx.hir();
let hir_id = hir.local_def_id_to_hir_id(id.expect_local());