Skip to content

Commit 4bffe8f

Browse files
committed
fetch -> lookup
1 parent 38e9e62 commit 4bffe8f

File tree

5 files changed

+10
-7
lines changed

5 files changed

+10
-7
lines changed

Diff for: src/librustc_middle/ty/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1627,7 +1627,7 @@ impl WithOptConstParam<LocalDefId> {
16271627
/// Returns `Some((did, param_did))` if `def_id` is a const argument,
16281628
/// `None` otherwise.
16291629
#[inline(always)]
1630-
pub fn try_fetch(did: LocalDefId, tcx: TyCtxt<'_>) -> Option<(LocalDefId, DefId)> {
1630+
pub fn try_lookup(did: LocalDefId, tcx: TyCtxt<'_>) -> Option<(LocalDefId, DefId)> {
16311631
tcx.opt_const_param_of(did).map(|param_did| (did, param_did))
16321632
}
16331633

Diff for: src/librustc_mir/borrow_check/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ const DEREF_PROJECTION: &[PlaceElem<'_>; 1] = &[ProjectionElem::Deref];
8989
pub fn provide(providers: &mut Providers) {
9090
*providers = Providers {
9191
mir_borrowck: |tcx, did| {
92-
if let Some(def) = ty::WithOptConstParam::try_fetch(did, tcx) {
92+
if let Some(def) = ty::WithOptConstParam::try_lookup(did, tcx) {
9393
tcx.mir_borrowck_const_arg(def)
9494
} else {
9595
mir_borrowck(tcx, ty::WithOptConstParam::unknown(did))

Diff for: src/librustc_mir/transform/check_unsafety.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ impl<'a, 'tcx> UnsafetyChecker<'a, 'tcx> {
439439
pub(crate) fn provide(providers: &mut Providers) {
440440
*providers = Providers {
441441
unsafety_check_result: |tcx, def_id| {
442-
if let Some(def) = ty::WithOptConstParam::try_fetch(def_id, tcx) {
442+
if let Some(def) = ty::WithOptConstParam::try_lookup(def_id, tcx) {
443443
tcx.unsafety_check_result_for_const_arg(def)
444444
} else {
445445
unsafety_check_result(tcx, ty::WithOptConstParam::unknown(def_id))

Diff for: src/librustc_mir/transform/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub(crate) fn provide(providers: &mut Providers) {
5050
mir_const,
5151
mir_const_qualif: |tcx, def_id| {
5252
let def_id = def_id.expect_local();
53-
if let Some(def) = ty::WithOptConstParam::try_fetch(def_id, tcx) {
53+
if let Some(def) = ty::WithOptConstParam::try_lookup(def_id, tcx) {
5454
tcx.mir_const_qualif_const_arg(def)
5555
} else {
5656
mir_const_qualif(tcx, ty::WithOptConstParam::unknown(def_id))
@@ -66,7 +66,7 @@ pub(crate) fn provide(providers: &mut Providers) {
6666
is_mir_available,
6767
promoted_mir: |tcx, def_id| {
6868
let def_id = def_id.expect_local();
69-
if let Some(def) = ty::WithOptConstParam::try_fetch(def_id, tcx) {
69+
if let Some(def) = ty::WithOptConstParam::try_lookup(def_id, tcx) {
7070
tcx.promoted_mir_of_const_arg(def)
7171
} else {
7272
promoted_mir(tcx, ty::WithOptConstParam::unknown(def_id))
@@ -485,7 +485,7 @@ fn run_optimization_passes<'tcx>(
485485

486486
fn optimized_mir<'tcx>(tcx: TyCtxt<'tcx>, did: DefId) -> &'tcx Body<'tcx> {
487487
let did = did.expect_local();
488-
if let Some(def) = ty::WithOptConstParam::try_fetch(did, tcx) {
488+
if let Some(def) = ty::WithOptConstParam::try_lookup(did, tcx) {
489489
tcx.optimized_mir_of_const_arg(def)
490490
} else {
491491
tcx.arena.alloc(inner_optimized_mir(tcx, ty::WithOptConstParam::unknown(did)))

Diff for: src/librustc_mir_build/build/mod.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ use rustc_target::spec::PanicStrategy;
2121

2222
use super::lints;
2323

24-
crate fn mir_built<'tcx>(tcx: TyCtxt<'tcx>, def: ty::WithOptConstParam<LocalDefId>) -> &'tcx ty::steal::Steal<Body<'tcx>> {
24+
crate fn mir_built<'tcx>(
25+
tcx: TyCtxt<'tcx>,
26+
def: ty::WithOptConstParam<LocalDefId>,
27+
) -> &'tcx ty::steal::Steal<Body<'tcx>> {
2528
if let Some(def) = def.try_upgrade(tcx) {
2629
return tcx.mir_built(def);
2730
}

0 commit comments

Comments
 (0)