Skip to content

Commit 1ac1d83

Browse files
compiler: simplify hir_typeck::provide via manual inlining
Also add a docstring that points to the actually interesting module.
1 parent 564a3d8 commit 1ac1d83

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

compiler/rustc_hir_typeck/src/lib.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,12 @@ fn fatally_break_rust(tcx: TyCtxt<'_>, span: Span) -> ! {
536536
diag.emit()
537537
}
538538

539+
/// Adds query fn to the [Providers] vtable, see [`rustc_middle::query`]
539540
pub fn provide(providers: &mut Providers) {
540-
method::provide(providers);
541-
*providers = Providers { typeck, used_trait_imports, ..*providers };
541+
*providers = Providers {
542+
method_autoderef_steps: method::probe::method_autoderef_steps,
543+
typeck,
544+
used_trait_imports,
545+
..*providers
546+
};
542547
}

compiler/rustc_hir_typeck/src/method/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use rustc_hir::def::{CtorOf, DefKind, Namespace};
1313
use rustc_hir::def_id::DefId;
1414
use rustc_infer::infer::{BoundRegionConversionTime, InferOk};
1515
use rustc_infer::traits::PredicateObligations;
16-
use rustc_middle::query::Providers;
1716
use rustc_middle::traits::ObligationCause;
1817
use rustc_middle::ty::{
1918
self, GenericArgs, GenericArgsRef, GenericParamDefKind, Ty, TypeVisitableExt,
@@ -28,10 +27,6 @@ pub(crate) use self::MethodError::*;
2827
use self::probe::{IsSuggestion, ProbeScope};
2928
use crate::FnCtxt;
3029

31-
pub(crate) fn provide(providers: &mut Providers) {
32-
probe::provide(providers);
33-
}
34-
3530
#[derive(Clone, Copy, Debug)]
3631
pub(crate) struct MethodCallee<'tcx> {
3732
/// Impl method ID, for inherent methods, or trait method ID, otherwise.

compiler/rustc_hir_typeck/src/method/probe.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ use rustc_infer::infer::canonical::{Canonical, OriginalQueryValues, QueryRespons
1515
use rustc_infer::infer::{BoundRegionConversionTime, DefineOpaqueTypes, InferOk, TyCtxtInferExt};
1616
use rustc_infer::traits::ObligationCauseCode;
1717
use rustc_middle::middle::stability;
18-
use rustc_middle::query::Providers;
1918
use rustc_middle::ty::elaborate::supertrait_def_ids;
2019
use rustc_middle::ty::fast_reject::{DeepRejectCtxt, TreatParams, simplify_type};
2120
use rustc_middle::ty::{
@@ -554,11 +553,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
554553
}
555554
}
556555

557-
pub(crate) fn provide(providers: &mut Providers) {
558-
providers.method_autoderef_steps = method_autoderef_steps;
559-
}
560-
561-
fn method_autoderef_steps<'tcx>(
556+
pub(crate) fn method_autoderef_steps<'tcx>(
562557
tcx: TyCtxt<'tcx>,
563558
goal: CanonicalTyGoal<'tcx>,
564559
) -> MethodAutoderefStepsResult<'tcx> {

0 commit comments

Comments
 (0)