Struct ItemPredicates
pub struct ItemPredicates<'tcx> {
required: bool,
next_id: usize,
pub predicates: Vec<ItemPredicate<'tcx>>,
}Fields§
§required: bool§next_id: usize§predicates: Vec<ItemPredicate<'tcx>>Implementations§
§impl<'tcx> ItemPredicates<'tcx>
impl<'tcx> ItemPredicates<'tcx>
pub fn new_unmapped( span: Span, predicates: impl IntoIterator<Item = Clause<'tcx>>, ) -> ItemPredicates<'tcx>
pub fn defined_on(
tcx: TyCtxt<'_>,
def_id: DefId,
required: bool,
) -> ItemPredicates<'_>
pub fn defined_on( tcx: TyCtxt<'_>, def_id: DefId, required: bool, ) -> ItemPredicates<'_>
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(
tcx: TyCtxt<'tcx>,
def_id: DefId,
options: &BoundsOptions,
) -> ItemPredicates<'tcx>
pub fn required( tcx: TyCtxt<'tcx>, def_id: DefId, options: &BoundsOptions, ) -> ItemPredicates<'tcx>
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(
tcx: TyCtxt<'tcx>,
def_id: DefId,
options: &BoundsOptions,
) -> ItemPredicates<'tcx>
pub fn required_recursively( tcx: TyCtxt<'tcx>, def_id: DefId, options: &BoundsOptions, ) -> ItemPredicates<'tcx>
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(
tcx: TyCtxt<'tcx>,
def_id: DefId,
options: &BoundsOptions,
) -> ItemPredicates<'tcx>
pub fn implied( tcx: TyCtxt<'tcx>, def_id: DefId, options: &BoundsOptions, ) -> ItemPredicates<'tcx>
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.
pub fn iter(&self) -> impl Iterator<Item = ItemPredicate<'tcx>>
pub fn iter_trait_clauses( &self, ) -> impl Iterator<Item = (ItemPredicateId, Binder<TyCtxt<'tcx>, TraitRef<TyCtxt<'tcx>>>)>
pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut ItemPredicate<'tcx>>
Trait Implementations§
§impl<'tcx> Clone for ItemPredicates<'tcx>
impl<'tcx> Clone for ItemPredicates<'tcx>
§fn clone(&self) -> ItemPredicates<'tcx>
fn clone(&self) -> ItemPredicates<'tcx>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl<'tcx> Debug for ItemPredicates<'tcx>
impl<'tcx> Debug for ItemPredicates<'tcx>
§impl<'tcx> Default for ItemPredicates<'tcx>
impl<'tcx> Default for ItemPredicates<'tcx>
§fn default() -> ItemPredicates<'tcx>
fn default() -> ItemPredicates<'tcx>
Returns the “default value” for a type. Read more
Source§impl<'tcx, S: UnderOwnerState<'tcx>> SInto<S, GenericPredicates> for ItemPredicates<'tcx>
impl<'tcx, S: UnderOwnerState<'tcx>> SInto<S, GenericPredicates> for ItemPredicates<'tcx>
fn sinto(&self, s: &S) -> GenericPredicates
Auto Trait Implementations§
impl<'tcx> Freeze for ItemPredicates<'tcx>
impl<'tcx> !RefUnwindSafe for ItemPredicates<'tcx>
impl<'tcx> Send for ItemPredicates<'tcx>
impl<'tcx> Sync for ItemPredicates<'tcx>
impl<'tcx> Unpin for ItemPredicates<'tcx>
impl<'tcx> !UnwindSafe for ItemPredicates<'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> 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