[−][src]Struct rustc_typeck::bounds::Bounds
Collects together a list of type bounds. These lists of bounds occur in many places in Rust's syntax:
trait Foo: Bar + Baz { }
^^^^^^^^^ supertrait list bounding the `Self` type parameter
fn foo<T: Bar + Baz>() { }
^^^^^^^^^ bounding the type parameter `T`
impl dyn Bar + Baz
^^^^^^^^^ bounding the forgotten dynamic type
Our representation is a bit mixed here -- in some cases, we
include the self type (e.g., trait_bounds) but in others we do not
Fields
region_bounds: Vec<(Region<'tcx>, Span)>A list of region bounds on the (implicit) self type. So if you
had T: 'a + 'b this might would be a list ['a, 'b] (but
the T is not explicitly included).
trait_bounds: Vec<(PolyTraitRef<'tcx>, Span, Constness)>A list of trait bounds. So if you had T: Debug this would be
T: Debug. Note that the self-type is explicit here.
projection_bounds: Vec<(PolyProjectionPredicate<'tcx>, Span)>A list of projection equality bounds. So if you had T: Iterator<Item = u32> this would include <T as Iterator>::Item => u32. Note that the self-type is explicit
here.
implicitly_sized: Option<Span>Some if there is no ?Sized predicate. The span
is the location in the source of the T declaration which can
be cited as the source of the T: Sized requirement.
Implementations
impl<'tcx> Bounds<'tcx>[src]
pub fn predicates(
&self,
tcx: TyCtxt<'tcx>,
param_ty: Ty<'tcx>
) -> Vec<(Predicate<'tcx>, Span)>[src]
&self,
tcx: TyCtxt<'tcx>,
param_ty: Ty<'tcx>
) -> Vec<(Predicate<'tcx>, Span)>
Converts a bounds list into a flat set of predicates (like
where-clauses). Because some of our bounds listings (e.g.,
regions) don't include the self-type, you must supply the
self-type here (the param_ty parameter).
Trait Implementations
impl<'tcx> Clone for Bounds<'tcx>[src]
impl<'tcx> Debug for Bounds<'tcx>[src]
impl<'tcx> Default for Bounds<'tcx>[src]
impl<'tcx> Eq for Bounds<'tcx>[src]
impl<'tcx> PartialEq<Bounds<'tcx>> for Bounds<'tcx>[src]
pub fn eq(&self, other: &Bounds<'tcx>) -> bool[src]
pub fn ne(&self, other: &Bounds<'tcx>) -> bool[src]
impl<'tcx> StructuralEq for Bounds<'tcx>[src]
impl<'tcx> StructuralPartialEq for Bounds<'tcx>[src]
Auto Trait Implementations
impl<'tcx> !RefUnwindSafe for Bounds<'tcx>
impl<'tcx> !Send for Bounds<'tcx>
impl<'tcx> !Sync for Bounds<'tcx>
impl<'tcx> Unpin for Bounds<'tcx>
impl<'tcx> !UnwindSafe for Bounds<'tcx>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<'a, T> Captures<'a> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.