1
Fork 0

Rename a bunch of things

This commit is contained in:
Michael Goulet 2024-06-18 19:13:54 -04:00
parent 25c9f2ca06
commit db638ab968
60 changed files with 538 additions and 566 deletions

View file

@ -1,7 +1,7 @@
pub use rustc_next_trait_solver::solve::*;
mod delegate;
mod fulfill;
mod infcx;
pub mod inspect;
mod normalize;
mod select;

View file

@ -39,10 +39,10 @@ impl<'tcx> Deref for SolverDelegate<'tcx> {
}
}
impl<'tcx> rustc_next_trait_solver::infcx::SolverDelegate for SolverDelegate<'tcx> {
impl<'tcx> rustc_next_trait_solver::delegate::SolverDelegate for SolverDelegate<'tcx> {
type Interner = TyCtxt<'tcx>;
fn interner(&self) -> TyCtxt<'tcx> {
fn cx(&self) -> TyCtxt<'tcx> {
self.0.tcx
}

View file

@ -17,7 +17,7 @@ use rustc_span::symbol::sym;
use crate::traits::{FulfillmentError, FulfillmentErrorCode, ScrubbedTraitError};
use super::infcx::SolverDelegate;
use super::delegate::SolverDelegate;
use super::inspect::{self, ProofTreeInferCtxtExt, ProofTreeVisitor};
use super::Certainty;

View file

@ -22,7 +22,7 @@ use rustc_next_trait_solver::solve::inspect::{self, instantiate_canonical_state}
use rustc_next_trait_solver::solve::{GenerateProofTree, MaybeCause, SolverDelegateEvalExt as _};
use rustc_span::{Span, DUMMY_SP};
use crate::solve::infcx::SolverDelegate;
use crate::solve::delegate::SolverDelegate;
use crate::traits::ObligationCtxt;
pub struct InspectConfig {

View file

@ -156,7 +156,7 @@ where
{
type Error = Vec<E>;
fn interner(&self) -> TyCtxt<'tcx> {
fn cx(&self) -> TyCtxt<'tcx> {
self.at.infcx.tcx
}
@ -244,7 +244,7 @@ struct DeeplyNormalizeForDiagnosticsFolder<'a, 'tcx> {
}
impl<'tcx> TypeFolder<TyCtxt<'tcx>> for DeeplyNormalizeForDiagnosticsFolder<'_, 'tcx> {
fn interner(&self) -> TyCtxt<'tcx> {
fn cx(&self) -> TyCtxt<'tcx> {
self.at.infcx.tcx
}

View file

@ -4936,7 +4936,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for ReplaceImplTraitFolder<'tcx> {
t.super_fold_with(self)
}
fn interner(&self) -> TyCtxt<'tcx> {
fn cx(&self) -> TyCtxt<'tcx> {
self.tcx
}
}

View file

@ -2840,7 +2840,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
}
impl<'a, 'tcx> TypeFolder<TyCtxt<'tcx>> for ParamToVarFolder<'a, 'tcx> {
fn interner(&self) -> TyCtxt<'tcx> {
fn cx(&self) -> TyCtxt<'tcx> {
self.infcx.tcx
}

View file

@ -350,7 +350,7 @@ pub fn normalize_param_env_or_error<'tcx>(
struct ConstNormalizer<'tcx>(TyCtxt<'tcx>);
impl<'tcx> TypeFolder<TyCtxt<'tcx>> for ConstNormalizer<'tcx> {
fn interner(&self) -> TyCtxt<'tcx> {
fn cx(&self) -> TyCtxt<'tcx> {
self.0
}

View file

@ -163,7 +163,7 @@ impl<'a, 'b, 'tcx> AssocTypeNormalizer<'a, 'b, 'tcx> {
}
impl<'a, 'b, 'tcx> TypeFolder<TyCtxt<'tcx>> for AssocTypeNormalizer<'a, 'b, 'tcx> {
fn interner(&self) -> TyCtxt<'tcx> {
fn cx(&self) -> TyCtxt<'tcx> {
self.selcx.tcx()
}
@ -217,7 +217,7 @@ impl<'a, 'b, 'tcx> TypeFolder<TyCtxt<'tcx>> for AssocTypeNormalizer<'a, 'b, 'tcx
Reveal::UserFacing => ty.super_fold_with(self),
Reveal::All => {
let recursion_limit = self.interner().recursion_limit();
let recursion_limit = self.cx().recursion_limit();
if !recursion_limit.value_within_limit(self.depth) {
self.selcx.infcx.err_ctxt().report_overflow_error(
OverflowCause::DeeplyNormalize(data.into()),
@ -228,8 +228,8 @@ impl<'a, 'b, 'tcx> TypeFolder<TyCtxt<'tcx>> for AssocTypeNormalizer<'a, 'b, 'tcx
}
let args = data.args.fold_with(self);
let generic_ty = self.interner().type_of(data.def_id);
let concrete_ty = generic_ty.instantiate(self.interner(), args);
let generic_ty = self.cx().type_of(data.def_id);
let concrete_ty = generic_ty.instantiate(self.cx(), args);
self.depth += 1;
let folded_ty = self.fold_ty(concrete_ty);
self.depth -= 1;
@ -313,7 +313,7 @@ impl<'a, 'b, 'tcx> TypeFolder<TyCtxt<'tcx>> for AssocTypeNormalizer<'a, 'b, 'tcx
normalized_ty
}
ty::Weak => {
let recursion_limit = self.interner().recursion_limit();
let recursion_limit = self.cx().recursion_limit();
if !recursion_limit.value_within_limit(self.depth) {
self.selcx.infcx.err_ctxt().report_overflow_error(
OverflowCause::DeeplyNormalize(data.into()),

View file

@ -172,7 +172,7 @@ struct QueryNormalizer<'cx, 'tcx> {
impl<'cx, 'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for QueryNormalizer<'cx, 'tcx> {
type Error = NoSolution;
fn interner(&self) -> TyCtxt<'tcx> {
fn cx(&self) -> TyCtxt<'tcx> {
self.infcx.tcx
}
@ -217,7 +217,7 @@ impl<'cx, 'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for QueryNormalizer<'cx, 'tcx>
Reveal::All => {
let args = data.args.try_fold_with(self)?;
let recursion_limit = self.interner().recursion_limit();
let recursion_limit = self.cx().recursion_limit();
if !recursion_limit.value_within_limit(self.anon_depth) {
let guar = self
@ -229,15 +229,15 @@ impl<'cx, 'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for QueryNormalizer<'cx, 'tcx>
true,
)
.delay_as_bug();
return Ok(Ty::new_error(self.interner(), guar));
return Ok(Ty::new_error(self.cx(), guar));
}
let generic_ty = self.interner().type_of(data.def_id);
let mut concrete_ty = generic_ty.instantiate(self.interner(), args);
let generic_ty = self.cx().type_of(data.def_id);
let mut concrete_ty = generic_ty.instantiate(self.cx(), args);
self.anon_depth += 1;
if concrete_ty == ty {
concrete_ty = Ty::new_error_with_message(
self.interner(),
self.cx(),
DUMMY_SP,
"recursive opaque type",
);

View file

@ -394,7 +394,7 @@ impl<'me, 'tcx> BoundVarReplacer<'me, 'tcx> {
}
impl<'tcx> TypeFolder<TyCtxt<'tcx>> for BoundVarReplacer<'_, 'tcx> {
fn interner(&self) -> TyCtxt<'tcx> {
fn cx(&self) -> TyCtxt<'tcx> {
self.infcx.tcx
}
@ -509,7 +509,7 @@ impl<'me, 'tcx> PlaceholderReplacer<'me, 'tcx> {
}
impl<'tcx> TypeFolder<TyCtxt<'tcx>> for PlaceholderReplacer<'_, 'tcx> {
fn interner(&self) -> TyCtxt<'tcx> {
fn cx(&self) -> TyCtxt<'tcx> {
self.infcx.tcx
}
@ -550,7 +550,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for PlaceholderReplacer<'_, 'tcx> {
let db = ty::DebruijnIndex::from_usize(
self.universe_indices.len() - index + self.current_index.as_usize() - 1,
);
ty::Region::new_bound(self.interner(), db, *replace_var)
ty::Region::new_bound(self.cx(), db, *replace_var)
}
None => r1,
}