Struct hax_frontend_exporter::PredicateSearcher
source · pub struct PredicateSearcher<'tcx> {
tcx: TyCtxt<'tcx>,
param_env: ParamEnv<'tcx>,
candidates: HashMap<PolyTraitPredicate<'tcx>, Candidate<'tcx>>,
}
Expand description
Stores a set of predicates along with where they came from.
Fields§
§tcx: TyCtxt<'tcx>
§param_env: ParamEnv<'tcx>
§candidates: HashMap<PolyTraitPredicate<'tcx>, Candidate<'tcx>>
Local clauses available in the current context.
Implementations§
source§impl<'tcx> PredicateSearcher<'tcx>
impl<'tcx> PredicateSearcher<'tcx>
sourcepub fn new_for_owner(tcx: TyCtxt<'tcx>, owner_id: DefId) -> Self
pub fn new_for_owner(tcx: TyCtxt<'tcx>, owner_id: DefId) -> Self
Initialize the elaborator with the predicates accessible within this item.
sourcefn extend(&mut self, candidates: impl IntoIterator<Item = Candidate<'tcx>>)
fn extend(&mut self, candidates: impl IntoIterator<Item = Candidate<'tcx>>)
Insert new candidates and all their parent predicates. This deduplicates predicates to avoid divergence.
sourcefn extend_parents(&mut self, new_candidates: Vec<Candidate<'tcx>>)
fn extend_parents(&mut self, new_candidates: Vec<Candidate<'tcx>>)
Add the parents of these candidates. This is a separate function to avoid polymorphic recursion due to the closures capturing the type parameters of this function.
sourcefn add_associated_type_refs(
&mut self,
ty: Binder<'tcx, Ty<'tcx>>,
warn: &impl Fn(&str),
) -> Result<(), String>
fn add_associated_type_refs( &mut self, ty: Binder<'tcx, Ty<'tcx>>, warn: &impl Fn(&str), ) -> Result<(), String>
If the type is a trait associated type, we add any relevant bounds to our context.
sourcefn resolve_local(
&mut self,
target: PolyTraitPredicate<'tcx>,
warn: &impl Fn(&str),
) -> Result<Option<Candidate<'tcx>>, String>
fn resolve_local( &mut self, target: PolyTraitPredicate<'tcx>, warn: &impl Fn(&str), ) -> Result<Option<Candidate<'tcx>>, String>
Resolve a local clause by looking it up in this set. If the predicate applies to an associated type, we add the relevant implied associated type bounds to the set as well.
Auto Trait Implementations§
impl<'tcx> Freeze for PredicateSearcher<'tcx>
impl<'tcx> !RefUnwindSafe for PredicateSearcher<'tcx>
impl<'tcx> !Send for PredicateSearcher<'tcx>
impl<'tcx> !Sync for PredicateSearcher<'tcx>
impl<'tcx> Unpin for PredicateSearcher<'tcx>
impl<'tcx> !UnwindSafe for PredicateSearcher<'tcx>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more