Rename local_did to def_id
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
This commit is contained in:
parent
25bdc8965e
commit
16513d689e
@ -328,7 +328,7 @@ fn post(&self, s: &mut pprust_hir::State<'_>, node: pprust_hir::AnnNode<'_>) {
|
||||
let typeck_results = self.maybe_typeck_results.get().or_else(|| {
|
||||
self.tcx
|
||||
.hir()
|
||||
.maybe_body_owned_by(self.tcx.hir().local_def_id(expr.hir_id))
|
||||
.maybe_body_owned_by(expr.hir_id.owner)
|
||||
.map(|body_id| self.tcx.typeck_body(body_id))
|
||||
});
|
||||
|
||||
|
@ -49,8 +49,8 @@ pub fn find_param_with_region<'tcx>(
|
||||
};
|
||||
|
||||
let hir = &tcx.hir();
|
||||
let local_did = id.as_local()?;
|
||||
let hir_id = hir.local_def_id_to_hir_id(local_did);
|
||||
let def_id = id.as_local()?;
|
||||
let hir_id = hir.local_def_id_to_hir_id(def_id);
|
||||
|
||||
// FIXME: use def_kind
|
||||
// Don't perform this on closures
|
||||
@ -61,7 +61,7 @@ pub fn find_param_with_region<'tcx>(
|
||||
_ => {}
|
||||
}
|
||||
|
||||
let body_id = hir.maybe_body_owned_by(local_did)?;
|
||||
let body_id = hir.maybe_body_owned_by(def_id)?;
|
||||
|
||||
let owner_id = hir.body_owner(body_id);
|
||||
let fn_decl = hir.fn_decl_by_hir_id(owner_id).unwrap();
|
||||
|
@ -1614,16 +1614,16 @@ fn encode_info_for_closure(&mut self, hir_id: hir::HirId) {
|
||||
}
|
||||
|
||||
fn encode_info_for_anon_const(&mut self, id: hir::HirId) {
|
||||
let local_did = self.tcx.hir().local_def_id(id);
|
||||
debug!("EncodeContext::encode_info_for_anon_const({:?})", local_did);
|
||||
let body_id = self.tcx.hir().body_owned_by(local_did);
|
||||
let def_id = self.tcx.hir().local_def_id(id);
|
||||
debug!("EncodeContext::encode_info_for_anon_const({:?})", def_id);
|
||||
let body_id = self.tcx.hir().body_owned_by(def_id);
|
||||
let const_data = self.encode_rendered_const_for_body(body_id);
|
||||
let qualifs = self.tcx.mir_const_qualif(local_did);
|
||||
let qualifs = self.tcx.mir_const_qualif(def_id);
|
||||
|
||||
record!(self.tables.kind[local_did.to_def_id()] <- EntryKind::AnonConst);
|
||||
record!(self.tables.mir_const_qualif[local_did.to_def_id()] <- qualifs);
|
||||
record!(self.tables.rendered_const[local_did.to_def_id()] <- const_data);
|
||||
self.encode_item_type(local_did.to_def_id());
|
||||
record!(self.tables.kind[def_id.to_def_id()] <- EntryKind::AnonConst);
|
||||
record!(self.tables.mir_const_qualif[def_id.to_def_id()] <- qualifs);
|
||||
record!(self.tables.rendered_const[def_id.to_def_id()] <- const_data);
|
||||
self.encode_item_type(def_id.to_def_id());
|
||||
}
|
||||
|
||||
fn encode_native_libraries(&mut self) -> LazyArray<NativeLib> {
|
||||
|
@ -157,9 +157,9 @@ pub fn provide(providers: &mut Providers) {
|
||||
};
|
||||
providers.fn_arg_names = |tcx, id| {
|
||||
let hir = tcx.hir();
|
||||
let local_did = id.expect_local();
|
||||
let hir_id = hir.local_def_id_to_hir_id(local_did);
|
||||
if let Some(body_id) = hir.maybe_body_owned_by(local_did) {
|
||||
let def_id = id.expect_local();
|
||||
let hir_id = hir.local_def_id_to_hir_id(def_id);
|
||||
if let Some(body_id) = hir.maybe_body_owned_by(def_id) {
|
||||
tcx.arena.alloc_from_iter(hir.body_param_names(body_id))
|
||||
} else if let Node::TraitItem(&TraitItem {
|
||||
kind: TraitItemKind::Fn(_, TraitFn::Required(idents)),
|
||||
|
@ -26,7 +26,7 @@
|
||||
pub(crate) fn check_match(tcx: TyCtxt<'_>, def_id: DefId) {
|
||||
let body_id = match def_id.as_local() {
|
||||
None => return,
|
||||
Some(did) => tcx.hir().body_owned_by(did),
|
||||
Some(def_id) => tcx.hir().body_owned_by(def_id),
|
||||
};
|
||||
|
||||
let pattern_arena = TypedArena::default();
|
||||
|
@ -15,8 +15,8 @@ pub fn provide(providers: &mut Providers) {
|
||||
return None;
|
||||
}
|
||||
|
||||
let local_did = def_id.expect_local();
|
||||
let body = tcx.hir().body(tcx.hir().maybe_body_owned_by(local_did)?);
|
||||
let local_def_id = def_id.expect_local();
|
||||
let body = tcx.hir().body(tcx.hir().maybe_body_owned_by(local_def_id)?);
|
||||
|
||||
let mut local_collector = LocalCollector::default();
|
||||
local_collector.visit_body(body);
|
||||
|
@ -1783,7 +1783,7 @@ fn maybe_note_obligation_cause_for_async_await(
|
||||
|
||||
let generator_body = generator_did
|
||||
.as_local()
|
||||
.and_then(|local_did| hir.maybe_body_owned_by(local_did))
|
||||
.and_then(|def_id| hir.maybe_body_owned_by(def_id))
|
||||
.map(|body_id| hir.body(body_id));
|
||||
let is_async = match generator_did.as_local() {
|
||||
Some(_) => generator_body
|
||||
|
@ -207,10 +207,14 @@ fn param_env(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamEnv<'_> {
|
||||
constness,
|
||||
);
|
||||
|
||||
let body_id = local_did
|
||||
.and_then(|id| tcx.hir().maybe_body_owned_by(id).map(|body| body.hir_id))
|
||||
.or(hir_id)
|
||||
.map_or(hir::CRATE_HIR_ID, |did| did);
|
||||
let body_id =
|
||||
local_did.and_then(|id| tcx.hir().maybe_body_owned_by(id).map(|body| body.hir_id));
|
||||
let body_id = match body_id {
|
||||
Some(id) => id,
|
||||
None if hir_id.is_some() => hir_id.unwrap(),
|
||||
_ => hir::CRATE_HIR_ID,
|
||||
};
|
||||
|
||||
let cause = traits::ObligationCause::misc(tcx.def_span(def_id), body_id);
|
||||
traits::normalize_param_env_or_error(tcx, unnormalized_env, cause)
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ fn check_stmt(&mut self, cx: &LateContext<'tcx>, stmt: &'tcx hir::Stmt<'_>) {
|
||||
|
||||
fn check_item(cx: &LateContext<'_>, hir_id: HirId) {
|
||||
let hir = cx.tcx.hir();
|
||||
if let Some(body_id) = hir.maybe_body_owned_by(hir.local_def_id(hir_id)) {
|
||||
if let Some(body_id) = hir.maybe_body_owned_by(hir_id.expect_owner()) {
|
||||
check_node(cx, hir_id, |v| {
|
||||
v.expr(&v.bind("expr", &hir.body(body_id).value));
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user