Swap Vec<PredicateObligation> to type alias
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
use rustc_data_structures::sso::SsoHashMap;
|
||||
use rustc_data_structures::stack::ensure_sufficient_stack;
|
||||
use rustc_infer::traits::PredicateObligations;
|
||||
use rustc_macros::extension;
|
||||
pub use rustc_middle::traits::query::NormalizationResult;
|
||||
use rustc_middle::ty::fold::{FallibleTypeFolder, TypeFoldable, TypeSuperFoldable};
|
||||
@@ -20,8 +21,7 @@ use crate::infer::canonical::OriginalQueryValues;
|
||||
use crate::infer::{InferCtxt, InferOk};
|
||||
use crate::traits::normalize::needs_normalization;
|
||||
use crate::traits::{
|
||||
BoundVarReplacer, Normalized, ObligationCause, PlaceholderReplacer, PredicateObligation,
|
||||
Reveal, ScrubbedTraitError,
|
||||
BoundVarReplacer, Normalized, ObligationCause, PlaceholderReplacer, Reveal, ScrubbedTraitError,
|
||||
};
|
||||
|
||||
#[extension(pub trait QueryNormalizeExt<'tcx>)]
|
||||
@@ -80,7 +80,9 @@ impl<'a, 'tcx> At<'a, 'tcx> {
|
||||
match crate::solve::deeply_normalize_with_skipped_universes::<_, ScrubbedTraitError<'tcx>>(
|
||||
self, value, universes,
|
||||
) {
|
||||
Ok(value) => return Ok(Normalized { value, obligations: vec![] }),
|
||||
Ok(value) => {
|
||||
return Ok(Normalized { value, obligations: PredicateObligations::new() });
|
||||
}
|
||||
Err(_errors) => {
|
||||
return Err(NoSolution);
|
||||
}
|
||||
@@ -88,14 +90,14 @@ impl<'a, 'tcx> At<'a, 'tcx> {
|
||||
}
|
||||
|
||||
if !needs_normalization(&value, self.param_env.reveal()) {
|
||||
return Ok(Normalized { value, obligations: vec![] });
|
||||
return Ok(Normalized { value, obligations: PredicateObligations::new() });
|
||||
}
|
||||
|
||||
let mut normalizer = QueryNormalizer {
|
||||
infcx: self.infcx,
|
||||
cause: self.cause,
|
||||
param_env: self.param_env,
|
||||
obligations: vec![],
|
||||
obligations: PredicateObligations::new(),
|
||||
cache: SsoHashMap::new(),
|
||||
anon_depth: 0,
|
||||
universes,
|
||||
@@ -164,7 +166,7 @@ struct QueryNormalizer<'a, 'tcx> {
|
||||
infcx: &'a InferCtxt<'tcx>,
|
||||
cause: &'a ObligationCause<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
obligations: Vec<PredicateObligation<'tcx>>,
|
||||
obligations: PredicateObligations<'tcx>,
|
||||
cache: SsoHashMap<Ty<'tcx>, Ty<'tcx>>,
|
||||
anon_depth: usize,
|
||||
universes: Vec<Option<ty::UniverseIndex>>,
|
||||
|
||||
@@ -2,7 +2,7 @@ use std::fmt;
|
||||
|
||||
use rustc_errors::ErrorGuaranteed;
|
||||
use rustc_infer::infer::canonical::Certainty;
|
||||
use rustc_infer::traits::PredicateObligation;
|
||||
use rustc_infer::traits::PredicateObligations;
|
||||
use rustc_middle::traits::query::NoSolution;
|
||||
use rustc_middle::ty::fold::TypeFoldable;
|
||||
use rustc_middle::ty::{ParamEnvAnd, TyCtxt};
|
||||
@@ -103,13 +103,13 @@ pub trait QueryTypeOp<'tcx>: fmt::Debug + Copy + TypeFoldable<TyCtxt<'tcx>> + 't
|
||||
(
|
||||
Self::QueryResponse,
|
||||
Option<Canonical<'tcx, ParamEnvAnd<'tcx, Self>>>,
|
||||
Vec<PredicateObligation<'tcx>>,
|
||||
PredicateObligations<'tcx>,
|
||||
Certainty,
|
||||
),
|
||||
NoSolution,
|
||||
> {
|
||||
if let Some(result) = QueryTypeOp::try_fast_path(infcx.tcx, &query_key) {
|
||||
return Ok((result, None, vec![], Certainty::Proven));
|
||||
return Ok((result, None, PredicateObligations::new(), Certainty::Proven));
|
||||
}
|
||||
|
||||
let mut canonical_var_values = OriginalQueryValues::default();
|
||||
|
||||
Reference in New Issue
Block a user