Get rid of PredicateObligations
This commit is contained in:
parent
0c960618b5
commit
4038010436
10 changed files with 20 additions and 26 deletions
|
@ -9,9 +9,7 @@ pub use SubregionOrigin::*;
|
|||
pub use ValuePairs::*;
|
||||
|
||||
use crate::infer::relate::{CombineFields, RelateResult};
|
||||
use crate::traits::{
|
||||
self, ObligationCause, ObligationInspector, PredicateObligations, TraitEngine,
|
||||
};
|
||||
use crate::traits::{self, ObligationCause, ObligationInspector, PredicateObligation, TraitEngine};
|
||||
use error_reporting::TypeErrCtxt;
|
||||
use free_regions::RegionRelations;
|
||||
use lexical_region_resolve::LexicalRegionResolutions;
|
||||
|
@ -68,7 +66,7 @@ pub mod type_variable;
|
|||
#[derive(Debug)]
|
||||
pub struct InferOk<'tcx, T> {
|
||||
pub value: T,
|
||||
pub obligations: PredicateObligations<'tcx>,
|
||||
pub obligations: Vec<PredicateObligation<'tcx>>,
|
||||
}
|
||||
pub type InferResult<'tcx, T> = Result<InferOk<'tcx, T>, TypeError<'tcx>>;
|
||||
|
||||
|
@ -748,7 +746,7 @@ impl<'tcx, T> InferOk<'tcx, T> {
|
|||
}
|
||||
|
||||
impl<'tcx> InferOk<'tcx, ()> {
|
||||
pub fn into_obligations(self) -> PredicateObligations<'tcx> {
|
||||
pub fn into_obligations(self) -> Vec<PredicateObligation<'tcx>> {
|
||||
self.obligations
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ use super::StructurallyRelateAliases;
|
|||
use super::{RelateResult, TypeRelation};
|
||||
use crate::infer::relate;
|
||||
use crate::infer::{DefineOpaqueTypes, InferCtxt, TypeTrace};
|
||||
use crate::traits::{Obligation, PredicateObligations};
|
||||
use crate::traits::{Obligation, PredicateObligation};
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::infer::unify_key::EffectVarValue;
|
||||
use rustc_middle::ty::error::{ExpectedFound, TypeError};
|
||||
|
@ -38,7 +38,7 @@ pub struct CombineFields<'infcx, 'tcx> {
|
|||
pub infcx: &'infcx InferCtxt<'tcx>,
|
||||
pub trace: TypeTrace<'tcx>,
|
||||
pub param_env: ty::ParamEnv<'tcx>,
|
||||
pub obligations: PredicateObligations<'tcx>,
|
||||
pub obligations: Vec<PredicateObligation<'tcx>>,
|
||||
pub define_opaque_types: DefineOpaqueTypes,
|
||||
}
|
||||
|
||||
|
@ -290,7 +290,7 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
|
|||
Glb::new(self)
|
||||
}
|
||||
|
||||
pub fn register_obligations(&mut self, obligations: PredicateObligations<'tcx>) {
|
||||
pub fn register_obligations(&mut self, obligations: Vec<PredicateObligation<'tcx>>) {
|
||||
self.obligations.extend(obligations);
|
||||
}
|
||||
|
||||
|
@ -315,7 +315,7 @@ pub trait ObligationEmittingRelation<'tcx>: TypeRelation<TyCtxt<'tcx>> {
|
|||
fn structurally_relate_aliases(&self) -> StructurallyRelateAliases;
|
||||
|
||||
/// Register obligations that must hold in order for this relation to hold
|
||||
fn register_obligations(&mut self, obligations: PredicateObligations<'tcx>);
|
||||
fn register_obligations(&mut self, obligations: Vec<PredicateObligation<'tcx>>);
|
||||
|
||||
/// Register predicates that must hold in order for this relation to hold. Uses
|
||||
/// a default obligation cause, [`ObligationEmittingRelation::register_obligations`] should
|
||||
|
|
|
@ -8,7 +8,7 @@ use super::combine::{CombineFields, ObligationEmittingRelation};
|
|||
use super::lattice::{self, LatticeDir};
|
||||
use super::StructurallyRelateAliases;
|
||||
use crate::infer::{DefineOpaqueTypes, InferCtxt, SubregionOrigin};
|
||||
use crate::traits::{ObligationCause, PredicateObligations};
|
||||
use crate::traits::{ObligationCause, PredicateObligation};
|
||||
|
||||
/// "Greatest lower bound" (common subtype)
|
||||
pub struct Glb<'combine, 'infcx, 'tcx> {
|
||||
|
@ -147,7 +147,7 @@ impl<'tcx> ObligationEmittingRelation<'tcx> for Glb<'_, '_, 'tcx> {
|
|||
self.fields.register_predicates(obligations);
|
||||
}
|
||||
|
||||
fn register_obligations(&mut self, obligations: PredicateObligations<'tcx>) {
|
||||
fn register_obligations(&mut self, obligations: Vec<PredicateObligation<'tcx>>) {
|
||||
self.fields.register_obligations(obligations);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ use super::combine::{CombineFields, ObligationEmittingRelation};
|
|||
use super::lattice::{self, LatticeDir};
|
||||
use super::StructurallyRelateAliases;
|
||||
use crate::infer::{DefineOpaqueTypes, InferCtxt, SubregionOrigin};
|
||||
use crate::traits::{ObligationCause, PredicateObligations};
|
||||
use crate::traits::{ObligationCause, PredicateObligation};
|
||||
|
||||
use super::{Relate, RelateResult, TypeRelation};
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt};
|
||||
|
@ -147,7 +147,7 @@ impl<'tcx> ObligationEmittingRelation<'tcx> for Lub<'_, '_, 'tcx> {
|
|||
self.fields.register_predicates(obligations);
|
||||
}
|
||||
|
||||
fn register_obligations(&mut self, obligations: PredicateObligations<'tcx>) {
|
||||
fn register_obligations(&mut self, obligations: Vec<PredicateObligation<'tcx>>) {
|
||||
self.fields.register_obligations(obligations)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use super::combine::CombineFields;
|
||||
use crate::infer::BoundRegionConversionTime::HigherRankedType;
|
||||
use crate::infer::{DefineOpaqueTypes, SubregionOrigin};
|
||||
use crate::traits::{Obligation, PredicateObligations};
|
||||
use crate::traits::{Obligation, PredicateObligation};
|
||||
|
||||
use super::{
|
||||
relate_args_invariantly, relate_args_with_variances, ObligationEmittingRelation, Relate,
|
||||
|
@ -318,7 +318,7 @@ impl<'tcx> ObligationEmittingRelation<'tcx> for TypeRelating<'_, '_, 'tcx> {
|
|||
self.fields.register_predicates(obligations);
|
||||
}
|
||||
|
||||
fn register_obligations(&mut self, obligations: PredicateObligations<'tcx>) {
|
||||
fn register_obligations(&mut self, obligations: Vec<PredicateObligation<'tcx>>) {
|
||||
self.fields.register_obligations(obligations);
|
||||
}
|
||||
|
||||
|
|
|
@ -114,8 +114,6 @@ impl<'tcx> PolyTraitObligation<'tcx> {
|
|||
#[cfg(target_pointer_width = "64")]
|
||||
rustc_data_structures::static_assert_size!(PredicateObligation<'_>, 48);
|
||||
|
||||
pub type PredicateObligations<'tcx> = Vec<PredicateObligation<'tcx>>;
|
||||
|
||||
pub type Selection<'tcx> = ImplSource<'tcx, PredicateObligation<'tcx>>;
|
||||
|
||||
/// A callback that can be provided to `inspect_typeck`. Invoked on evaluation
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue