mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Remove TypeckResults from InferCtxt
This commit is contained in:
parent
4a68373217
commit
349415d1c6
@ -14,8 +14,8 @@ use crate::{
|
||||
places_conflict, region_infer::values::LivenessValues,
|
||||
};
|
||||
|
||||
pub(super) fn generate_constraints<'cx, 'tcx>(
|
||||
infcx: &InferCtxt<'cx, 'tcx>,
|
||||
pub(super) fn generate_constraints<'tcx>(
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
liveness_constraints: &mut LivenessValues<RegionVid>,
|
||||
all_facts: &mut Option<AllFacts>,
|
||||
location_table: &LocationTable,
|
||||
@ -37,8 +37,8 @@ pub(super) fn generate_constraints<'cx, 'tcx>(
|
||||
}
|
||||
|
||||
/// 'cg = the duration of the constraint generation process itself.
|
||||
struct ConstraintGeneration<'cg, 'cx, 'tcx> {
|
||||
infcx: &'cg InferCtxt<'cx, 'tcx>,
|
||||
struct ConstraintGeneration<'cg, 'tcx> {
|
||||
infcx: &'cg InferCtxt<'tcx>,
|
||||
all_facts: &'cg mut Option<AllFacts>,
|
||||
location_table: &'cg LocationTable,
|
||||
liveness_constraints: &'cg mut LivenessValues<RegionVid>,
|
||||
@ -46,7 +46,7 @@ struct ConstraintGeneration<'cg, 'cx, 'tcx> {
|
||||
body: &'cg Body<'tcx>,
|
||||
}
|
||||
|
||||
impl<'cg, 'cx, 'tcx> Visitor<'tcx> for ConstraintGeneration<'cg, 'cx, 'tcx> {
|
||||
impl<'cg, 'tcx> Visitor<'tcx> for ConstraintGeneration<'cg, 'tcx> {
|
||||
fn visit_basic_block_data(&mut self, bb: BasicBlock, data: &BasicBlockData<'tcx>) {
|
||||
self.super_basic_block_data(bb, data);
|
||||
}
|
||||
@ -156,7 +156,7 @@ impl<'cg, 'cx, 'tcx> Visitor<'tcx> for ConstraintGeneration<'cg, 'cx, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'cx, 'cg, 'tcx> ConstraintGeneration<'cx, 'cg, 'tcx> {
|
||||
impl<'cx, 'tcx> ConstraintGeneration<'cx, 'tcx> {
|
||||
/// Some variable with type `live_ty` is "regular live" at
|
||||
/// `location` -- i.e., it may be used later. This means that all
|
||||
/// regions appearing in the type `live_ty` must be live at
|
||||
|
@ -407,7 +407,7 @@ impl<'tcx> TypeOpInfo<'tcx> for crate::type_check::InstantiateOpaqueType<'tcx> {
|
||||
#[instrument(skip(fulfill_cx, infcx), level = "debug")]
|
||||
fn try_extract_error_from_fulfill_cx<'tcx>(
|
||||
mut fulfill_cx: Box<dyn TraitEngine<'tcx> + 'tcx>,
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
placeholder_region: ty::Region<'tcx>,
|
||||
error_region: Option<ty::Region<'tcx>>,
|
||||
) -> Option<DiagnosticBuilder<'tcx, ErrorGuaranteed>> {
|
||||
@ -427,7 +427,7 @@ fn try_extract_error_from_fulfill_cx<'tcx>(
|
||||
}
|
||||
|
||||
fn try_extract_error_from_region_constraints<'tcx>(
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
placeholder_region: ty::Region<'tcx>,
|
||||
error_region: Option<ty::Region<'tcx>>,
|
||||
region_constraints: &RegionConstraintData<'tcx>,
|
||||
|
@ -150,8 +150,8 @@ fn mir_borrowck<'tcx>(
|
||||
/// region ids on which the borrow checking was performed together with Polonius
|
||||
/// facts.
|
||||
#[instrument(skip(infcx, input_body, input_promoted), fields(id=?input_body.source.with_opt_param().as_local().unwrap()), level = "debug")]
|
||||
fn do_mir_borrowck<'a, 'tcx>(
|
||||
infcx: &InferCtxt<'a, 'tcx>,
|
||||
fn do_mir_borrowck<'tcx>(
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
input_body: &Body<'tcx>,
|
||||
input_promoted: &IndexVec<Promoted, Body<'tcx>>,
|
||||
return_body_with_facts: bool,
|
||||
@ -474,7 +474,7 @@ pub struct BodyWithBorrowckFacts<'tcx> {
|
||||
}
|
||||
|
||||
struct MirBorrowckCtxt<'cx, 'tcx> {
|
||||
infcx: &'cx InferCtxt<'cx, 'tcx>,
|
||||
infcx: &'cx InferCtxt<'tcx>,
|
||||
param_env: ParamEnv<'tcx>,
|
||||
body: &'cx Body<'tcx>,
|
||||
move_data: &'cx MoveData<'tcx>,
|
||||
|
@ -55,8 +55,8 @@ pub(crate) struct NllOutput<'tcx> {
|
||||
/// regions (e.g., region parameters) declared on the function. That set will need to be given to
|
||||
/// `compute_regions`.
|
||||
#[instrument(skip(infcx, param_env, body, promoted), level = "debug")]
|
||||
pub(crate) fn replace_regions_in_mir<'cx, 'tcx>(
|
||||
infcx: &InferCtxt<'cx, 'tcx>,
|
||||
pub(crate) fn replace_regions_in_mir<'tcx>(
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
body: &mut Body<'tcx>,
|
||||
promoted: &mut IndexVec<Promoted, Body<'tcx>>,
|
||||
@ -155,7 +155,7 @@ fn populate_polonius_move_facts(
|
||||
///
|
||||
/// This may result in errors being reported.
|
||||
pub(crate) fn compute_regions<'cx, 'tcx>(
|
||||
infcx: &InferCtxt<'cx, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
universal_regions: UniversalRegions<'tcx>,
|
||||
body: &Body<'tcx>,
|
||||
promoted: &IndexVec<Promoted, Body<'tcx>>,
|
||||
@ -318,8 +318,8 @@ pub(crate) fn compute_regions<'cx, 'tcx>(
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn dump_mir_results<'a, 'tcx>(
|
||||
infcx: &InferCtxt<'a, 'tcx>,
|
||||
pub(super) fn dump_mir_results<'tcx>(
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
body: &Body<'tcx>,
|
||||
regioncx: &RegionInferenceContext<'tcx>,
|
||||
closure_region_requirements: &Option<ClosureRegionRequirements<'_>>,
|
||||
@ -368,8 +368,8 @@ pub(super) fn dump_mir_results<'a, 'tcx>(
|
||||
};
|
||||
}
|
||||
|
||||
pub(super) fn dump_annotation<'a, 'tcx>(
|
||||
infcx: &InferCtxt<'a, 'tcx>,
|
||||
pub(super) fn dump_annotation<'tcx>(
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
body: &Body<'tcx>,
|
||||
regioncx: &RegionInferenceContext<'tcx>,
|
||||
closure_region_requirements: &Option<ClosureRegionRequirements<'_>>,
|
||||
|
@ -565,7 +565,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||
#[instrument(skip(self, infcx, body, polonius_output), level = "debug")]
|
||||
pub(super) fn solve(
|
||||
&mut self,
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
body: &Body<'tcx>,
|
||||
polonius_output: Option<Rc<PoloniusOutput>>,
|
||||
@ -835,7 +835,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||
/// 'a`. See `TypeTest` for more details.
|
||||
fn check_type_tests(
|
||||
&self,
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
body: &Body<'tcx>,
|
||||
mut propagated_outlives_requirements: Option<&mut Vec<ClosureOutlivesRequirement<'tcx>>>,
|
||||
@ -923,7 +923,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||
#[instrument(level = "debug", skip(self, infcx, propagated_outlives_requirements))]
|
||||
fn try_promote_type_test(
|
||||
&self,
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
body: &Body<'tcx>,
|
||||
type_test: &TypeTest<'tcx>,
|
||||
@ -1036,7 +1036,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||
#[instrument(level = "debug", skip(self, infcx))]
|
||||
fn try_promote_type_test_subject(
|
||||
&self,
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
ty: Ty<'tcx>,
|
||||
) -> Option<ClosureOutlivesSubject<'tcx>> {
|
||||
let tcx = infcx.tcx;
|
||||
@ -1212,7 +1212,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||
/// `point`.
|
||||
fn eval_verify_bound(
|
||||
&self,
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
body: &Body<'tcx>,
|
||||
generic_ty: Ty<'tcx>,
|
||||
@ -1262,7 +1262,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||
|
||||
fn eval_if_eq(
|
||||
&self,
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
generic_ty: Ty<'tcx>,
|
||||
lower_bound: RegionVid,
|
||||
@ -1718,7 +1718,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||
|
||||
fn check_member_constraints(
|
||||
&self,
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
errors_buffer: &mut RegionErrors<'tcx>,
|
||||
) {
|
||||
let member_constraints = self.member_constraints.clone();
|
||||
|
@ -63,7 +63,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||
#[instrument(level = "debug", skip(self, infcx), ret)]
|
||||
pub(crate) fn infer_opaque_types(
|
||||
&self,
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
opaque_ty_decls: VecMap<OpaqueTypeKey<'tcx>, (OpaqueHiddenType<'tcx>, OpaqueTyOrigin)>,
|
||||
) -> VecMap<LocalDefId, OpaqueHiddenType<'tcx>> {
|
||||
let mut result: VecMap<LocalDefId, OpaqueHiddenType<'tcx>> = VecMap::new();
|
||||
@ -194,7 +194,7 @@ pub trait InferCtxtExt<'tcx> {
|
||||
) -> Ty<'tcx>;
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
||||
impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
|
||||
/// Given the fully resolved, instantiated type for an opaque
|
||||
/// type, i.e., the value of an inference variable like C1 or C2
|
||||
/// (*), computes the "definition type" for an opaque type
|
||||
|
@ -10,7 +10,7 @@ use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable};
|
||||
/// inference variables, returning the number of variables created.
|
||||
#[instrument(skip(infcx, body, promoted), level = "debug")]
|
||||
pub fn renumber_mir<'tcx>(
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
body: &mut Body<'tcx>,
|
||||
promoted: &mut IndexVec<Promoted, Body<'tcx>>,
|
||||
) {
|
||||
@ -28,7 +28,7 @@ pub fn renumber_mir<'tcx>(
|
||||
/// Replaces all regions appearing in `value` with fresh inference
|
||||
/// variables.
|
||||
#[instrument(skip(infcx), level = "debug")]
|
||||
pub fn renumber_regions<'tcx, T>(infcx: &InferCtxt<'_, 'tcx>, value: T) -> T
|
||||
pub fn renumber_regions<'tcx, T>(infcx: &InferCtxt<'tcx>, value: T) -> T
|
||||
where
|
||||
T: TypeFoldable<'tcx>,
|
||||
{
|
||||
@ -44,7 +44,7 @@ where
|
||||
// Once `visit_mir_constant` is removed we can also remove this function
|
||||
// and just use `renumber_regions`.
|
||||
fn renumber_regions_in_mir_constant<'tcx>(
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
value: ConstantKind<'tcx>,
|
||||
) -> ConstantKind<'tcx> {
|
||||
infcx.tcx.super_fold_regions(value, |_region, _depth| {
|
||||
@ -54,7 +54,7 @@ fn renumber_regions_in_mir_constant<'tcx>(
|
||||
}
|
||||
|
||||
struct NllVisitor<'a, 'tcx> {
|
||||
infcx: &'a InferCtxt<'a, 'tcx>,
|
||||
infcx: &'a InferCtxt<'tcx>,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> NllVisitor<'a, 'tcx> {
|
||||
|
@ -19,7 +19,7 @@ use crate::{
|
||||
};
|
||||
|
||||
pub(crate) struct ConstraintConversion<'a, 'tcx> {
|
||||
infcx: &'a InferCtxt<'a, 'tcx>,
|
||||
infcx: &'a InferCtxt<'tcx>,
|
||||
tcx: TyCtxt<'tcx>,
|
||||
universal_regions: &'a UniversalRegions<'tcx>,
|
||||
/// Each RBP `GK: 'a` is assumed to be true. These encode
|
||||
@ -43,7 +43,7 @@ pub(crate) struct ConstraintConversion<'a, 'tcx> {
|
||||
|
||||
impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
|
||||
pub(crate) fn new(
|
||||
infcx: &'a InferCtxt<'a, 'tcx>,
|
||||
infcx: &'a InferCtxt<'tcx>,
|
||||
universal_regions: &'a UniversalRegions<'tcx>,
|
||||
region_bound_pairs: &'a RegionBoundPairs<'tcx>,
|
||||
implicit_region_bound: ty::Region<'tcx>,
|
||||
|
@ -48,7 +48,7 @@ pub(crate) struct CreateResult<'tcx> {
|
||||
}
|
||||
|
||||
pub(crate) fn create<'tcx>(
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
implicit_region_bound: ty::Region<'tcx>,
|
||||
universal_regions: &Rc<UniversalRegions<'tcx>>,
|
||||
@ -197,7 +197,7 @@ impl UniversalRegionRelations<'_> {
|
||||
}
|
||||
|
||||
struct UniversalRegionRelationsBuilder<'this, 'tcx> {
|
||||
infcx: &'this InferCtxt<'this, 'tcx>,
|
||||
infcx: &'this InferCtxt<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
universal_regions: Rc<UniversalRegions<'tcx>>,
|
||||
implicit_region_bound: ty::Region<'tcx>,
|
||||
|
@ -123,7 +123,7 @@ mod relate_tys;
|
||||
/// - `move_data` -- move-data constructed when performing the maybe-init dataflow analysis
|
||||
/// - `elements` -- MIR region map
|
||||
pub(crate) fn type_check<'mir, 'tcx>(
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
body: &Body<'tcx>,
|
||||
promoted: &IndexVec<Promoted, Body<'tcx>>,
|
||||
@ -876,7 +876,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
|
||||
/// way, it accrues region constraints -- these can later be used by
|
||||
/// NLL region checking.
|
||||
struct TypeChecker<'a, 'tcx> {
|
||||
infcx: &'a InferCtxt<'a, 'tcx>,
|
||||
infcx: &'a InferCtxt<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
last_span: Span,
|
||||
body: &'a Body<'tcx>,
|
||||
@ -946,7 +946,7 @@ pub(crate) struct MirTypeckRegionConstraints<'tcx> {
|
||||
impl<'tcx> MirTypeckRegionConstraints<'tcx> {
|
||||
fn placeholder_region(
|
||||
&mut self,
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
placeholder: ty::PlaceholderRegion,
|
||||
) -> ty::Region<'tcx> {
|
||||
let placeholder_index = self.placeholder_indices.insert(placeholder);
|
||||
@ -1030,7 +1030,7 @@ impl Locations {
|
||||
|
||||
impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||
fn new(
|
||||
infcx: &'a InferCtxt<'a, 'tcx>,
|
||||
infcx: &'a InferCtxt<'tcx>,
|
||||
body: &'a Body<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
region_bound_pairs: &'a RegionBoundPairs<'tcx>,
|
||||
@ -2744,7 +2744,7 @@ impl<'tcx> TypeOp<'tcx> for InstantiateOpaqueType<'tcx> {
|
||||
/// constraints in our `InferCtxt`
|
||||
type ErrorInfo = InstantiateOpaqueType<'tcx>;
|
||||
|
||||
fn fully_perform(mut self, infcx: &InferCtxt<'_, 'tcx>) -> Fallible<TypeOpOutput<'tcx, Self>> {
|
||||
fn fully_perform(mut self, infcx: &InferCtxt<'tcx>) -> Fallible<TypeOpOutput<'tcx, Self>> {
|
||||
let (mut output, region_constraints) = scrape_region_constraints(infcx, || {
|
||||
Ok(InferOk { value: (), obligations: self.obligations.clone() })
|
||||
})?;
|
||||
|
@ -219,7 +219,7 @@ impl<'tcx> UniversalRegions<'tcx> {
|
||||
/// signature. This will also compute the relationships that are
|
||||
/// known between those regions.
|
||||
pub fn new(
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
mir_def: ty::WithOptConstParam<LocalDefId>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
) -> Self {
|
||||
@ -382,7 +382,7 @@ impl<'tcx> UniversalRegions<'tcx> {
|
||||
}
|
||||
|
||||
struct UniversalRegionsBuilder<'cx, 'tcx> {
|
||||
infcx: &'cx InferCtxt<'cx, 'tcx>,
|
||||
infcx: &'cx InferCtxt<'tcx>,
|
||||
mir_def: ty::WithOptConstParam<LocalDefId>,
|
||||
mir_hir_id: HirId,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
@ -699,7 +699,7 @@ trait InferCtxtExt<'tcx> {
|
||||
);
|
||||
}
|
||||
|
||||
impl<'cx, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'cx, 'tcx> {
|
||||
impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
|
||||
fn replace_free_regions_with_nll_infer_vars<T>(
|
||||
&self,
|
||||
origin: NllRegionVariableOrigin,
|
||||
|
@ -712,8 +712,8 @@ fn check_region_bounds_on_impl_item<'tcx>(
|
||||
}
|
||||
|
||||
#[instrument(level = "debug", skip(infcx))]
|
||||
fn extract_spans_for_error_reporting<'a, 'tcx>(
|
||||
infcx: &infer::InferCtxt<'a, 'tcx>,
|
||||
fn extract_spans_for_error_reporting<'tcx>(
|
||||
infcx: &infer::InferCtxt<'tcx>,
|
||||
terr: TypeError<'_>,
|
||||
cause: &ObligationCause<'tcx>,
|
||||
impl_m: &ty::AssocItem,
|
||||
|
@ -6,7 +6,7 @@ use rustc_hir as hir;
|
||||
use rustc_hir::def_id::LocalDefId;
|
||||
use rustc_hir::HirIdMap;
|
||||
use rustc_infer::infer;
|
||||
use rustc_infer::infer::{InferCtxt, InferOk, TyCtxtInferExt};
|
||||
use rustc_infer::infer::{DefiningAnchor, InferCtxt, InferOk, TyCtxtInferExt};
|
||||
use rustc_middle::ty::fold::TypeFoldable;
|
||||
use rustc_middle::ty::visit::TypeVisitable;
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||
@ -30,7 +30,7 @@ use std::ops::Deref;
|
||||
/// `bar()` will each have their own `FnCtxt`, but they will
|
||||
/// share the inherited fields.
|
||||
pub struct Inherited<'a, 'tcx> {
|
||||
pub(super) infcx: InferCtxt<'a, 'tcx>,
|
||||
pub(super) infcx: InferCtxt<'tcx>,
|
||||
|
||||
pub(super) typeck_results: &'a RefCell<ty::TypeckResults<'tcx>>,
|
||||
|
||||
@ -71,7 +71,7 @@ pub struct Inherited<'a, 'tcx> {
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Deref for Inherited<'a, 'tcx> {
|
||||
type Target = InferCtxt<'a, 'tcx>;
|
||||
type Target = InferCtxt<'tcx>;
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.infcx
|
||||
}
|
||||
@ -83,6 +83,7 @@ impl<'a, 'tcx> Deref for Inherited<'a, 'tcx> {
|
||||
pub struct InheritedBuilder<'tcx> {
|
||||
infcx: infer::InferCtxtBuilder<'tcx>,
|
||||
def_id: LocalDefId,
|
||||
typeck_results: RefCell<ty::TypeckResults<'tcx>>,
|
||||
}
|
||||
|
||||
impl<'tcx> Inherited<'_, 'tcx> {
|
||||
@ -93,7 +94,7 @@ impl<'tcx> Inherited<'_, 'tcx> {
|
||||
infcx: tcx
|
||||
.infer_ctxt()
|
||||
.ignoring_regions()
|
||||
.with_fresh_in_progress_typeck_results(hir_owner)
|
||||
.with_opaque_type_inference(DefiningAnchor::Bind(hir_owner.def_id))
|
||||
.with_normalize_fn_sig_for_diagnostic(Lrc::new(move |infcx, fn_sig| {
|
||||
if fn_sig.has_escaping_bound_vars() {
|
||||
return fn_sig;
|
||||
@ -117,6 +118,7 @@ impl<'tcx> Inherited<'_, 'tcx> {
|
||||
})
|
||||
})),
|
||||
def_id,
|
||||
typeck_results: RefCell::new(ty::TypeckResults::new(hir_owner)),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -127,16 +129,18 @@ impl<'tcx> InheritedBuilder<'tcx> {
|
||||
F: for<'a> FnOnce(Inherited<'a, 'tcx>) -> R,
|
||||
{
|
||||
let def_id = self.def_id;
|
||||
self.infcx.enter(|infcx| f(Inherited::new(infcx, def_id)))
|
||||
self.infcx.enter(|infcx| f(Inherited::new(infcx, def_id, &self.typeck_results)))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Inherited<'a, 'tcx> {
|
||||
fn new(infcx: InferCtxt<'a, 'tcx>, def_id: LocalDefId) -> Self {
|
||||
fn new(
|
||||
infcx: InferCtxt<'tcx>,
|
||||
def_id: LocalDefId,
|
||||
typeck_results: &'a RefCell<ty::TypeckResults<'tcx>>,
|
||||
) -> Self {
|
||||
let tcx = infcx.tcx;
|
||||
let body_id = tcx.hir().maybe_body_owned_by(def_id);
|
||||
let typeck_results =
|
||||
infcx.in_progress_typeck_results.expect("building `FnCtxt` without typeck results");
|
||||
|
||||
Inherited {
|
||||
typeck_results,
|
||||
|
@ -699,7 +699,7 @@ fn resolve_regions_with_wf_tys<'tcx>(
|
||||
id: hir::HirId,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
wf_tys: &FxHashSet<Ty<'tcx>>,
|
||||
add_constraints: impl for<'a> FnOnce(&'a InferCtxt<'a, 'tcx>, &'a RegionBoundPairs<'tcx>),
|
||||
add_constraints: impl for<'a> FnOnce(&'a InferCtxt<'tcx>, &'a RegionBoundPairs<'tcx>),
|
||||
) -> bool {
|
||||
// Unfortunately, we have to use a new `InferCtxt` each call, because
|
||||
// region constraints get added and solved there and we need to test each
|
||||
|
@ -700,7 +700,7 @@ impl Locatable for hir::HirId {
|
||||
/// unresolved types and so forth.
|
||||
struct Resolver<'cx, 'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
infcx: &'cx InferCtxt<'cx, 'tcx>,
|
||||
infcx: &'cx InferCtxt<'tcx>,
|
||||
span: &'cx dyn Locatable,
|
||||
body: &'tcx hir::Body<'tcx>,
|
||||
|
||||
|
@ -134,7 +134,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
|
||||
/// - `typeck_results` --- typeck results for the code being analyzed
|
||||
pub fn new(
|
||||
delegate: &'a mut (dyn Delegate<'tcx> + 'a),
|
||||
infcx: &'a InferCtxt<'a, 'tcx>,
|
||||
infcx: &'a InferCtxt<'tcx>,
|
||||
body_owner: LocalDefId,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
typeck_results: &'a ty::TypeckResults<'tcx>,
|
||||
|
@ -92,7 +92,7 @@ impl HirNode for hir::Pat<'_> {
|
||||
#[derive(Clone)]
|
||||
pub(crate) struct MemCategorizationContext<'a, 'tcx> {
|
||||
pub(crate) typeck_results: &'a ty::TypeckResults<'tcx>,
|
||||
infcx: &'a InferCtxt<'a, 'tcx>,
|
||||
infcx: &'a InferCtxt<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
body_owner: LocalDefId,
|
||||
upvars: Option<&'tcx FxIndexMap<hir::HirId, hir::Upvar>>,
|
||||
@ -103,7 +103,7 @@ pub(crate) type McResult<T> = Result<T, ()>;
|
||||
impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
|
||||
/// Creates a `MemCategorizationContext`.
|
||||
pub(crate) fn new(
|
||||
infcx: &'a InferCtxt<'a, 'tcx>,
|
||||
infcx: &'a InferCtxt<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
body_owner: LocalDefId,
|
||||
typeck_results: &'a ty::TypeckResults<'tcx>,
|
||||
|
@ -31,7 +31,7 @@ use rustc_middle::ty::relate::{Relate, TypeRelation};
|
||||
use rustc_middle::ty::{Const, ImplSubject};
|
||||
|
||||
pub struct At<'a, 'tcx> {
|
||||
pub infcx: &'a InferCtxt<'a, 'tcx>,
|
||||
pub infcx: &'a InferCtxt<'tcx>,
|
||||
pub cause: &'a ObligationCause<'tcx>,
|
||||
pub param_env: ty::ParamEnv<'tcx>,
|
||||
/// Whether we should define opaque types
|
||||
@ -48,9 +48,9 @@ pub struct Trace<'a, 'tcx> {
|
||||
trace: TypeTrace<'tcx>,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
impl<'tcx> InferCtxt<'tcx> {
|
||||
#[inline]
|
||||
pub fn at(
|
||||
pub fn at<'a>(
|
||||
&'a self,
|
||||
cause: &'a ObligationCause<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
@ -66,7 +66,6 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
tcx: self.tcx,
|
||||
defining_use_anchor: self.defining_use_anchor,
|
||||
considering_regions: self.considering_regions,
|
||||
in_progress_typeck_results: self.in_progress_typeck_results,
|
||||
inner: self.inner.clone(),
|
||||
skip_leak_check: self.skip_leak_check.clone(),
|
||||
lexical_region_resolutions: self.lexical_region_resolutions.clone(),
|
||||
|
@ -20,7 +20,7 @@ use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_index::vec::Idx;
|
||||
use smallvec::SmallVec;
|
||||
|
||||
impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
|
||||
impl<'tcx> InferCtxt<'tcx> {
|
||||
/// Canonicalizes a query value `V`. When we canonicalize a query,
|
||||
/// we not only canonicalize unbound inference variables, but we
|
||||
/// *also* replace all free regions whatsoever. So for example a
|
||||
@ -316,7 +316,7 @@ impl CanonicalizeMode for CanonicalizeFreeRegionsOtherThanStatic {
|
||||
}
|
||||
|
||||
struct Canonicalizer<'cx, 'tcx> {
|
||||
infcx: &'cx InferCtxt<'cx, 'tcx>,
|
||||
infcx: &'cx InferCtxt<'tcx>,
|
||||
tcx: TyCtxt<'tcx>,
|
||||
variables: SmallVec<[CanonicalVarInfo<'tcx>; 8]>,
|
||||
query_state: &'cx mut OriginalQueryValues<'tcx>,
|
||||
@ -521,7 +521,7 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {
|
||||
/// `canonicalize_query` and `canonicalize_response`.
|
||||
fn canonicalize<V>(
|
||||
value: V,
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
tcx: TyCtxt<'tcx>,
|
||||
canonicalize_region_mode: &dyn CanonicalizeMode,
|
||||
query_state: &mut OriginalQueryValues<'tcx>,
|
||||
|
@ -36,7 +36,7 @@ mod canonicalizer;
|
||||
pub mod query_response;
|
||||
mod substitute;
|
||||
|
||||
impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
|
||||
impl<'tcx> InferCtxt<'tcx> {
|
||||
/// Creates a substitution S for the canonical value with fresh
|
||||
/// inference variables and applies it to the canonical value.
|
||||
/// Returns both the instantiated result *and* the substitution S.
|
||||
|
@ -32,7 +32,7 @@ use rustc_span::Span;
|
||||
use std::fmt::Debug;
|
||||
use std::iter;
|
||||
|
||||
impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
|
||||
impl<'tcx> InferCtxt<'tcx> {
|
||||
/// This method is meant to be invoked as the final step of a canonical query
|
||||
/// implementation. It is given:
|
||||
///
|
||||
@ -677,7 +677,7 @@ pub fn make_query_region_constraints<'tcx>(
|
||||
}
|
||||
|
||||
struct QueryTypeRelatingDelegate<'a, 'tcx> {
|
||||
infcx: &'a InferCtxt<'a, 'tcx>,
|
||||
infcx: &'a InferCtxt<'tcx>,
|
||||
obligations: &'a mut Vec<PredicateObligation<'tcx>>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
cause: &'a ObligationCause<'tcx>,
|
||||
|
@ -43,7 +43,7 @@ use rustc_span::{Span, DUMMY_SP};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct CombineFields<'infcx, 'tcx> {
|
||||
pub infcx: &'infcx InferCtxt<'infcx, 'tcx>,
|
||||
pub infcx: &'infcx InferCtxt<'tcx>,
|
||||
pub trace: TypeTrace<'tcx>,
|
||||
pub cause: Option<ty::relate::Cause>,
|
||||
pub param_env: ty::ParamEnv<'tcx>,
|
||||
@ -63,7 +63,7 @@ pub enum RelationDir {
|
||||
EqTo,
|
||||
}
|
||||
|
||||
impl<'infcx, 'tcx> InferCtxt<'infcx, 'tcx> {
|
||||
impl<'tcx> InferCtxt<'tcx> {
|
||||
pub fn super_combine_tys<R>(
|
||||
&self,
|
||||
relation: &mut R,
|
||||
@ -452,7 +452,7 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
|
||||
}
|
||||
|
||||
struct Generalizer<'cx, 'tcx> {
|
||||
infcx: &'cx InferCtxt<'cx, 'tcx>,
|
||||
infcx: &'cx InferCtxt<'tcx>,
|
||||
|
||||
/// The span, used when creating new type variables and things.
|
||||
cause: &'cx ObligationCause<'tcx>,
|
||||
@ -775,7 +775,7 @@ fn float_unification_error<'tcx>(
|
||||
}
|
||||
|
||||
struct ConstInferUnifier<'cx, 'tcx> {
|
||||
infcx: &'cx InferCtxt<'cx, 'tcx>,
|
||||
infcx: &'cx InferCtxt<'tcx>,
|
||||
|
||||
span: Span,
|
||||
|
||||
|
@ -89,7 +89,7 @@ pub mod nice_region_error;
|
||||
/// field is only populated during an in-progress typeck.
|
||||
/// Get an instance by calling `InferCtxt::err` or `FnCtxt::infer_err`.
|
||||
pub struct TypeErrCtxt<'a, 'tcx> {
|
||||
pub infcx: &'a InferCtxt<'a, 'tcx>,
|
||||
pub infcx: &'a InferCtxt<'tcx>,
|
||||
pub typeck_results: Option<std::cell::Ref<'a, ty::TypeckResults<'tcx>>>,
|
||||
}
|
||||
|
||||
@ -103,9 +103,9 @@ impl TypeErrCtxt<'_, '_> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Deref for TypeErrCtxt<'a, 'tcx> {
|
||||
type Target = InferCtxt<'a, 'tcx>;
|
||||
fn deref(&self) -> &InferCtxt<'a, 'tcx> {
|
||||
impl<'tcx> Deref for TypeErrCtxt<'_, 'tcx> {
|
||||
type Target = InferCtxt<'tcx>;
|
||||
fn deref(&self) -> &InferCtxt<'tcx> {
|
||||
&self.infcx
|
||||
}
|
||||
}
|
||||
@ -329,7 +329,7 @@ pub fn unexpected_hidden_region_diagnostic<'tcx>(
|
||||
err
|
||||
}
|
||||
|
||||
impl<'tcx> InferCtxt<'_, 'tcx> {
|
||||
impl<'tcx> InferCtxt<'tcx> {
|
||||
pub fn get_impl_future_output_ty(&self, ty: Ty<'tcx>) -> Option<Binder<'tcx, Ty<'tcx>>> {
|
||||
if let ty::Opaque(def_id, substs) = ty.kind() {
|
||||
let future_trait = self.tcx.require_lang_item(LangItem::Future, None);
|
||||
@ -2837,7 +2837,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
struct SameTypeModuloInfer<'a, 'tcx>(&'a InferCtxt<'a, 'tcx>);
|
||||
struct SameTypeModuloInfer<'a, 'tcx>(&'a InferCtxt<'tcx>);
|
||||
|
||||
impl<'tcx> TypeRelation<'tcx> for SameTypeModuloInfer<'_, 'tcx> {
|
||||
fn tcx(&self) -> TyCtxt<'tcx> {
|
||||
@ -2924,7 +2924,7 @@ impl<'tcx> TypeRelation<'tcx> for SameTypeModuloInfer<'_, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
impl<'tcx> InferCtxt<'tcx> {
|
||||
fn report_inference_failure(
|
||||
&self,
|
||||
var_origin: RegionVariableOrigin,
|
||||
@ -3112,7 +3112,7 @@ impl TyCategory {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> InferCtxt<'_, 'tcx> {
|
||||
impl<'tcx> InferCtxt<'tcx> {
|
||||
/// Given a [`hir::Block`], get the span of its last expression or
|
||||
/// statement, peeling off any inner blocks.
|
||||
pub fn find_block_span(&self, block: &'tcx hir::Block<'tcx>) -> Span {
|
||||
|
@ -152,7 +152,7 @@ impl UnderspecifiedArgKind {
|
||||
}
|
||||
}
|
||||
|
||||
fn fmt_printer<'a, 'tcx>(infcx: &'a InferCtxt<'_, 'tcx>, ns: Namespace) -> FmtPrinter<'a, 'tcx> {
|
||||
fn fmt_printer<'a, 'tcx>(infcx: &'a InferCtxt<'tcx>, ns: Namespace) -> FmtPrinter<'a, 'tcx> {
|
||||
let mut printer = FmtPrinter::new(infcx.tcx, ns);
|
||||
let ty_getter = move |ty_vid| {
|
||||
if infcx.probe_ty_var(ty_vid).is_ok() {
|
||||
@ -183,7 +183,7 @@ fn fmt_printer<'a, 'tcx>(infcx: &'a InferCtxt<'_, 'tcx>, ns: Namespace) -> FmtPr
|
||||
printer
|
||||
}
|
||||
|
||||
fn ty_to_string<'tcx>(infcx: &InferCtxt<'_, 'tcx>, ty: Ty<'tcx>) -> String {
|
||||
fn ty_to_string<'tcx>(infcx: &InferCtxt<'tcx>, ty: Ty<'tcx>) -> String {
|
||||
let printer = fmt_printer(infcx, Namespace::TypeNS);
|
||||
let ty = infcx.resolve_vars_if_possible(ty);
|
||||
match ty.kind() {
|
||||
@ -202,7 +202,7 @@ fn ty_to_string<'tcx>(infcx: &InferCtxt<'_, 'tcx>, ty: Ty<'tcx>) -> String {
|
||||
/// We don't want to directly use `ty_to_string` for closures as their type isn't really
|
||||
/// something users are familiar with. Directly printing the `fn_sig` of closures also
|
||||
/// doesn't work as they actually use the "rust-call" API.
|
||||
fn closure_as_fn_str<'tcx>(infcx: &InferCtxt<'_, 'tcx>, ty: Ty<'tcx>) -> String {
|
||||
fn closure_as_fn_str<'tcx>(infcx: &InferCtxt<'tcx>, ty: Ty<'tcx>) -> String {
|
||||
let ty::Closure(_, substs) = ty.kind() else { unreachable!() };
|
||||
let fn_sig = substs.as_closure().sig();
|
||||
let args = fn_sig
|
||||
@ -226,7 +226,7 @@ fn closure_as_fn_str<'tcx>(infcx: &InferCtxt<'_, 'tcx>, ty: Ty<'tcx>) -> String
|
||||
format!("fn({}){}", args, ret)
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
impl<'tcx> InferCtxt<'tcx> {
|
||||
/// Extracts data used by diagnostic for either types or constants
|
||||
/// which were stuck during inference.
|
||||
pub fn extract_inference_diagnostics_data(
|
||||
@ -566,7 +566,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> InferCtxt<'_, 'tcx> {
|
||||
impl<'tcx> InferCtxt<'tcx> {
|
||||
pub fn need_type_info_err_in_generator(
|
||||
&self,
|
||||
kind: hir::GeneratorKind,
|
||||
@ -657,7 +657,7 @@ impl<'tcx> InferSource<'tcx> {
|
||||
}
|
||||
|
||||
impl<'tcx> InferSourceKind<'tcx> {
|
||||
fn ty_localized_msg(&self, infcx: &InferCtxt<'_, 'tcx>) -> (&'static str, String) {
|
||||
fn ty_localized_msg(&self, infcx: &InferCtxt<'tcx>) -> (&'static str, String) {
|
||||
match *self {
|
||||
InferSourceKind::LetBinding { ty, .. }
|
||||
| InferSourceKind::ClosureArg { ty, .. }
|
||||
@ -694,7 +694,7 @@ struct InsertableGenericArgs<'tcx> {
|
||||
/// While doing so, the currently best spot is stored in `infer_source`.
|
||||
/// For details on how we rank spots, see [Self::source_cost]
|
||||
struct FindInferSourceVisitor<'a, 'tcx> {
|
||||
infcx: &'a InferCtxt<'a, 'tcx>,
|
||||
infcx: &'a InferCtxt<'tcx>,
|
||||
typeck_results: &'a TypeckResults<'tcx>,
|
||||
|
||||
target: GenericArg<'tcx>,
|
||||
@ -706,7 +706,7 @@ struct FindInferSourceVisitor<'a, 'tcx> {
|
||||
|
||||
impl<'a, 'tcx> FindInferSourceVisitor<'a, 'tcx> {
|
||||
fn new(
|
||||
infcx: &'a InferCtxt<'a, 'tcx>,
|
||||
infcx: &'a InferCtxt<'tcx>,
|
||||
typeck_results: &'a TypeckResults<'tcx>,
|
||||
target: GenericArg<'tcx>,
|
||||
) -> Self {
|
||||
|
@ -38,7 +38,7 @@ use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable, TypeSuperFoldable, TypeVi
|
||||
use std::collections::hash_map::Entry;
|
||||
|
||||
pub struct TypeFreshener<'a, 'tcx> {
|
||||
infcx: &'a InferCtxt<'a, 'tcx>,
|
||||
infcx: &'a InferCtxt<'tcx>,
|
||||
ty_freshen_count: u32,
|
||||
const_freshen_count: u32,
|
||||
ty_freshen_map: FxHashMap<ty::InferTy, Ty<'tcx>>,
|
||||
@ -47,7 +47,7 @@ pub struct TypeFreshener<'a, 'tcx> {
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> TypeFreshener<'a, 'tcx> {
|
||||
pub fn new(infcx: &'a InferCtxt<'a, 'tcx>, keep_static: bool) -> TypeFreshener<'a, 'tcx> {
|
||||
pub fn new(infcx: &'a InferCtxt<'tcx>, keep_static: bool) -> TypeFreshener<'a, 'tcx> {
|
||||
TypeFreshener {
|
||||
infcx,
|
||||
ty_freshen_count: 0,
|
||||
|
@ -43,7 +43,7 @@ struct VariableLengths {
|
||||
region_constraints_len: usize,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
impl<'tcx> InferCtxt<'tcx> {
|
||||
fn variable_lengths(&self) -> VariableLengths {
|
||||
let mut inner = self.inner.borrow_mut();
|
||||
VariableLengths {
|
||||
@ -167,7 +167,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
}
|
||||
|
||||
pub struct InferenceFudger<'a, 'tcx> {
|
||||
infcx: &'a InferCtxt<'a, 'tcx>,
|
||||
infcx: &'a InferCtxt<'tcx>,
|
||||
type_vars: (Range<TyVid>, Vec<TypeVariableOrigin>),
|
||||
int_vars: Range<IntVid>,
|
||||
float_vars: Range<FloatVid>,
|
||||
|
@ -113,7 +113,7 @@ impl<'tcx> TypeRelation<'tcx> for Glb<'_, '_, 'tcx> {
|
||||
}
|
||||
|
||||
impl<'combine, 'infcx, 'tcx> LatticeDir<'infcx, 'tcx> for Glb<'combine, 'infcx, 'tcx> {
|
||||
fn infcx(&self) -> &'infcx InferCtxt<'infcx, 'tcx> {
|
||||
fn infcx(&self) -> &'infcx InferCtxt<'tcx> {
|
||||
self.fields.infcx
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ impl<'a, 'tcx> CombineFields<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
impl<'tcx> InferCtxt<'tcx> {
|
||||
/// Replaces all bound variables (lifetimes, types, and constants) bound by
|
||||
/// `binder` with placeholder variables in a new universe. This means that the
|
||||
/// new placeholders can only be named by inference variables created after
|
||||
@ -114,7 +114,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
pub fn leak_check(
|
||||
&self,
|
||||
overly_polymorphic: bool,
|
||||
snapshot: &CombinedSnapshot<'_, 'tcx>,
|
||||
snapshot: &CombinedSnapshot<'tcx>,
|
||||
) -> RelateResult<'tcx, ()> {
|
||||
// If the user gave `-Zno-leak-check`, or we have been
|
||||
// configured to skip the leak check, then skip the leak check
|
||||
|
@ -31,7 +31,7 @@ use rustc_middle::ty::{self, Ty};
|
||||
/// GLB moves "down" the lattice (to smaller values); LUB moves
|
||||
/// "up" the lattice (to bigger values).
|
||||
pub trait LatticeDir<'f, 'tcx>: TypeRelation<'tcx> {
|
||||
fn infcx(&self) -> &'f InferCtxt<'f, 'tcx>;
|
||||
fn infcx(&self) -> &'f InferCtxt<'tcx>;
|
||||
|
||||
fn cause(&self) -> &ObligationCause<'tcx>;
|
||||
|
||||
|
@ -119,7 +119,7 @@ impl<'tcx> ConstEquateRelation<'tcx> for Lub<'_, '_, 'tcx> {
|
||||
}
|
||||
|
||||
impl<'combine, 'infcx, 'tcx> LatticeDir<'infcx, 'tcx> for Lub<'combine, 'infcx, 'tcx> {
|
||||
fn infcx(&self) -> &'infcx InferCtxt<'infcx, 'tcx> {
|
||||
fn infcx(&self) -> &'infcx InferCtxt<'tcx> {
|
||||
self.fields.infcx
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,6 @@ use rustc_data_structures::undo_log::Rollback;
|
||||
use rustc_data_structures::unify as ut;
|
||||
use rustc_errors::{DiagnosticBuilder, ErrorGuaranteed};
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_hir::hir_id::OwnerId;
|
||||
use rustc_middle::infer::canonical::{Canonical, CanonicalVarValues};
|
||||
use rustc_middle::infer::unify_key::{ConstVarValue, ConstVariableValue};
|
||||
use rustc_middle::infer::unify_key::{ConstVariableOrigin, ConstVariableOriginKind, ToType};
|
||||
@ -36,7 +35,7 @@ use rustc_middle::ty::{ConstVid, FloatVid, IntVid, TyVid};
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
|
||||
use std::cell::{Cell, Ref, RefCell};
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::fmt;
|
||||
|
||||
use self::combine::CombineFields;
|
||||
@ -254,7 +253,7 @@ pub enum DefiningAnchor {
|
||||
Error,
|
||||
}
|
||||
|
||||
pub struct InferCtxt<'a, 'tcx> {
|
||||
pub struct InferCtxt<'tcx> {
|
||||
pub tcx: TyCtxt<'tcx>,
|
||||
|
||||
/// The `DefId` of the item in whose context we are performing inference or typeck.
|
||||
@ -274,12 +273,6 @@ pub struct InferCtxt<'a, 'tcx> {
|
||||
/// solving is left to borrowck instead.
|
||||
pub considering_regions: bool,
|
||||
|
||||
/// During type-checking/inference of a body, `in_progress_typeck_results`
|
||||
/// contains a reference to the typeck results being built up, which are
|
||||
/// used for reading closure kinds/signatures as they are inferred,
|
||||
/// and for error reporting logic to read arbitrary node types.
|
||||
pub in_progress_typeck_results: Option<&'a RefCell<ty::TypeckResults<'tcx>>>,
|
||||
|
||||
pub inner: RefCell<InferCtxtInner<'tcx>>,
|
||||
|
||||
/// If set, this flag causes us to skip the 'leak check' during
|
||||
@ -342,7 +335,7 @@ pub struct InferCtxt<'a, 'tcx> {
|
||||
universe: Cell<ty::UniverseIndex>,
|
||||
|
||||
normalize_fn_sig_for_diagnostic:
|
||||
Option<Lrc<dyn Fn(&InferCtxt<'_, 'tcx>, ty::PolyFnSig<'tcx>) -> ty::PolyFnSig<'tcx>>>,
|
||||
Option<Lrc<dyn Fn(&InferCtxt<'tcx>, ty::PolyFnSig<'tcx>) -> ty::PolyFnSig<'tcx>>>,
|
||||
}
|
||||
|
||||
/// See the `error_reporting` module for more details.
|
||||
@ -553,16 +546,13 @@ impl<'tcx> fmt::Display for FixupError<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
/// A temporary returned by `tcx.infer_ctxt()`. This is necessary
|
||||
/// for multiple `InferCtxt` to share the same `in_progress_typeck_results`
|
||||
/// without using `Rc` or something similar.
|
||||
/// Used to configure inference contexts before their creation
|
||||
pub struct InferCtxtBuilder<'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
defining_use_anchor: DefiningAnchor,
|
||||
considering_regions: bool,
|
||||
fresh_typeck_results: Option<RefCell<ty::TypeckResults<'tcx>>>,
|
||||
normalize_fn_sig_for_diagnostic:
|
||||
Option<Lrc<dyn Fn(&InferCtxt<'_, 'tcx>, ty::PolyFnSig<'tcx>) -> ty::PolyFnSig<'tcx>>>,
|
||||
Option<Lrc<dyn Fn(&InferCtxt<'tcx>, ty::PolyFnSig<'tcx>) -> ty::PolyFnSig<'tcx>>>,
|
||||
}
|
||||
|
||||
pub trait TyCtxtInferExt<'tcx> {
|
||||
@ -575,26 +565,17 @@ impl<'tcx> TyCtxtInferExt<'tcx> for TyCtxt<'tcx> {
|
||||
tcx: self,
|
||||
defining_use_anchor: DefiningAnchor::Error,
|
||||
considering_regions: true,
|
||||
fresh_typeck_results: None,
|
||||
normalize_fn_sig_for_diagnostic: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> InferCtxtBuilder<'tcx> {
|
||||
/// Used only by `rustc_hir_analysis` during body type-checking/inference,
|
||||
/// will initialize `in_progress_typeck_results` with fresh `TypeckResults`.
|
||||
/// Will also change the scope for opaque type defining use checks to the given owner.
|
||||
pub fn with_fresh_in_progress_typeck_results(mut self, table_owner: OwnerId) -> Self {
|
||||
self.fresh_typeck_results = Some(RefCell::new(ty::TypeckResults::new(table_owner)));
|
||||
self.with_opaque_type_inference(DefiningAnchor::Bind(table_owner.def_id))
|
||||
}
|
||||
|
||||
/// Whenever the `InferCtxt` should be able to handle defining uses of opaque types,
|
||||
/// you need to call this function. Otherwise the opaque type will be treated opaquely.
|
||||
///
|
||||
/// It is only meant to be called in two places, for typeck
|
||||
/// (via `with_fresh_in_progress_typeck_results`) and for the inference context used
|
||||
/// (via `Inherited::build`) and for the inference context used
|
||||
/// in mir borrowck.
|
||||
pub fn with_opaque_type_inference(mut self, defining_use_anchor: DefiningAnchor) -> Self {
|
||||
self.defining_use_anchor = defining_use_anchor;
|
||||
@ -608,7 +589,7 @@ impl<'tcx> InferCtxtBuilder<'tcx> {
|
||||
|
||||
pub fn with_normalize_fn_sig_for_diagnostic(
|
||||
mut self,
|
||||
fun: Lrc<dyn Fn(&InferCtxt<'_, 'tcx>, ty::PolyFnSig<'tcx>) -> ty::PolyFnSig<'tcx>>,
|
||||
fun: Lrc<dyn Fn(&InferCtxt<'tcx>, ty::PolyFnSig<'tcx>) -> ty::PolyFnSig<'tcx>>,
|
||||
) -> Self {
|
||||
self.normalize_fn_sig_for_diagnostic = Some(fun);
|
||||
self
|
||||
@ -625,7 +606,7 @@ impl<'tcx> InferCtxtBuilder<'tcx> {
|
||||
&mut self,
|
||||
span: Span,
|
||||
canonical: &Canonical<'tcx, T>,
|
||||
f: impl for<'a> FnOnce(InferCtxt<'a, 'tcx>, T, CanonicalVarValues<'tcx>) -> R,
|
||||
f: impl FnOnce(InferCtxt<'tcx>, T, CanonicalVarValues<'tcx>) -> R,
|
||||
) -> R
|
||||
where
|
||||
T: TypeFoldable<'tcx>,
|
||||
@ -637,20 +618,17 @@ impl<'tcx> InferCtxtBuilder<'tcx> {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn enter<R>(&mut self, f: impl for<'a> FnOnce(InferCtxt<'a, 'tcx>) -> R) -> R {
|
||||
pub fn enter<R>(&mut self, f: impl FnOnce(InferCtxt<'tcx>) -> R) -> R {
|
||||
let InferCtxtBuilder {
|
||||
tcx,
|
||||
defining_use_anchor,
|
||||
considering_regions,
|
||||
ref fresh_typeck_results,
|
||||
ref normalize_fn_sig_for_diagnostic,
|
||||
} = *self;
|
||||
let in_progress_typeck_results = fresh_typeck_results.as_ref();
|
||||
f(InferCtxt {
|
||||
tcx,
|
||||
defining_use_anchor,
|
||||
considering_regions,
|
||||
in_progress_typeck_results,
|
||||
inner: RefCell::new(InferCtxtInner::new()),
|
||||
lexical_region_resolutions: RefCell::new(None),
|
||||
selection_cache: Default::default(),
|
||||
@ -677,7 +655,7 @@ impl<'tcx, T> InferOk<'tcx, T> {
|
||||
/// Extracts `value`, registering any obligations into `fulfill_cx`.
|
||||
pub fn into_value_registering_obligations(
|
||||
self,
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
fulfill_cx: &mut dyn TraitEngine<'tcx>,
|
||||
) -> T {
|
||||
let InferOk { value, obligations } = self;
|
||||
@ -693,18 +671,17 @@ impl<'tcx> InferOk<'tcx, ()> {
|
||||
}
|
||||
|
||||
#[must_use = "once you start a snapshot, you should always consume it"]
|
||||
pub struct CombinedSnapshot<'a, 'tcx> {
|
||||
pub struct CombinedSnapshot<'tcx> {
|
||||
undo_snapshot: Snapshot<'tcx>,
|
||||
region_constraints_snapshot: RegionSnapshot,
|
||||
universe: ty::UniverseIndex,
|
||||
was_in_snapshot: bool,
|
||||
_in_progress_typeck_results: Option<Ref<'a, ty::TypeckResults<'tcx>>>,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
impl<'tcx> InferCtxt<'tcx> {
|
||||
/// Creates a `TypeErrCtxt` for emitting various inference errors.
|
||||
/// During typeck, use `FnCtxt::infer_err` instead.
|
||||
pub fn err_ctxt(&'a self) -> TypeErrCtxt<'a, 'tcx> {
|
||||
pub fn err_ctxt(&self) -> TypeErrCtxt<'_, 'tcx> {
|
||||
TypeErrCtxt { infcx: self, typeck_results: None }
|
||||
}
|
||||
|
||||
@ -746,7 +723,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
/// if this is not a type variable.
|
||||
///
|
||||
/// No attempt is made to resolve `ty`.
|
||||
pub fn type_var_origin(&'a self, ty: Ty<'tcx>) -> Option<TypeVariableOrigin> {
|
||||
pub fn type_var_origin(&self, ty: Ty<'tcx>) -> Option<TypeVariableOrigin> {
|
||||
match *ty.kind() {
|
||||
ty::Infer(ty::TyVar(vid)) => {
|
||||
Some(*self.inner.borrow_mut().type_variables().var_origin(vid))
|
||||
@ -787,7 +764,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
vars
|
||||
}
|
||||
|
||||
fn combine_fields(
|
||||
fn combine_fields<'a>(
|
||||
&'a self,
|
||||
trace: TypeTrace<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
@ -829,7 +806,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
result
|
||||
}
|
||||
|
||||
fn start_snapshot(&self) -> CombinedSnapshot<'a, 'tcx> {
|
||||
fn start_snapshot(&self) -> CombinedSnapshot<'tcx> {
|
||||
debug!("start_snapshot()");
|
||||
|
||||
let in_snapshot = self.in_snapshot.replace(true);
|
||||
@ -841,22 +818,16 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
region_constraints_snapshot: inner.unwrap_region_constraints().start_snapshot(),
|
||||
universe: self.universe(),
|
||||
was_in_snapshot: in_snapshot,
|
||||
// Borrow typeck results "in progress" (i.e., during typeck)
|
||||
// to ban writes from within a snapshot to them.
|
||||
_in_progress_typeck_results: self
|
||||
.in_progress_typeck_results
|
||||
.map(|typeck_results| typeck_results.borrow()),
|
||||
}
|
||||
}
|
||||
|
||||
#[instrument(skip(self, snapshot), level = "debug")]
|
||||
fn rollback_to(&self, cause: &str, snapshot: CombinedSnapshot<'a, 'tcx>) {
|
||||
fn rollback_to(&self, cause: &str, snapshot: CombinedSnapshot<'tcx>) {
|
||||
let CombinedSnapshot {
|
||||
undo_snapshot,
|
||||
region_constraints_snapshot,
|
||||
universe,
|
||||
was_in_snapshot,
|
||||
_in_progress_typeck_results,
|
||||
} = snapshot;
|
||||
|
||||
self.in_snapshot.set(was_in_snapshot);
|
||||
@ -868,13 +839,12 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
}
|
||||
|
||||
#[instrument(skip(self, snapshot), level = "debug")]
|
||||
fn commit_from(&self, snapshot: CombinedSnapshot<'a, 'tcx>) {
|
||||
fn commit_from(&self, snapshot: CombinedSnapshot<'tcx>) {
|
||||
let CombinedSnapshot {
|
||||
undo_snapshot,
|
||||
region_constraints_snapshot: _,
|
||||
universe: _,
|
||||
was_in_snapshot,
|
||||
_in_progress_typeck_results,
|
||||
} = snapshot;
|
||||
|
||||
self.in_snapshot.set(was_in_snapshot);
|
||||
@ -886,7 +856,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
#[instrument(skip(self, f), level = "debug")]
|
||||
pub fn commit_if_ok<T, E, F>(&self, f: F) -> Result<T, E>
|
||||
where
|
||||
F: FnOnce(&CombinedSnapshot<'a, 'tcx>) -> Result<T, E>,
|
||||
F: FnOnce(&CombinedSnapshot<'tcx>) -> Result<T, E>,
|
||||
{
|
||||
let snapshot = self.start_snapshot();
|
||||
let r = f(&snapshot);
|
||||
@ -906,7 +876,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
#[instrument(skip(self, f), level = "debug")]
|
||||
pub fn probe<R, F>(&self, f: F) -> R
|
||||
where
|
||||
F: FnOnce(&CombinedSnapshot<'a, 'tcx>) -> R,
|
||||
F: FnOnce(&CombinedSnapshot<'tcx>) -> R,
|
||||
{
|
||||
let snapshot = self.start_snapshot();
|
||||
let r = f(&snapshot);
|
||||
@ -918,7 +888,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
#[instrument(skip(self, f), level = "debug")]
|
||||
pub fn probe_maybe_skip_leak_check<R, F>(&self, should_skip: bool, f: F) -> R
|
||||
where
|
||||
F: FnOnce(&CombinedSnapshot<'a, 'tcx>) -> R,
|
||||
F: FnOnce(&CombinedSnapshot<'tcx>) -> R,
|
||||
{
|
||||
let snapshot = self.start_snapshot();
|
||||
let was_skip_leak_check = self.skip_leak_check.get();
|
||||
@ -938,7 +908,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
/// - `Some(false)` -- if there are `'a: 'b` constraints but none involve placeholders
|
||||
pub fn region_constraints_added_in_snapshot(
|
||||
&self,
|
||||
snapshot: &CombinedSnapshot<'a, 'tcx>,
|
||||
snapshot: &CombinedSnapshot<'tcx>,
|
||||
) -> Option<bool> {
|
||||
self.inner
|
||||
.borrow_mut()
|
||||
@ -946,7 +916,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
.region_constraints_added_in_snapshot(&snapshot.undo_snapshot)
|
||||
}
|
||||
|
||||
pub fn opaque_types_added_in_snapshot(&self, snapshot: &CombinedSnapshot<'a, 'tcx>) -> bool {
|
||||
pub fn opaque_types_added_in_snapshot(&self, snapshot: &CombinedSnapshot<'tcx>) -> bool {
|
||||
self.inner.borrow().undo_log.opaque_types_in_snapshot(&snapshot.undo_snapshot)
|
||||
}
|
||||
|
||||
@ -1519,7 +1489,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
}
|
||||
|
||||
struct ToFreshVars<'a, 'tcx> {
|
||||
infcx: &'a InferCtxt<'a, 'tcx>,
|
||||
infcx: &'a InferCtxt<'tcx>,
|
||||
span: Span,
|
||||
lbrct: LateBoundRegionConversionTime,
|
||||
map: FxHashMap<ty::BoundVar, ty::GenericArg<'tcx>>,
|
||||
@ -1893,7 +1863,7 @@ impl<'tcx> TypeFolder<'tcx> for InferenceLiteralEraser<'tcx> {
|
||||
}
|
||||
|
||||
struct ShallowResolver<'a, 'tcx> {
|
||||
infcx: &'a InferCtxt<'a, 'tcx>,
|
||||
infcx: &'a InferCtxt<'tcx>,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> TypeFolder<'tcx> for ShallowResolver<'a, 'tcx> {
|
||||
|
@ -44,7 +44,7 @@ pub struct TypeRelating<'me, 'tcx, D>
|
||||
where
|
||||
D: TypeRelatingDelegate<'tcx>,
|
||||
{
|
||||
infcx: &'me InferCtxt<'me, 'tcx>,
|
||||
infcx: &'me InferCtxt<'tcx>,
|
||||
|
||||
/// Callback to use when we deduce an outlives relationship.
|
||||
delegate: D,
|
||||
@ -149,11 +149,7 @@ impl<'me, 'tcx, D> TypeRelating<'me, 'tcx, D>
|
||||
where
|
||||
D: TypeRelatingDelegate<'tcx>,
|
||||
{
|
||||
pub fn new(
|
||||
infcx: &'me InferCtxt<'me, 'tcx>,
|
||||
delegate: D,
|
||||
ambient_variance: ty::Variance,
|
||||
) -> Self {
|
||||
pub fn new(infcx: &'me InferCtxt<'tcx>, delegate: D, ambient_variance: ty::Variance) -> Self {
|
||||
Self {
|
||||
infcx,
|
||||
delegate,
|
||||
@ -867,7 +863,7 @@ struct TypeGeneralizer<'me, 'tcx, D>
|
||||
where
|
||||
D: TypeRelatingDelegate<'tcx>,
|
||||
{
|
||||
infcx: &'me InferCtxt<'me, 'tcx>,
|
||||
infcx: &'me InferCtxt<'tcx>,
|
||||
|
||||
delegate: &'me mut D,
|
||||
|
||||
|
@ -41,7 +41,7 @@ pub struct OpaqueTypeDecl<'tcx> {
|
||||
pub origin: hir::OpaqueTyOrigin,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
impl<'tcx> InferCtxt<'tcx> {
|
||||
/// This is a backwards compatibility hack to prevent breaking changes from
|
||||
/// lazy TAIT around RPIT handling.
|
||||
pub fn replace_opaque_types_with_inference_vars<T: TypeFoldable<'tcx>>(
|
||||
@ -511,7 +511,7 @@ impl UseKind {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
impl<'tcx> InferCtxt<'tcx> {
|
||||
#[instrument(skip(self), level = "debug")]
|
||||
pub fn register_hidden_type(
|
||||
&self,
|
||||
|
@ -87,9 +87,9 @@ impl<'tcx> OutlivesEnvironment<'tcx> {
|
||||
}
|
||||
|
||||
/// Create a new `OutlivesEnvironment` with extra outlives bounds.
|
||||
pub fn with_bounds<'a>(
|
||||
pub fn with_bounds(
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
infcx: Option<&InferCtxt<'a, 'tcx>>,
|
||||
infcx: Option<&InferCtxt<'tcx>>,
|
||||
extra_bounds: impl IntoIterator<Item = OutlivesBound<'tcx>>,
|
||||
) -> Self {
|
||||
let mut builder = Self::builder(param_env);
|
||||
@ -108,7 +108,7 @@ impl<'tcx> OutlivesEnvironment<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> OutlivesEnvironmentBuilder<'tcx> {
|
||||
impl<'tcx> OutlivesEnvironmentBuilder<'tcx> {
|
||||
#[inline]
|
||||
#[instrument(level = "debug")]
|
||||
fn build(self) -> OutlivesEnvironment<'tcx> {
|
||||
@ -125,7 +125,7 @@ impl<'a, 'tcx> OutlivesEnvironmentBuilder<'tcx> {
|
||||
/// contain inference variables, it must be supplied, in which
|
||||
/// case we will register "givens" on the inference context. (See
|
||||
/// `RegionConstraintData`.)
|
||||
fn add_outlives_bounds<I>(&mut self, infcx: Option<&InferCtxt<'a, 'tcx>>, outlives_bounds: I)
|
||||
fn add_outlives_bounds<I>(&mut self, infcx: Option<&InferCtxt<'tcx>>, outlives_bounds: I)
|
||||
where
|
||||
I: IntoIterator<Item = OutlivesBound<'tcx>>,
|
||||
{
|
||||
|
@ -75,7 +75,7 @@ use rustc_middle::ty::subst::GenericArgKind;
|
||||
use rustc_middle::ty::{self, Region, SubstsRef, Ty, TyCtxt, TypeVisitable};
|
||||
use smallvec::smallvec;
|
||||
|
||||
impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
|
||||
impl<'tcx> InferCtxt<'tcx> {
|
||||
/// Registers that the given region obligation must be resolved
|
||||
/// from within the scope of `body_id`. These regions are enqueued
|
||||
/// and later processed by regionck, when full type information is
|
||||
@ -523,7 +523,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<'cx, 'tcx> TypeOutlivesDelegate<'tcx> for &'cx InferCtxt<'cx, 'tcx> {
|
||||
impl<'cx, 'tcx> TypeOutlivesDelegate<'tcx> for &'cx InferCtxt<'tcx> {
|
||||
fn push_sub_region_constraint(
|
||||
&mut self,
|
||||
origin: SubregionOrigin<'tcx>,
|
||||
|
@ -6,7 +6,7 @@ use crate::traits::{Obligation, PredicateObligation};
|
||||
use super::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
|
||||
use super::InferCtxt;
|
||||
|
||||
impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
impl<'tcx> InferCtxt<'tcx> {
|
||||
/// Instead of normalizing an associated type projection,
|
||||
/// this function generates an inference variable and registers
|
||||
/// an obligation that this inference variable must be the result
|
||||
|
@ -66,7 +66,7 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
overly_polymorphic: bool,
|
||||
max_universe: ty::UniverseIndex,
|
||||
snapshot: &CombinedSnapshot<'_, 'tcx>,
|
||||
snapshot: &CombinedSnapshot<'tcx>,
|
||||
) -> RelateResult<'tcx, ()> {
|
||||
debug!(
|
||||
"leak_check(max_universe={:?}, snapshot.universe={:?}, overly_polymorphic={:?})",
|
||||
|
@ -16,12 +16,12 @@ use std::ops::ControlFlow;
|
||||
/// useful for printing messages etc but also required at various
|
||||
/// points for correctness.
|
||||
pub struct OpportunisticVarResolver<'a, 'tcx> {
|
||||
infcx: &'a InferCtxt<'a, 'tcx>,
|
||||
infcx: &'a InferCtxt<'tcx>,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> OpportunisticVarResolver<'a, 'tcx> {
|
||||
#[inline]
|
||||
pub fn new(infcx: &'a InferCtxt<'a, 'tcx>) -> Self {
|
||||
pub fn new(infcx: &'a InferCtxt<'tcx>) -> Self {
|
||||
OpportunisticVarResolver { infcx }
|
||||
}
|
||||
}
|
||||
@ -62,11 +62,11 @@ impl<'a, 'tcx> TypeFolder<'tcx> for OpportunisticVarResolver<'a, 'tcx> {
|
||||
/// If you want to resolve type and const variables as well, call
|
||||
/// [InferCtxt::resolve_vars_if_possible] first.
|
||||
pub struct OpportunisticRegionResolver<'a, 'tcx> {
|
||||
infcx: &'a InferCtxt<'a, 'tcx>,
|
||||
infcx: &'a InferCtxt<'tcx>,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> OpportunisticRegionResolver<'a, 'tcx> {
|
||||
pub fn new(infcx: &'a InferCtxt<'a, 'tcx>) -> Self {
|
||||
pub fn new(infcx: &'a InferCtxt<'tcx>) -> Self {
|
||||
OpportunisticRegionResolver { infcx }
|
||||
}
|
||||
}
|
||||
@ -116,11 +116,11 @@ impl<'a, 'tcx> TypeFolder<'tcx> for OpportunisticRegionResolver<'a, 'tcx> {
|
||||
/// It does not construct the fully resolved type (which might
|
||||
/// involve some hashing and so forth).
|
||||
pub struct UnresolvedTypeFinder<'a, 'tcx> {
|
||||
infcx: &'a InferCtxt<'a, 'tcx>,
|
||||
infcx: &'a InferCtxt<'tcx>,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> UnresolvedTypeFinder<'a, 'tcx> {
|
||||
pub fn new(infcx: &'a InferCtxt<'a, 'tcx>) -> Self {
|
||||
pub fn new(infcx: &'a InferCtxt<'tcx>) -> Self {
|
||||
UnresolvedTypeFinder { infcx }
|
||||
}
|
||||
}
|
||||
@ -167,7 +167,7 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for UnresolvedTypeFinder<'a, 'tcx> {
|
||||
/// Full type resolution replaces all type and region variables with
|
||||
/// their concrete results. If any variable cannot be replaced (never unified, etc)
|
||||
/// then an `Err` result is returned.
|
||||
pub fn fully_resolve<'a, 'tcx, T>(infcx: &InferCtxt<'a, 'tcx>, value: T) -> FixupResult<'tcx, T>
|
||||
pub fn fully_resolve<'tcx, T>(infcx: &InferCtxt<'tcx>, value: T) -> FixupResult<'tcx, T>
|
||||
where
|
||||
T: TypeFoldable<'tcx>,
|
||||
{
|
||||
@ -177,7 +177,7 @@ where
|
||||
// N.B. This type is not public because the protocol around checking the
|
||||
// `err` field is not enforceable otherwise.
|
||||
struct FullTypeResolver<'a, 'tcx> {
|
||||
infcx: &'a InferCtxt<'a, 'tcx>,
|
||||
infcx: &'a InferCtxt<'tcx>,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> FallibleTypeFolder<'tcx> for FullTypeResolver<'a, 'tcx> {
|
||||
|
@ -10,7 +10,7 @@ use super::{ObligationCause, PredicateObligation};
|
||||
pub trait TraitEngine<'tcx>: 'tcx {
|
||||
fn normalize_projection_type(
|
||||
&mut self,
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
projection_ty: ty::ProjectionTy<'tcx>,
|
||||
cause: ObligationCause<'tcx>,
|
||||
@ -21,7 +21,7 @@ pub trait TraitEngine<'tcx>: 'tcx {
|
||||
/// parameters (except for `Self`).
|
||||
fn register_bound(
|
||||
&mut self,
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
ty: Ty<'tcx>,
|
||||
def_id: DefId,
|
||||
@ -41,14 +41,13 @@ pub trait TraitEngine<'tcx>: 'tcx {
|
||||
|
||||
fn register_predicate_obligation(
|
||||
&mut self,
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
obligation: PredicateObligation<'tcx>,
|
||||
);
|
||||
|
||||
fn select_all_or_error(&mut self, infcx: &InferCtxt<'_, 'tcx>) -> Vec<FulfillmentError<'tcx>>;
|
||||
fn select_all_or_error(&mut self, infcx: &InferCtxt<'tcx>) -> Vec<FulfillmentError<'tcx>>;
|
||||
|
||||
fn select_where_possible(&mut self, infcx: &InferCtxt<'_, 'tcx>)
|
||||
-> Vec<FulfillmentError<'tcx>>;
|
||||
fn select_where_possible(&mut self, infcx: &InferCtxt<'tcx>) -> Vec<FulfillmentError<'tcx>>;
|
||||
|
||||
fn pending_obligations(&self) -> Vec<PredicateObligation<'tcx>>;
|
||||
|
||||
@ -58,7 +57,7 @@ pub trait TraitEngine<'tcx>: 'tcx {
|
||||
pub trait TraitEngineExt<'tcx> {
|
||||
fn register_predicate_obligations(
|
||||
&mut self,
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
obligations: impl IntoIterator<Item = PredicateObligation<'tcx>>,
|
||||
);
|
||||
}
|
||||
@ -66,7 +65,7 @@ pub trait TraitEngineExt<'tcx> {
|
||||
impl<'tcx, T: ?Sized + TraitEngine<'tcx>> TraitEngineExt<'tcx> for T {
|
||||
fn register_predicate_obligations(
|
||||
&mut self,
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
obligations: impl IntoIterator<Item = PredicateObligation<'tcx>>,
|
||||
) {
|
||||
for obligation in obligations {
|
||||
|
@ -10,7 +10,7 @@ use rustc_span::Span;
|
||||
use std::fmt;
|
||||
use std::iter;
|
||||
|
||||
impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
impl<'tcx> InferCtxt<'tcx> {
|
||||
pub fn report_extra_impl_obligation(
|
||||
&self,
|
||||
error_span: Span,
|
||||
|
@ -157,7 +157,7 @@ struct BlockContext(Vec<BlockFrame>);
|
||||
|
||||
struct Builder<'a, 'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
infcx: InferCtxt<'a, 'tcx>,
|
||||
infcx: InferCtxt<'tcx>,
|
||||
typeck_results: &'tcx TypeckResults<'tcx>,
|
||||
region_scope_tree: &'tcx region::ScopeTree,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
@ -683,7 +683,7 @@ fn construct_error<'tcx>(
|
||||
impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
fn new(
|
||||
thir: &'a Thir<'tcx>,
|
||||
infcx: InferCtxt<'a, 'tcx>,
|
||||
infcx: InferCtxt<'tcx>,
|
||||
def: ty::WithOptConstParam<LocalDefId>,
|
||||
hir_id: hir::HirId,
|
||||
span: Span,
|
||||
|
@ -35,7 +35,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
struct ConstToPat<'a, 'tcx> {
|
||||
struct ConstToPat<'tcx> {
|
||||
id: hir::HirId,
|
||||
span: Span,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
@ -55,7 +55,7 @@ struct ConstToPat<'a, 'tcx> {
|
||||
behind_reference: Cell<bool>,
|
||||
|
||||
// inference context used for checking `T: Structural` bounds.
|
||||
infcx: InferCtxt<'a, 'tcx>,
|
||||
infcx: InferCtxt<'tcx>,
|
||||
|
||||
include_lint_checks: bool,
|
||||
|
||||
@ -71,21 +71,19 @@ mod fallback_to_const_ref {
|
||||
/// hoops to get a reference to the value.
|
||||
pub(super) struct FallbackToConstRef(());
|
||||
|
||||
pub(super) fn fallback_to_const_ref<'a, 'tcx>(
|
||||
c2p: &super::ConstToPat<'a, 'tcx>,
|
||||
) -> FallbackToConstRef {
|
||||
pub(super) fn fallback_to_const_ref<'tcx>(c2p: &super::ConstToPat<'tcx>) -> FallbackToConstRef {
|
||||
assert!(c2p.behind_reference.get());
|
||||
FallbackToConstRef(())
|
||||
}
|
||||
}
|
||||
use fallback_to_const_ref::{fallback_to_const_ref, FallbackToConstRef};
|
||||
|
||||
impl<'a, 'tcx> ConstToPat<'a, 'tcx> {
|
||||
impl<'tcx> ConstToPat<'tcx> {
|
||||
fn new(
|
||||
pat_ctxt: &PatCtxt<'_, 'tcx>,
|
||||
id: hir::HirId,
|
||||
span: Span,
|
||||
infcx: InferCtxt<'a, 'tcx>,
|
||||
infcx: InferCtxt<'tcx>,
|
||||
) -> Self {
|
||||
trace!(?pat_ctxt.typeck_results.hir_owner);
|
||||
ConstToPat {
|
||||
|
@ -25,7 +25,7 @@ struct AutoderefSnapshot<'tcx> {
|
||||
|
||||
pub struct Autoderef<'a, 'tcx> {
|
||||
// Meta infos:
|
||||
infcx: &'a InferCtxt<'a, 'tcx>,
|
||||
infcx: &'a InferCtxt<'tcx>,
|
||||
span: Span,
|
||||
overloaded_span: Span,
|
||||
body_id: hir::HirId,
|
||||
@ -94,7 +94,7 @@ impl<'a, 'tcx> Iterator for Autoderef<'a, 'tcx> {
|
||||
|
||||
impl<'a, 'tcx> Autoderef<'a, 'tcx> {
|
||||
pub fn new(
|
||||
infcx: &'a InferCtxt<'a, 'tcx>,
|
||||
infcx: &'a InferCtxt<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
body_id: hir::HirId,
|
||||
span: Span,
|
||||
|
@ -59,7 +59,7 @@ pub trait InferCtxtExt<'tcx> {
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
) -> traits::EvaluationResult;
|
||||
}
|
||||
impl<'cx, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'cx, 'tcx> {
|
||||
impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
|
||||
fn type_is_copy_modulo_regions(
|
||||
&self,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
@ -142,7 +142,7 @@ pub trait InferCtxtBuilderExt<'tcx> {
|
||||
fn enter_canonical_trait_query<K, R>(
|
||||
&mut self,
|
||||
canonical_key: &Canonical<'tcx, K>,
|
||||
operation: impl FnOnce(&InferCtxt<'_, 'tcx>, &mut dyn TraitEngine<'tcx>, K) -> Fallible<R>,
|
||||
operation: impl FnOnce(&InferCtxt<'tcx>, &mut dyn TraitEngine<'tcx>, K) -> Fallible<R>,
|
||||
) -> Fallible<CanonicalizedQueryResponse<'tcx, R>>
|
||||
where
|
||||
K: TypeFoldable<'tcx>,
|
||||
@ -170,7 +170,7 @@ impl<'tcx> InferCtxtBuilderExt<'tcx> for InferCtxtBuilder<'tcx> {
|
||||
fn enter_canonical_trait_query<K, R>(
|
||||
&mut self,
|
||||
canonical_key: &Canonical<'tcx, K>,
|
||||
operation: impl FnOnce(&InferCtxt<'_, 'tcx>, &mut dyn TraitEngine<'tcx>, K) -> Fallible<R>,
|
||||
operation: impl FnOnce(&InferCtxt<'tcx>, &mut dyn TraitEngine<'tcx>, K) -> Fallible<R>,
|
||||
) -> Fallible<CanonicalizedQueryResponse<'tcx, R>>
|
||||
where
|
||||
K: TypeFoldable<'tcx>,
|
||||
|
@ -272,7 +272,7 @@ impl<'tcx> AutoTraitFinder<'tcx> {
|
||||
/// user.
|
||||
fn evaluate_predicates(
|
||||
&self,
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
trait_did: DefId,
|
||||
ty: Ty<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
@ -877,7 +877,7 @@ impl<'tcx> AutoTraitFinder<'tcx> {
|
||||
|
||||
pub fn clean_pred(
|
||||
&self,
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
p: ty::Predicate<'tcx>,
|
||||
) -> ty::Predicate<'tcx> {
|
||||
infcx.freshen(p)
|
||||
|
@ -28,7 +28,7 @@ impl FulfillmentContext<'_> {
|
||||
impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> {
|
||||
fn normalize_projection_type(
|
||||
&mut self,
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
_param_env: ty::ParamEnv<'tcx>,
|
||||
projection_ty: ty::ProjectionTy<'tcx>,
|
||||
_cause: ObligationCause<'tcx>,
|
||||
@ -38,7 +38,7 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> {
|
||||
|
||||
fn register_predicate_obligation(
|
||||
&mut self,
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
obligation: PredicateObligation<'tcx>,
|
||||
) {
|
||||
assert!(!infcx.is_in_snapshot());
|
||||
@ -49,7 +49,7 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> {
|
||||
self.obligations.insert(obligation);
|
||||
}
|
||||
|
||||
fn select_all_or_error(&mut self, infcx: &InferCtxt<'_, 'tcx>) -> Vec<FulfillmentError<'tcx>> {
|
||||
fn select_all_or_error(&mut self, infcx: &InferCtxt<'tcx>) -> Vec<FulfillmentError<'tcx>> {
|
||||
{
|
||||
let errors = self.select_where_possible(infcx);
|
||||
|
||||
@ -71,10 +71,7 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> {
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn select_where_possible(
|
||||
&mut self,
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
) -> Vec<FulfillmentError<'tcx>> {
|
||||
fn select_where_possible(&mut self, infcx: &InferCtxt<'tcx>) -> Vec<FulfillmentError<'tcx>> {
|
||||
assert!(!infcx.is_in_snapshot());
|
||||
|
||||
let mut errors = Vec::new();
|
||||
|
@ -167,7 +167,7 @@ fn overlap_within_probe<'cx, 'tcx>(
|
||||
impl1_def_id: DefId,
|
||||
impl2_def_id: DefId,
|
||||
overlap_mode: OverlapMode,
|
||||
snapshot: &CombinedSnapshot<'_, 'tcx>,
|
||||
snapshot: &CombinedSnapshot<'tcx>,
|
||||
) -> Option<OverlapResult<'tcx>> {
|
||||
let infcx = selcx.infcx();
|
||||
|
||||
@ -327,8 +327,8 @@ fn negative_impl<'cx, 'tcx>(
|
||||
})
|
||||
}
|
||||
|
||||
fn equate<'cx, 'tcx>(
|
||||
infcx: &InferCtxt<'cx, 'tcx>,
|
||||
fn equate<'tcx>(
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
impl_env: ty::ParamEnv<'tcx>,
|
||||
subject1: ImplSubject<'tcx>,
|
||||
subject2: ImplSubject<'tcx>,
|
||||
@ -379,8 +379,8 @@ fn negative_impl_exists<'cx, 'tcx>(
|
||||
}
|
||||
|
||||
#[instrument(level = "debug", skip(infcx))]
|
||||
fn resolve_negative_obligation<'cx, 'tcx>(
|
||||
infcx: InferCtxt<'cx, 'tcx>,
|
||||
fn resolve_negative_obligation<'tcx>(
|
||||
infcx: InferCtxt<'tcx>,
|
||||
o: &PredicateObligation<'tcx>,
|
||||
body_def_id: DefId,
|
||||
) -> bool {
|
||||
|
@ -159,8 +159,8 @@ pub fn try_unify_abstract_consts<'tcx>(
|
||||
|
||||
/// Check if a given constant can be evaluated.
|
||||
#[instrument(skip(infcx), level = "debug")]
|
||||
pub fn is_const_evaluatable<'cx, 'tcx>(
|
||||
infcx: &InferCtxt<'cx, 'tcx>,
|
||||
pub fn is_const_evaluatable<'tcx>(
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
uv: ty::UnevaluatedConst<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
span: Span,
|
||||
|
@ -41,16 +41,16 @@ impl<'tcx> TraitEngineExt<'tcx> for dyn TraitEngine<'tcx> {
|
||||
/// Used if you want to have pleasant experience when dealing
|
||||
/// with obligations outside of hir or mir typeck.
|
||||
pub struct ObligationCtxt<'a, 'tcx> {
|
||||
pub infcx: &'a InferCtxt<'a, 'tcx>,
|
||||
pub infcx: &'a InferCtxt<'tcx>,
|
||||
engine: RefCell<Box<dyn TraitEngine<'tcx>>>,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> ObligationCtxt<'a, 'tcx> {
|
||||
pub fn new(infcx: &'a InferCtxt<'a, 'tcx>) -> Self {
|
||||
pub fn new(infcx: &'a InferCtxt<'tcx>) -> Self {
|
||||
Self { infcx, engine: RefCell::new(<dyn TraitEngine<'_>>::new(infcx.tcx)) }
|
||||
}
|
||||
|
||||
pub fn new_in_snapshot(infcx: &'a InferCtxt<'a, 'tcx>) -> Self {
|
||||
pub fn new_in_snapshot(infcx: &'a InferCtxt<'tcx>) -> Self {
|
||||
Self { infcx, engine: RefCell::new(<dyn TraitEngine<'_>>::new_in_snapshot(infcx.tcx)) }
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@ pub trait TypeErrCtxtExt<'tcx> {
|
||||
);
|
||||
}
|
||||
|
||||
impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'_, 'tcx> {
|
||||
impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
|
||||
/// Given some node representing a fn-like thing in the HIR map,
|
||||
/// returns a span and `ArgKind` information that describes the
|
||||
/// arguments it expects. This can be supplied to
|
||||
@ -2515,7 +2515,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
pred: ty::PolyTraitRef<'tcx>,
|
||||
) -> bool {
|
||||
struct ParamToVarFolder<'a, 'tcx> {
|
||||
infcx: &'a InferCtxt<'a, 'tcx>,
|
||||
infcx: &'a InferCtxt<'tcx>,
|
||||
var_map: FxHashMap<Ty<'tcx>, Ty<'tcx>>,
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ impl<'tcx, 'a> GeneratorData<'tcx, 'a> {
|
||||
// meet an obligation
|
||||
fn try_get_upvar_span<F>(
|
||||
&self,
|
||||
infer_context: &InferCtxt<'a, 'tcx>,
|
||||
infer_context: &InferCtxt<'tcx>,
|
||||
generator_did: DefId,
|
||||
ty_matches: F,
|
||||
) -> Option<GeneratorInteriorOrUpvar>
|
||||
@ -1586,7 +1586,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
expected: ty::PolyTraitRef<'tcx>,
|
||||
) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
|
||||
pub(crate) fn build_fn_sig_ty<'tcx>(
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
trait_ref: ty::PolyTraitRef<'tcx>,
|
||||
) -> Ty<'tcx> {
|
||||
let inputs = trait_ref.skip_binder().substs.type_at(1);
|
||||
|
@ -137,7 +137,7 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> {
|
||||
#[instrument(level = "debug", skip(self, infcx, param_env, cause))]
|
||||
fn normalize_projection_type(
|
||||
&mut self,
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
projection_ty: ty::ProjectionTy<'tcx>,
|
||||
cause: ObligationCause<'tcx>,
|
||||
@ -165,7 +165,7 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> {
|
||||
|
||||
fn register_predicate_obligation(
|
||||
&mut self,
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
obligation: PredicateObligation<'tcx>,
|
||||
) {
|
||||
// this helps to reduce duplicate errors, as well as making
|
||||
@ -182,7 +182,7 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> {
|
||||
.register_obligation(PendingPredicateObligation { obligation, stalled_on: vec![] });
|
||||
}
|
||||
|
||||
fn select_all_or_error(&mut self, infcx: &InferCtxt<'_, 'tcx>) -> Vec<FulfillmentError<'tcx>> {
|
||||
fn select_all_or_error(&mut self, infcx: &InferCtxt<'tcx>) -> Vec<FulfillmentError<'tcx>> {
|
||||
{
|
||||
let errors = self.select_where_possible(infcx);
|
||||
if !errors.is_empty() {
|
||||
@ -193,10 +193,7 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> {
|
||||
self.predicates.to_errors(CodeAmbiguity).into_iter().map(to_fulfillment_error).collect()
|
||||
}
|
||||
|
||||
fn select_where_possible(
|
||||
&mut self,
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
) -> Vec<FulfillmentError<'tcx>> {
|
||||
fn select_where_possible(&mut self, infcx: &InferCtxt<'tcx>) -> Vec<FulfillmentError<'tcx>> {
|
||||
let selcx = SelectionContext::new(infcx);
|
||||
self.select(selcx)
|
||||
}
|
||||
|
@ -140,8 +140,8 @@ pub fn predicates_for_generics<'tcx>(
|
||||
/// `bound` or is not known to meet bound (note that this is
|
||||
/// conservative towards *no impl*, which is the opposite of the
|
||||
/// `evaluate` methods).
|
||||
pub fn type_known_to_meet_bound_modulo_regions<'a, 'tcx>(
|
||||
infcx: &InferCtxt<'a, 'tcx>,
|
||||
pub fn type_known_to_meet_bound_modulo_regions<'tcx>(
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
ty: Ty<'tcx>,
|
||||
def_id: DefId,
|
||||
@ -393,8 +393,8 @@ pub fn normalize_param_env_or_error<'tcx>(
|
||||
}
|
||||
|
||||
/// Normalize a type and process all resulting obligations, returning any errors
|
||||
pub fn fully_normalize<'a, 'tcx, T>(
|
||||
infcx: &InferCtxt<'a, 'tcx>,
|
||||
pub fn fully_normalize<'tcx, T>(
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
cause: ObligationCause<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
value: T,
|
||||
@ -429,8 +429,8 @@ where
|
||||
|
||||
/// Process an obligation (and any nested obligations that come from it) to
|
||||
/// completion, returning any errors
|
||||
pub fn fully_solve_obligation<'a, 'tcx>(
|
||||
infcx: &InferCtxt<'a, 'tcx>,
|
||||
pub fn fully_solve_obligation<'tcx>(
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
obligation: PredicateObligation<'tcx>,
|
||||
) -> Vec<FulfillmentError<'tcx>> {
|
||||
let mut engine = <dyn TraitEngine<'tcx>>::new(infcx.tcx);
|
||||
@ -440,8 +440,8 @@ pub fn fully_solve_obligation<'a, 'tcx>(
|
||||
|
||||
/// Process a set of obligations (and any nested obligations that come from them)
|
||||
/// to completion
|
||||
pub fn fully_solve_obligations<'a, 'tcx>(
|
||||
infcx: &InferCtxt<'a, 'tcx>,
|
||||
pub fn fully_solve_obligations<'tcx>(
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
obligations: impl IntoIterator<Item = PredicateObligation<'tcx>>,
|
||||
) -> Vec<FulfillmentError<'tcx>> {
|
||||
let mut engine = <dyn TraitEngine<'tcx>>::new(infcx.tcx);
|
||||
@ -452,8 +452,8 @@ pub fn fully_solve_obligations<'a, 'tcx>(
|
||||
/// Process a bound (and any nested obligations that come from it) to completion.
|
||||
/// This is a convenience function for traits that have no generic arguments, such
|
||||
/// as auto traits, and builtin traits like Copy or Sized.
|
||||
pub fn fully_solve_bound<'a, 'tcx>(
|
||||
infcx: &InferCtxt<'a, 'tcx>,
|
||||
pub fn fully_solve_bound<'tcx>(
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
cause: ObligationCause<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
ty: Ty<'tcx>,
|
||||
|
@ -26,7 +26,7 @@ pub trait InferCtxtExt<'a, 'tcx> {
|
||||
) -> Bounds<'a, 'tcx>;
|
||||
}
|
||||
|
||||
impl<'a, 'cx, 'tcx: 'a> InferCtxtExt<'a, 'tcx> for InferCtxt<'cx, 'tcx> {
|
||||
impl<'a, 'tcx: 'a> InferCtxtExt<'a, 'tcx> for InferCtxt<'tcx> {
|
||||
/// Implied bounds are region relationships that we deduce
|
||||
/// automatically. The idea is that (e.g.) a caller must check that a
|
||||
/// function's argument types are well-formed immediately before
|
||||
|
@ -663,7 +663,7 @@ impl<'a, 'b, 'tcx> TypeFolder<'tcx> for AssocTypeNormalizer<'a, 'b, 'tcx> {
|
||||
}
|
||||
|
||||
pub struct BoundVarReplacer<'me, 'tcx> {
|
||||
infcx: &'me InferCtxt<'me, 'tcx>,
|
||||
infcx: &'me InferCtxt<'tcx>,
|
||||
// These three maps track the bound variable that were replaced by placeholders. It might be
|
||||
// nice to remove these since we already have the `kind` in the placeholder; we really just need
|
||||
// the `var` (but we *could* bring that into scope if we were to track them as we pass them).
|
||||
@ -691,7 +691,7 @@ pub struct BoundVarReplacer<'me, 'tcx> {
|
||||
/// FIXME(@lcnr): We may even consider experimenting with eagerly replacing bound vars during
|
||||
/// normalization as well, at which point this function will be unnecessary and can be removed.
|
||||
pub fn with_replaced_escaping_bound_vars<'a, 'tcx, T: TypeFoldable<'tcx>, R: TypeFoldable<'tcx>>(
|
||||
infcx: &'a InferCtxt<'a, 'tcx>,
|
||||
infcx: &'a InferCtxt<'tcx>,
|
||||
universe_indices: &'a mut Vec<Option<ty::UniverseIndex>>,
|
||||
value: T,
|
||||
f: impl FnOnce(T) -> R,
|
||||
@ -717,7 +717,7 @@ impl<'me, 'tcx> BoundVarReplacer<'me, 'tcx> {
|
||||
/// Returns `Some` if we *were* able to replace bound vars. If there are any bound vars that
|
||||
/// use a binding level above `universe_indices.len()`, we fail.
|
||||
pub fn replace_bound_vars<T: TypeFoldable<'tcx>>(
|
||||
infcx: &'me InferCtxt<'me, 'tcx>,
|
||||
infcx: &'me InferCtxt<'tcx>,
|
||||
universe_indices: &'me mut Vec<Option<ty::UniverseIndex>>,
|
||||
value: T,
|
||||
) -> (
|
||||
@ -837,7 +837,7 @@ impl<'tcx> TypeFolder<'tcx> for BoundVarReplacer<'_, 'tcx> {
|
||||
|
||||
// The inverse of `BoundVarReplacer`: replaces placeholders with the bound vars from which they came.
|
||||
pub struct PlaceholderReplacer<'me, 'tcx> {
|
||||
infcx: &'me InferCtxt<'me, 'tcx>,
|
||||
infcx: &'me InferCtxt<'tcx>,
|
||||
mapped_regions: BTreeMap<ty::PlaceholderRegion, ty::BoundRegion>,
|
||||
mapped_types: BTreeMap<ty::PlaceholderType, ty::BoundTy>,
|
||||
mapped_consts: BTreeMap<ty::PlaceholderConst<'tcx>, ty::BoundVar>,
|
||||
@ -847,7 +847,7 @@ pub struct PlaceholderReplacer<'me, 'tcx> {
|
||||
|
||||
impl<'me, 'tcx> PlaceholderReplacer<'me, 'tcx> {
|
||||
pub fn replace_placeholders<T: TypeFoldable<'tcx>>(
|
||||
infcx: &'me InferCtxt<'me, 'tcx>,
|
||||
infcx: &'me InferCtxt<'tcx>,
|
||||
mapped_regions: BTreeMap<ty::PlaceholderRegion, ty::BoundRegion>,
|
||||
mapped_types: BTreeMap<ty::PlaceholderType, ty::BoundTy>,
|
||||
mapped_consts: BTreeMap<ty::PlaceholderConst<'tcx>, ty::BoundVar>,
|
||||
|
@ -31,7 +31,7 @@ pub trait InferCtxtExt<'tcx> {
|
||||
) -> EvaluationResult;
|
||||
}
|
||||
|
||||
impl<'cx, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'cx, 'tcx> {
|
||||
impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
|
||||
/// Evaluates whether the predicate can be satisfied (by any means)
|
||||
/// in the given `ParamEnv`.
|
||||
fn predicate_may_hold(&self, obligation: &PredicateObligation<'tcx>) -> bool {
|
||||
|
@ -154,7 +154,7 @@ impl<'tcx> TypeVisitor<'tcx> for MaxEscapingBoundVarVisitor {
|
||||
}
|
||||
|
||||
struct QueryNormalizer<'cx, 'tcx> {
|
||||
infcx: &'cx InferCtxt<'cx, 'tcx>,
|
||||
infcx: &'cx InferCtxt<'tcx>,
|
||||
cause: &'cx ObligationCause<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
obligations: Vec<PredicateObligation<'tcx>>,
|
||||
|
@ -16,7 +16,7 @@ pub struct CustomTypeOp<F, G> {
|
||||
impl<F, G> CustomTypeOp<F, G> {
|
||||
pub fn new<'tcx, R>(closure: F, description: G) -> Self
|
||||
where
|
||||
F: FnOnce(&InferCtxt<'_, 'tcx>) -> Fallible<InferOk<'tcx, R>>,
|
||||
F: FnOnce(&InferCtxt<'tcx>) -> Fallible<InferOk<'tcx, R>>,
|
||||
G: Fn() -> String,
|
||||
{
|
||||
CustomTypeOp { closure, description }
|
||||
@ -25,7 +25,7 @@ impl<F, G> CustomTypeOp<F, G> {
|
||||
|
||||
impl<'tcx, F, R: fmt::Debug, G> super::TypeOp<'tcx> for CustomTypeOp<F, G>
|
||||
where
|
||||
F: for<'a, 'cx> FnOnce(&'a InferCtxt<'cx, 'tcx>) -> Fallible<InferOk<'tcx, R>>,
|
||||
F: for<'a, 'cx> FnOnce(&'a InferCtxt<'tcx>) -> Fallible<InferOk<'tcx, R>>,
|
||||
G: Fn() -> String,
|
||||
{
|
||||
type Output = R;
|
||||
@ -36,7 +36,7 @@ where
|
||||
/// Processes the operation and all resulting obligations,
|
||||
/// returning the final result along with any region constraints
|
||||
/// (they will be given over to the NLL region solver).
|
||||
fn fully_perform(self, infcx: &InferCtxt<'_, 'tcx>) -> Fallible<TypeOpOutput<'tcx, Self>> {
|
||||
fn fully_perform(self, infcx: &InferCtxt<'tcx>) -> Fallible<TypeOpOutput<'tcx, Self>> {
|
||||
if cfg!(debug_assertions) {
|
||||
info!("fully_perform({:?})", self);
|
||||
}
|
||||
@ -57,7 +57,7 @@ where
|
||||
/// Executes `op` and then scrapes out all the "old style" region
|
||||
/// constraints that result, creating query-region-constraints.
|
||||
pub fn scrape_region_constraints<'tcx, Op: super::TypeOp<'tcx, Output = R>, R>(
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
op: impl FnOnce() -> Fallible<InferOk<'tcx, R>>,
|
||||
) -> Fallible<(TypeOpOutput<'tcx, Op>, RegionConstraintData<'tcx>)> {
|
||||
// During NLL, we expect that nobody will register region
|
||||
|
@ -32,7 +32,7 @@ pub trait TypeOp<'tcx>: Sized + fmt::Debug {
|
||||
/// Processes the operation and all resulting obligations,
|
||||
/// returning the final result along with any region constraints
|
||||
/// (they will be given over to the NLL region solver).
|
||||
fn fully_perform(self, infcx: &InferCtxt<'_, 'tcx>) -> Fallible<TypeOpOutput<'tcx, Self>>;
|
||||
fn fully_perform(self, infcx: &InferCtxt<'tcx>) -> Fallible<TypeOpOutput<'tcx, Self>>;
|
||||
}
|
||||
|
||||
/// The output from performing a type op
|
||||
@ -78,7 +78,7 @@ pub trait QueryTypeOp<'tcx>: fmt::Debug + Copy + TypeFoldable<'tcx> + 'tcx {
|
||||
|
||||
fn fully_perform_into(
|
||||
query_key: ParamEnvAnd<'tcx, Self>,
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
output_query_region_constraints: &mut QueryRegionConstraints<'tcx>,
|
||||
) -> Fallible<(
|
||||
Self::QueryResponse,
|
||||
@ -120,7 +120,7 @@ where
|
||||
type Output = Q::QueryResponse;
|
||||
type ErrorInfo = Canonical<'tcx, ParamEnvAnd<'tcx, Q>>;
|
||||
|
||||
fn fully_perform(self, infcx: &InferCtxt<'_, 'tcx>) -> Fallible<TypeOpOutput<'tcx, Self>> {
|
||||
fn fully_perform(self, infcx: &InferCtxt<'tcx>) -> Fallible<TypeOpOutput<'tcx, Self>> {
|
||||
let mut region_constraints = QueryRegionConstraints::default();
|
||||
let (output, error_info, mut obligations, _) =
|
||||
Q::fully_perform_into(self, infcx, &mut region_constraints)?;
|
||||
|
@ -6,7 +6,7 @@ use rustc_middle::ty::{self, ToPredicate};
|
||||
|
||||
pub(crate) fn update<'tcx, T>(
|
||||
engine: &mut T,
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
obligation: &PredicateObligation<'tcx>,
|
||||
) where
|
||||
T: TraitEngine<'tcx>,
|
||||
|
@ -93,7 +93,7 @@ impl IntercrateAmbiguityCause {
|
||||
}
|
||||
|
||||
pub struct SelectionContext<'cx, 'tcx> {
|
||||
infcx: &'cx InferCtxt<'cx, 'tcx>,
|
||||
infcx: &'cx InferCtxt<'tcx>,
|
||||
|
||||
/// Freshener used specifically for entries on the obligation
|
||||
/// stack. This ensures that all entries on the stack at one time
|
||||
@ -214,7 +214,7 @@ enum BuiltinImplConditions<'tcx> {
|
||||
}
|
||||
|
||||
impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
pub fn new(infcx: &'cx InferCtxt<'cx, 'tcx>) -> SelectionContext<'cx, 'tcx> {
|
||||
pub fn new(infcx: &'cx InferCtxt<'tcx>) -> SelectionContext<'cx, 'tcx> {
|
||||
SelectionContext {
|
||||
infcx,
|
||||
freshener: infcx.freshener_keep_static(),
|
||||
@ -224,12 +224,12 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn intercrate(infcx: &'cx InferCtxt<'cx, 'tcx>) -> SelectionContext<'cx, 'tcx> {
|
||||
pub fn intercrate(infcx: &'cx InferCtxt<'tcx>) -> SelectionContext<'cx, 'tcx> {
|
||||
SelectionContext { intercrate: true, ..SelectionContext::new(infcx) }
|
||||
}
|
||||
|
||||
pub fn with_query_mode(
|
||||
infcx: &'cx InferCtxt<'cx, 'tcx>,
|
||||
infcx: &'cx InferCtxt<'tcx>,
|
||||
query_mode: TraitQueryMode,
|
||||
) -> SelectionContext<'cx, 'tcx> {
|
||||
debug!(?query_mode, "with_query_mode");
|
||||
@ -253,7 +253,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
self.intercrate_ambiguity_causes.take().unwrap_or_default()
|
||||
}
|
||||
|
||||
pub fn infcx(&self) -> &'cx InferCtxt<'cx, 'tcx> {
|
||||
pub fn infcx(&self) -> &'cx InferCtxt<'tcx> {
|
||||
self.infcx
|
||||
}
|
||||
|
||||
|
@ -73,8 +73,8 @@ pub struct OverlapError {
|
||||
/// through associated type projection. We deal with such cases by using
|
||||
/// *fulfillment* to relate the two impls, requiring that all projections are
|
||||
/// resolved.
|
||||
pub fn translate_substs<'a, 'tcx>(
|
||||
infcx: &InferCtxt<'a, 'tcx>,
|
||||
pub fn translate_substs<'tcx>(
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
source_impl: DefId,
|
||||
source_substs: SubstsRef<'tcx>,
|
||||
@ -176,8 +176,8 @@ pub(super) fn specializes(tcx: TyCtxt<'_>, (impl1_def_id, impl2_def_id): (DefId,
|
||||
/// generics of `target_impl`, including both those needed to unify with
|
||||
/// `source_trait_ref` and those whose identity is determined via a where
|
||||
/// clause in the impl.
|
||||
fn fulfill_implication<'a, 'tcx>(
|
||||
infcx: &InferCtxt<'a, 'tcx>,
|
||||
fn fulfill_implication<'tcx>(
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
source_trait_ref: ty::TraitRef<'tcx>,
|
||||
target_impl: DefId,
|
||||
|
@ -68,7 +68,7 @@ pub fn search_for_adt_const_param_violation<'tcx>(
|
||||
/// Note that this does *not* recursively check if the substructure of `adt_ty`
|
||||
/// implements the traits.
|
||||
fn type_marked_structural<'tcx>(
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
adt_ty: Ty<'tcx>,
|
||||
cause: ObligationCause<'tcx>,
|
||||
) -> bool {
|
||||
|
@ -14,8 +14,8 @@ use std::iter;
|
||||
/// inference variable, returns `None`, because we are not able to
|
||||
/// make any progress at all. This is to prevent "livelock" where we
|
||||
/// say "$0 is WF if $0 is WF".
|
||||
pub fn obligations<'a, 'tcx>(
|
||||
infcx: &InferCtxt<'a, 'tcx>,
|
||||
pub fn obligations<'tcx>(
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
body_id: hir::HirId,
|
||||
recursion_depth: usize,
|
||||
@ -79,8 +79,8 @@ pub fn obligations<'a, 'tcx>(
|
||||
/// well-formed. For example, if there is a trait `Set` defined like
|
||||
/// `trait Set<K:Eq>`, then the trait reference `Foo: Set<Bar>` is WF
|
||||
/// if `Bar: Eq`.
|
||||
pub fn trait_obligations<'a, 'tcx>(
|
||||
infcx: &InferCtxt<'a, 'tcx>,
|
||||
pub fn trait_obligations<'tcx>(
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
body_id: hir::HirId,
|
||||
trait_pred: &ty::TraitPredicate<'tcx>,
|
||||
@ -102,8 +102,8 @@ pub fn trait_obligations<'a, 'tcx>(
|
||||
}
|
||||
|
||||
#[instrument(skip(infcx), ret)]
|
||||
pub fn predicate_obligations<'a, 'tcx>(
|
||||
infcx: &InferCtxt<'a, 'tcx>,
|
||||
pub fn predicate_obligations<'tcx>(
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
body_id: hir::HirId,
|
||||
predicate: ty::Predicate<'tcx>,
|
||||
@ -275,7 +275,7 @@ impl<'tcx> WfPredicates<'tcx> {
|
||||
traits::ObligationCause::new(self.span, self.body_id, code)
|
||||
}
|
||||
|
||||
fn normalize(self, infcx: &InferCtxt<'_, 'tcx>) -> Vec<traits::PredicateObligation<'tcx>> {
|
||||
fn normalize(self, infcx: &InferCtxt<'tcx>) -> Vec<traits::PredicateObligation<'tcx>> {
|
||||
let cause = self.cause(traits::WellFormed(None));
|
||||
let param_env = self.param_env;
|
||||
let mut obligations = Vec::with_capacity(self.out.len());
|
||||
|
@ -35,7 +35,7 @@ fn implied_outlives_bounds<'tcx>(
|
||||
}
|
||||
|
||||
fn compute_implied_outlives_bounds<'tcx>(
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
ty: Ty<'tcx>,
|
||||
) -> Fallible<Vec<OutlivesBound<'tcx>>> {
|
||||
|
@ -51,7 +51,7 @@ fn type_op_ascribe_user_type<'tcx>(
|
||||
/// this query can be re-run to better track the span of the obligation cause, and improve the error
|
||||
/// message. Do not call directly unless you're in that very specific context.
|
||||
pub fn type_op_ascribe_user_type_with_span<'a, 'tcx: 'a>(
|
||||
infcx: &'a InferCtxt<'a, 'tcx>,
|
||||
infcx: &'a InferCtxt<'tcx>,
|
||||
fulfill_cx: &'a mut dyn TraitEngine<'tcx>,
|
||||
key: ParamEnvAnd<'tcx, AscribeUserType<'tcx>>,
|
||||
span: Option<Span>,
|
||||
@ -68,7 +68,7 @@ pub fn type_op_ascribe_user_type_with_span<'a, 'tcx: 'a>(
|
||||
}
|
||||
|
||||
struct AscribeUserTypeCx<'me, 'tcx> {
|
||||
infcx: &'me InferCtxt<'me, 'tcx>,
|
||||
infcx: &'me InferCtxt<'tcx>,
|
||||
param_env: ParamEnv<'tcx>,
|
||||
span: Span,
|
||||
fulfill_cx: &'me mut dyn TraitEngine<'tcx>,
|
||||
@ -210,7 +210,7 @@ fn type_op_eq<'tcx>(
|
||||
}
|
||||
|
||||
fn type_op_normalize<'tcx, T>(
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
fulfill_cx: &mut dyn TraitEngine<'tcx>,
|
||||
key: ParamEnvAnd<'tcx, Normalize<T>>,
|
||||
) -> Fallible<T>
|
||||
@ -285,7 +285,7 @@ fn type_op_prove_predicate<'tcx>(
|
||||
/// this query can be re-run to better track the span of the obligation cause, and improve the error
|
||||
/// message. Do not call directly unless you're in that very specific context.
|
||||
pub fn type_op_prove_predicate_with_cause<'a, 'tcx: 'a>(
|
||||
infcx: &'a InferCtxt<'a, 'tcx>,
|
||||
infcx: &'a InferCtxt<'tcx>,
|
||||
fulfill_cx: &'a mut dyn TraitEngine<'tcx>,
|
||||
key: ParamEnvAnd<'tcx, ProvePredicate<'tcx>>,
|
||||
cause: ObligationCause<'tcx>,
|
||||
|
@ -80,11 +80,11 @@ mod rustc {
|
||||
}
|
||||
|
||||
pub struct TransmuteTypeEnv<'cx, 'tcx> {
|
||||
infcx: &'cx InferCtxt<'cx, 'tcx>,
|
||||
infcx: &'cx InferCtxt<'tcx>,
|
||||
}
|
||||
|
||||
impl<'cx, 'tcx> TransmuteTypeEnv<'cx, 'tcx> {
|
||||
pub fn new(infcx: &'cx InferCtxt<'cx, 'tcx>) -> Self {
|
||||
pub fn new(infcx: &'cx InferCtxt<'tcx>) -> Self {
|
||||
Self { infcx }
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user