Skip to content

Commit

Permalink
try_update -> try_upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
lcnr committed Jul 21, 2020
1 parent ebc0c15 commit 38e9e62
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/librustc_middle/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1634,7 +1634,7 @@ impl WithOptConstParam<LocalDefId> {
/// In case `self` is unknown but `self.did` is a const argument, this returns
/// a `WithOptConstParam` with the correct `const_param_did`.
#[inline(always)]
pub fn try_update(self, tcx: TyCtxt<'_>) -> Option<WithOptConstParam<LocalDefId>> {
pub fn try_upgrade(self, tcx: TyCtxt<'_>) -> Option<WithOptConstParam<LocalDefId>> {
if self.const_param_did.is_none() {
if let const_param_did @ Some(_) = tcx.opt_const_param_of(self.did) {
return Some(WithOptConstParam { did: self.did, const_param_did });
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_mir/transform/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ fn mir_const<'tcx>(
tcx: TyCtxt<'tcx>,
def: ty::WithOptConstParam<LocalDefId>,
) -> &'tcx Steal<Body<'tcx>> {
if let Some(def) = ty::WithOptConstParam::try_update(def, tcx) {
if let Some(def) = def.try_upgrade(tcx) {
return tcx.mir_const(def);
}

Expand Down Expand Up @@ -314,7 +314,7 @@ fn mir_validated(
tcx: TyCtxt<'tcx>,
def: ty::WithOptConstParam<LocalDefId>,
) -> (&'tcx Steal<Body<'tcx>>, &'tcx Steal<IndexVec<Promoted, Body<'tcx>>>) {
if let Some(def) = ty::WithOptConstParam::try_update(def, tcx) {
if let Some(def) = def.try_upgrade(tcx) {
return tcx.mir_validated(def);
}

Expand Down Expand Up @@ -357,7 +357,7 @@ fn mir_drops_elaborated_and_const_checked<'tcx>(
tcx: TyCtxt<'tcx>,
def: ty::WithOptConstParam<LocalDefId>,
) -> &'tcx Steal<Body<'tcx>> {
if let Some(def) = ty::WithOptConstParam::try_update(def, tcx) {
if let Some(def) = def.try_upgrade(tcx) {
return tcx.mir_drops_elaborated_and_const_checked(def);
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir_build/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use rustc_target::spec::PanicStrategy;
use super::lints;

crate fn mir_built<'tcx>(tcx: TyCtxt<'tcx>, def: ty::WithOptConstParam<LocalDefId>) -> &'tcx ty::steal::Steal<Body<'tcx>> {
if let Some(def) = ty::WithOptConstParam::try_update(def, tcx) {
if let Some(def) = def.try_upgrade(tcx) {
return tcx.mir_built(def);
}

Expand Down

0 comments on commit 38e9e62

Please sign in to comment.