Skip to content

Commit

Permalink
ty_def_id -> def_id_for_type_of
Browse files Browse the repository at this point in the history
  • Loading branch information
lcnr committed Jul 15, 2020
1 parent a909eb6 commit 8003ccf
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/librustc_middle/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1623,7 +1623,7 @@ impl WithOptConstParam<LocalDefId> {
WithOptConstParam { did: self.did.to_def_id(), const_param_did: self.const_param_did }
}

pub fn ty_def_id(self) -> DefId {
pub fn def_id_for_type_of(self) -> DefId {
if let Some(did) = self.const_param_did { did } else { self.did.to_def_id() }
}
}
Expand Down Expand Up @@ -1653,7 +1653,7 @@ impl WithOptConstParam<DefId> {
self.did.is_local()
}

pub fn ty_def_id(self) -> DefId {
pub fn def_id_for_type_of(self) -> DefId {
self.const_param_did.unwrap_or(self.did)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_middle/ty/sty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2231,7 +2231,7 @@ impl<'tcx> Const<'tcx> {

let expr = &tcx.hir().body(body_id).value;

let ty = tcx.type_of(def.ty_def_id());
let ty = tcx.type_of(def.def_id_for_type_of());

let lit_input = match expr.kind {
hir::ExprKind::Lit(ref lit) => Some(LitToConstInput { lit: &lit.node, ty, neg: false }),
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/borrow_check/universal_regions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
// For a constant body, there are no inputs, and one
// "output" (the type of the constant).
assert_eq!(self.mir_def.did.to_def_id(), def_id);
let ty = tcx.type_of(self.mir_def.ty_def_id());
let ty = tcx.type_of(self.mir_def.def_id_for_type_of());
let ty = indices.fold_to_region_vids(tcx, &ty);
ty::Binder::dummy(tcx.intern_type_list(&[ty]))
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_ty/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ fn inner_resolve_instance<'tcx>(
let item = tcx.associated_item(def.did);
resolve_associated_item(tcx, &item, param_env, trait_def_id, substs)
} else {
let ty = tcx.type_of(def.ty_def_id());
let ty = tcx.type_of(def.def_id_for_type_of());
let item_type = tcx.subst_and_normalize_erasing_regions(substs, param_env, &ty);

let def = match item_type.kind {
Expand Down

0 comments on commit 8003ccf

Please sign in to comment.