mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-01 22:18:23 +03:00
fetch -> lookup
This commit is contained in:
@@ -1627,7 +1627,7 @@ impl WithOptConstParam<LocalDefId> {
|
||||
/// Returns `Some((did, param_did))` if `def_id` is a const argument,
|
||||
/// `None` otherwise.
|
||||
#[inline(always)]
|
||||
pub fn try_fetch(did: LocalDefId, tcx: TyCtxt<'_>) -> Option<(LocalDefId, DefId)> {
|
||||
pub fn try_lookup(did: LocalDefId, tcx: TyCtxt<'_>) -> Option<(LocalDefId, DefId)> {
|
||||
tcx.opt_const_param_of(did).map(|param_did| (did, param_did))
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
pub fn provide(providers: &mut Providers) {
|
||||
*providers = Providers {
|
||||
mir_borrowck: |tcx, did| {
|
||||
if let Some(def) = ty::WithOptConstParam::try_fetch(did, tcx) {
|
||||
if let Some(def) = ty::WithOptConstParam::try_lookup(did, tcx) {
|
||||
tcx.mir_borrowck_const_arg(def)
|
||||
} else {
|
||||
mir_borrowck(tcx, ty::WithOptConstParam::unknown(did))
|
||||
|
||||
@@ -439,7 +439,7 @@ fn check_target_features(&mut self, func_did: DefId) {
|
||||
pub(crate) fn provide(providers: &mut Providers) {
|
||||
*providers = Providers {
|
||||
unsafety_check_result: |tcx, def_id| {
|
||||
if let Some(def) = ty::WithOptConstParam::try_fetch(def_id, tcx) {
|
||||
if let Some(def) = ty::WithOptConstParam::try_lookup(def_id, tcx) {
|
||||
tcx.unsafety_check_result_for_const_arg(def)
|
||||
} else {
|
||||
unsafety_check_result(tcx, ty::WithOptConstParam::unknown(def_id))
|
||||
|
||||
@@ -50,7 +50,7 @@ pub(crate) fn provide(providers: &mut Providers) {
|
||||
mir_const,
|
||||
mir_const_qualif: |tcx, def_id| {
|
||||
let def_id = def_id.expect_local();
|
||||
if let Some(def) = ty::WithOptConstParam::try_fetch(def_id, tcx) {
|
||||
if let Some(def) = ty::WithOptConstParam::try_lookup(def_id, tcx) {
|
||||
tcx.mir_const_qualif_const_arg(def)
|
||||
} else {
|
||||
mir_const_qualif(tcx, ty::WithOptConstParam::unknown(def_id))
|
||||
@@ -66,7 +66,7 @@ pub(crate) fn provide(providers: &mut Providers) {
|
||||
is_mir_available,
|
||||
promoted_mir: |tcx, def_id| {
|
||||
let def_id = def_id.expect_local();
|
||||
if let Some(def) = ty::WithOptConstParam::try_fetch(def_id, tcx) {
|
||||
if let Some(def) = ty::WithOptConstParam::try_lookup(def_id, tcx) {
|
||||
tcx.promoted_mir_of_const_arg(def)
|
||||
} else {
|
||||
promoted_mir(tcx, ty::WithOptConstParam::unknown(def_id))
|
||||
@@ -485,7 +485,7 @@ fn run_optimization_passes<'tcx>(
|
||||
|
||||
fn optimized_mir<'tcx>(tcx: TyCtxt<'tcx>, did: DefId) -> &'tcx Body<'tcx> {
|
||||
let did = did.expect_local();
|
||||
if let Some(def) = ty::WithOptConstParam::try_fetch(did, tcx) {
|
||||
if let Some(def) = ty::WithOptConstParam::try_lookup(did, tcx) {
|
||||
tcx.optimized_mir_of_const_arg(def)
|
||||
} else {
|
||||
tcx.arena.alloc(inner_optimized_mir(tcx, ty::WithOptConstParam::unknown(did)))
|
||||
|
||||
@@ -21,7 +21,10 @@
|
||||
|
||||
use super::lints;
|
||||
|
||||
crate fn mir_built<'tcx>(tcx: TyCtxt<'tcx>, def: ty::WithOptConstParam<LocalDefId>) -> &'tcx ty::steal::Steal<Body<'tcx>> {
|
||||
crate fn mir_built<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
def: ty::WithOptConstParam<LocalDefId>,
|
||||
) -> &'tcx ty::steal::Steal<Body<'tcx>> {
|
||||
if let Some(def) = def.try_upgrade(tcx) {
|
||||
return tcx.mir_built(def);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user