/// 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 });
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);
}
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);
}
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);
}
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);
}