diff options
| author | GnomedDev <david2005thomas@gmail.com> | 2024-10-09 01:02:55 +0100 | 
|---|---|---|
| committer | GnomedDev <david2005thomas@gmail.com> | 2024-10-12 15:17:08 +0100 | 
| commit | 7ec06b0d1d08cbcc6ed2f7e6ae87fe18056f69ef (patch) | |
| tree | 84de21bf35650b6cadd11779c13bdee83e238afb /compiler/rustc_trait_selection/src/traits/normalize.rs | |
| parent | 1ac72b94bc5e8536e61232125b99dd052ac74b38 (diff) | |
| download | rust-7ec06b0d1d08cbcc6ed2f7e6ae87fe18056f69ef.tar.gz rust-7ec06b0d1d08cbcc6ed2f7e6ae87fe18056f69ef.zip | |
Swap Vec<PredicateObligation> to type alias
Diffstat (limited to 'compiler/rustc_trait_selection/src/traits/normalize.rs')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/normalize.rs | 14 | 
1 files changed, 7 insertions, 7 deletions
| diff --git a/compiler/rustc_trait_selection/src/traits/normalize.rs b/compiler/rustc_trait_selection/src/traits/normalize.rs index a7130cbd28f..7eac3559348 100644 --- a/compiler/rustc_trait_selection/src/traits/normalize.rs +++ b/compiler/rustc_trait_selection/src/traits/normalize.rs @@ -4,7 +4,7 @@ use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_infer::infer::InferOk; use rustc_infer::infer::at::At; use rustc_infer::traits::{ - FromSolverError, Normalized, Obligation, PredicateObligation, TraitEngine, + FromSolverError, Normalized, Obligation, PredicateObligations, TraitEngine, }; use rustc_macros::extension; use rustc_middle::traits::{ObligationCause, ObligationCauseCode, Reveal}; @@ -29,7 +29,7 @@ impl<'tcx> At<'_, 'tcx> { /// projection may be fallible. fn normalize<T: TypeFoldable<TyCtxt<'tcx>>>(&self, value: T) -> InferOk<'tcx, T> { if self.infcx.next_trait_solver() { - InferOk { value, obligations: Vec::new() } + InferOk { value, obligations: PredicateObligations::new() } } else { let mut selcx = SelectionContext::new(self.infcx); let Normalized { value, obligations } = @@ -83,7 +83,7 @@ pub(crate) fn normalize_with_depth<'a, 'b, 'tcx, T>( where T: TypeFoldable<TyCtxt<'tcx>>, { - let mut obligations = Vec::new(); + let mut obligations = PredicateObligations::new(); let value = normalize_with_depth_to(selcx, param_env, cause, depth, value, &mut obligations); Normalized { value, obligations } } @@ -95,14 +95,14 @@ pub(crate) fn normalize_with_depth_to<'a, 'b, 'tcx, T>( cause: ObligationCause<'tcx>, depth: usize, value: T, - obligations: &mut Vec<PredicateObligation<'tcx>>, + obligations: &mut PredicateObligations<'tcx>, ) -> T where T: TypeFoldable<TyCtxt<'tcx>>, { debug!(obligations.len = obligations.len()); let mut normalizer = AssocTypeNormalizer::new(selcx, param_env, cause, depth, obligations); - let result = ensure_sufficient_stack(|| normalizer.fold(value)); + let result = ensure_sufficient_stack(|| AssocTypeNormalizer::fold(&mut normalizer, value)); debug!(?result, obligations.len = normalizer.obligations.len()); debug!(?normalizer.obligations,); result @@ -128,7 +128,7 @@ struct AssocTypeNormalizer<'a, 'b, 'tcx> { selcx: &'a mut SelectionContext<'b, 'tcx>, param_env: ty::ParamEnv<'tcx>, cause: ObligationCause<'tcx>, - obligations: &'a mut Vec<PredicateObligation<'tcx>>, + obligations: &'a mut PredicateObligations<'tcx>, depth: usize, universes: Vec<Option<ty::UniverseIndex>>, } @@ -139,7 +139,7 @@ impl<'a, 'b, 'tcx> AssocTypeNormalizer<'a, 'b, 'tcx> { param_env: ty::ParamEnv<'tcx>, cause: ObligationCause<'tcx>, depth: usize, - obligations: &'a mut Vec<PredicateObligation<'tcx>>, + obligations: &'a mut PredicateObligations<'tcx>, ) -> AssocTypeNormalizer<'a, 'b, 'tcx> { debug_assert!(!selcx.infcx.next_trait_solver()); AssocTypeNormalizer { selcx, param_env, cause, obligations, depth, universes: vec![] } | 
