Rename local_did to def_id
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
This commit is contained in:
parent
25bdc8965e
commit
16513d689e
9 changed files with 28 additions and 24 deletions
|
@ -328,7 +328,7 @@ impl<'tcx> pprust_hir::PpAnn for TypedAnnotation<'tcx> {
|
||||||
let typeck_results = self.maybe_typeck_results.get().or_else(|| {
|
let typeck_results = self.maybe_typeck_results.get().or_else(|| {
|
||||||
self.tcx
|
self.tcx
|
||||||
.hir()
|
.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))
|
.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 hir = &tcx.hir();
|
||||||
let local_did = id.as_local()?;
|
let def_id = id.as_local()?;
|
||||||
let hir_id = hir.local_def_id_to_hir_id(local_did);
|
let hir_id = hir.local_def_id_to_hir_id(def_id);
|
||||||
|
|
||||||
// FIXME: use def_kind
|
// FIXME: use def_kind
|
||||||
// Don't perform this on closures
|
// 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 owner_id = hir.body_owner(body_id);
|
||||||
let fn_decl = hir.fn_decl_by_hir_id(owner_id).unwrap();
|
let fn_decl = hir.fn_decl_by_hir_id(owner_id).unwrap();
|
||||||
|
|
|
@ -1614,16 +1614,16 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn encode_info_for_anon_const(&mut self, id: hir::HirId) {
|
fn encode_info_for_anon_const(&mut self, id: hir::HirId) {
|
||||||
let local_did = self.tcx.hir().local_def_id(id);
|
let def_id = self.tcx.hir().local_def_id(id);
|
||||||
debug!("EncodeContext::encode_info_for_anon_const({:?})", local_did);
|
debug!("EncodeContext::encode_info_for_anon_const({:?})", def_id);
|
||||||
let body_id = self.tcx.hir().body_owned_by(local_did);
|
let body_id = self.tcx.hir().body_owned_by(def_id);
|
||||||
let const_data = self.encode_rendered_const_for_body(body_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.kind[def_id.to_def_id()] <- EntryKind::AnonConst);
|
||||||
record!(self.tables.mir_const_qualif[local_did.to_def_id()] <- qualifs);
|
record!(self.tables.mir_const_qualif[def_id.to_def_id()] <- qualifs);
|
||||||
record!(self.tables.rendered_const[local_did.to_def_id()] <- const_data);
|
record!(self.tables.rendered_const[def_id.to_def_id()] <- const_data);
|
||||||
self.encode_item_type(local_did.to_def_id());
|
self.encode_item_type(def_id.to_def_id());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn encode_native_libraries(&mut self) -> LazyArray<NativeLib> {
|
fn encode_native_libraries(&mut self) -> LazyArray<NativeLib> {
|
||||||
|
|
|
@ -157,9 +157,9 @@ pub fn provide(providers: &mut Providers) {
|
||||||
};
|
};
|
||||||
providers.fn_arg_names = |tcx, id| {
|
providers.fn_arg_names = |tcx, id| {
|
||||||
let hir = tcx.hir();
|
let hir = tcx.hir();
|
||||||
let local_did = id.expect_local();
|
let def_id = id.expect_local();
|
||||||
let hir_id = hir.local_def_id_to_hir_id(local_did);
|
let hir_id = hir.local_def_id_to_hir_id(def_id);
|
||||||
if let Some(body_id) = hir.maybe_body_owned_by(local_did) {
|
if let Some(body_id) = hir.maybe_body_owned_by(def_id) {
|
||||||
tcx.arena.alloc_from_iter(hir.body_param_names(body_id))
|
tcx.arena.alloc_from_iter(hir.body_param_names(body_id))
|
||||||
} else if let Node::TraitItem(&TraitItem {
|
} else if let Node::TraitItem(&TraitItem {
|
||||||
kind: TraitItemKind::Fn(_, TraitFn::Required(idents)),
|
kind: TraitItemKind::Fn(_, TraitFn::Required(idents)),
|
||||||
|
|
|
@ -26,7 +26,7 @@ use rustc_span::{BytePos, Span};
|
||||||
pub(crate) fn check_match(tcx: TyCtxt<'_>, def_id: DefId) {
|
pub(crate) fn check_match(tcx: TyCtxt<'_>, def_id: DefId) {
|
||||||
let body_id = match def_id.as_local() {
|
let body_id = match def_id.as_local() {
|
||||||
None => return,
|
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();
|
let pattern_arena = TypedArena::default();
|
||||||
|
|
|
@ -15,8 +15,8 @@ pub fn provide(providers: &mut Providers) {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
let local_did = def_id.expect_local();
|
let local_def_id = def_id.expect_local();
|
||||||
let body = tcx.hir().body(tcx.hir().maybe_body_owned_by(local_did)?);
|
let body = tcx.hir().body(tcx.hir().maybe_body_owned_by(local_def_id)?);
|
||||||
|
|
||||||
let mut local_collector = LocalCollector::default();
|
let mut local_collector = LocalCollector::default();
|
||||||
local_collector.visit_body(body);
|
local_collector.visit_body(body);
|
||||||
|
|
|
@ -1783,7 +1783,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
||||||
|
|
||||||
let generator_body = generator_did
|
let generator_body = generator_did
|
||||||
.as_local()
|
.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));
|
.map(|body_id| hir.body(body_id));
|
||||||
let is_async = match generator_did.as_local() {
|
let is_async = match generator_did.as_local() {
|
||||||
Some(_) => generator_body
|
Some(_) => generator_body
|
||||||
|
|
|
@ -207,10 +207,14 @@ fn param_env(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamEnv<'_> {
|
||||||
constness,
|
constness,
|
||||||
);
|
);
|
||||||
|
|
||||||
let body_id = local_did
|
let body_id =
|
||||||
.and_then(|id| tcx.hir().maybe_body_owned_by(id).map(|body| body.hir_id))
|
local_did.and_then(|id| tcx.hir().maybe_body_owned_by(id).map(|body| body.hir_id));
|
||||||
.or(hir_id)
|
let body_id = match body_id {
|
||||||
.map_or(hir::CRATE_HIR_ID, |did| did);
|
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);
|
let cause = traits::ObligationCause::misc(tcx.def_span(def_id), body_id);
|
||||||
traits::normalize_param_env_or_error(tcx, unnormalized_env, cause)
|
traits::normalize_param_env_or_error(tcx, unnormalized_env, cause)
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,7 +138,7 @@ impl<'tcx> LateLintPass<'tcx> for Author {
|
||||||
|
|
||||||
fn check_item(cx: &LateContext<'_>, hir_id: HirId) {
|
fn check_item(cx: &LateContext<'_>, hir_id: HirId) {
|
||||||
let hir = cx.tcx.hir();
|
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| {
|
check_node(cx, hir_id, |v| {
|
||||||
v.expr(&v.bind("expr", &hir.body(body_id).value));
|
v.expr(&v.bind("expr", &hir.body(body_id).value));
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue