Struct ItemPredicates
pub struct ItemPredicates<'tcx, Id = DefId> {
direction: PredicateDirection,
next_id: usize,
pub predicates: Vec<ItemPredicate<'tcx, Id>>,
}Fields§
§direction: PredicateDirection§next_id: usize§predicates: Vec<ItemPredicate<'tcx, Id>>Implementations§
§impl<'tcx, Id> ItemPredicates<'tcx, Id>where
Id: ItemId,
impl<'tcx, Id> ItemPredicates<'tcx, Id>where
Id: ItemId,
pub fn new( def_id: Id, direction: PredicateDirection, predicates: impl IntoIterator<Item = (Clause<'tcx>, Span)>, ) -> ItemPredicates<'tcx, Id>
pub fn new_unmapped( span: Span, predicates: impl IntoIterator<Item = Clause<'tcx>>, ) -> ItemPredicates<'tcx, Id>
pub fn defined_on(
tcx: TyCtxt<'tcx>,
state: &<Id as ItemId>::State<'tcx>,
def_id: DefId,
direction: PredicateDirection,
) -> ItemPredicates<'tcx, Id>
pub fn defined_on( tcx: TyCtxt<'tcx>, state: &<Id as ItemId>::State<'tcx>, def_id: DefId, direction: PredicateDirection, ) -> ItemPredicates<'tcx, Id>
Returns a list of type predicates for the definition with id def_id, including inferred
lifetime constraints. This is the basic list of predicates we use for essentially all
items.
pub fn required(
elab_ctx: ElaborationCtx<'tcx, Id>,
state: &<Id as ItemId>::State<'tcx>,
def_id: Id,
) -> ItemPredicates<'tcx, Id>
pub fn required( elab_ctx: ElaborationCtx<'tcx, Id>, state: &<Id as ItemId>::State<'tcx>, def_id: Id, ) -> ItemPredicates<'tcx, Id>
The predicates that must hold to mention this item (ignoring its parents). E.g.
ⓘ
// `U: OtherTrait` is required, `Self: Sized` is implied.
trait Trait<U: OtherTrait>: Sized {
// `T: Clone` is required, `Self::Type<T>: Debug` is implied.
type Type<T: Clone>: Debug;
}If add_drop is true, we add a T: Drop bound for every type generic.
pub fn required_recursively(
elab_ctx: ElaborationCtx<'tcx, Id>,
state: &<Id as ItemId>::State<'tcx>,
def_id: Id,
) -> ItemPredicates<'tcx, Id>
pub fn required_recursively( elab_ctx: ElaborationCtx<'tcx, Id>, state: &<Id as ItemId>::State<'tcx>, def_id: Id, ) -> ItemPredicates<'tcx, Id>
The predicates that must hold to mention this item, including its parents. E.g.
ⓘ
// `U: OtherTrait` is required.
trait Trait<U: OtherTrait> {
// `U: OtherTrait` and `T: Clone` are required.
type Type<T: Clone>;
}pub fn implied(
elab_ctx: ElaborationCtx<'tcx, Id>,
state: &<Id as ItemId>::State<'tcx>,
def_id: Id,
) -> ItemPredicates<'tcx, Id>
pub fn implied( elab_ctx: ElaborationCtx<'tcx, Id>, state: &<Id as ItemId>::State<'tcx>, def_id: Id, ) -> ItemPredicates<'tcx, Id>
The predicates that can be deduced from the presence of this item in a signature. We only
consider predicates implied by traits here, not implied bounds such as &'a T implying T: 'a. E.g.
ⓘ
// `U: OtherTrait` is required, `Self: Sized` is implied.
trait Trait<U: OtherTrait>: Sized {
// `T: Clone` is required, `Self::Type<T>: Debug` is implied.
type Type<T: Clone>: Debug;
}If add_drop is true, we add a T: Drop bound for every type generic and associated type.
§impl<'tcx, Id> ItemPredicates<'tcx, Id>where
Id: Clone,
impl<'tcx, Id> ItemPredicates<'tcx, Id>where
Id: Clone,
pub fn len(&self) -> usize
pub fn iter(&self) -> impl Iterator<Item = ItemPredicate<'tcx, Id>>
pub fn iter_trait_clauses( &self, ) -> impl Iterator<Item = (ItemPredicateId<Id>, Binder<TyCtxt<'tcx>, TraitRef<TyCtxt<'tcx>>>)>
pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut ItemPredicate<'tcx, Id>>
pub fn instantiate(
self,
tcx: TyCtxt<'tcx>,
args: &'tcx RawList<(), GenericArg<'tcx>>,
) -> ItemPredicates<'tcx, Id>
pub fn instantiate( self, tcx: TyCtxt<'tcx>, args: &'tcx RawList<(), GenericArg<'tcx>>, ) -> ItemPredicates<'tcx, Id>
Substitute all the predicates with these args.
Trait Implementations§
§impl<'tcx, Id> Clone for ItemPredicates<'tcx, Id>where
Id: Clone,
impl<'tcx, Id> Clone for ItemPredicates<'tcx, Id>where
Id: Clone,
§fn clone(&self) -> ItemPredicates<'tcx, Id>
fn clone(&self) -> ItemPredicates<'tcx, Id>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl<'tcx, Id> Debug for ItemPredicates<'tcx, Id>where
Id: Debug,
impl<'tcx, Id> Debug for ItemPredicates<'tcx, Id>where
Id: Debug,
§impl<'tcx, Id> Default for ItemPredicates<'tcx, Id>
impl<'tcx, Id> Default for ItemPredicates<'tcx, Id>
§fn default() -> ItemPredicates<'tcx, Id>
fn default() -> ItemPredicates<'tcx, Id>
Returns the “default value” for a type. Read more
Source§impl<'tcx, S: UnderOwnerState<'tcx>> SInto<S, GenericPredicates> for ItemPredicates<'tcx, DefId>
impl<'tcx, S: UnderOwnerState<'tcx>> SInto<S, GenericPredicates> for ItemPredicates<'tcx, DefId>
fn sinto(&self, s: &S) -> GenericPredicates
Auto Trait Implementations§
impl<'tcx, Id> Freeze for ItemPredicates<'tcx, Id>
impl<'tcx, Id = DefId> !RefUnwindSafe for ItemPredicates<'tcx, Id>
impl<'tcx, Id> Send for ItemPredicates<'tcx, Id>where
Id: Send,
impl<'tcx, Id> Sync for ItemPredicates<'tcx, Id>where
Id: Sync,
impl<'tcx, Id> Unpin for ItemPredicates<'tcx, Id>where
Id: Unpin,
impl<'tcx, Id> UnsafeUnpin for ItemPredicates<'tcx, Id>
impl<'tcx, Id = DefId> !UnwindSafe for ItemPredicates<'tcx, Id>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<I, T> ExtractContext<I, ()> for T
impl<I, T> ExtractContext<I, ()> for T
§fn extract_context(self, _original_input: I)
fn extract_context(self, _original_input: I)
Given the context attached to a nom error, and given the original
input to the nom parser, extract more the useful context information. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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§impl<I> RecreateContext<I> for I
impl<I> RecreateContext<I> for I
§fn recreate_context(_original_input: I, tail: I) -> I
fn recreate_context(_original_input: I, tail: I) -> I
Given the original input, as well as the context reported by nom,
recreate a context in the original string where the error occurred. Read more