pub enum ConstraintCategory<'tcx> {
Show 18 variants Return(ReturnConstraint), Yield, UseAsConst, UseAsStatic, TypeAnnotation, Cast, ClosureBounds, CallArgument(Option<Ty<'tcx>>), CopyBound, SizedBound, Assignment, Usage, OpaqueType, ClosureUpvar(Field), Predicate(Span), Boring, BoringNoLocation, Internal,
}
Expand description

Outlives-constraints can be categorized to determine whether and why they are interesting (for error reporting). Order of variants indicates sort order of the category, thereby influencing diagnostic output.

See also rustc_const_eval::borrow_check::constraints.

Variants

Return(ReturnConstraint)

Yield

UseAsConst

UseAsStatic

TypeAnnotation

Cast

ClosureBounds

A constraint that came from checking the body of a closure.

We try to get the category that the closure used when reporting this.

CallArgument(Option<Ty<'tcx>>)

Contains the function type if available.

CopyBound

SizedBound

Assignment

Usage

A constraint that came from a usage of a variable (e.g. in an ADT expression like Foo { field: my_val })

OpaqueType

ClosureUpvar(Field)

Predicate(Span)

A constraint from a user-written predicate with the provided span, written on the item with the given DefId

Boring

A “boring” constraint (caused by the given location) is one that the user probably doesn’t want to see described in diagnostics, because it is kind of an artifact of the type system setup.

BoringNoLocation

Internal

A constraint that doesn’t correspond to anything the user sees.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method returns an Ordering between self and other. Read more
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
Restrict a value to a certain interval. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
This method turns the parameters of a DepNodeConstructor into an opaque Fingerprint to be used in DepNode. Not all DepNodeParams support being turned into a Fingerprint (they don’t need to if the corresponding DepNode is anonymous). Read more
This method tries to recover the query key from the given DepNode, something which is needed when forcing DepNodes during red-green evaluation. The query system will only call this method if fingerprint_style() is not FingerprintStyle::Opaque. It is always valid to return None here, in which case incremental compilation will treat the query as having changed instead of forcing it. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.

Layout

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.

Size: 16 bytes

Size for each variant:

  • Return: 4 bytes
  • Yield: 0 bytes
  • UseAsConst: 0 bytes
  • UseAsStatic: 0 bytes
  • TypeAnnotation: 0 bytes
  • Cast: 0 bytes
  • ClosureBounds: 0 bytes
  • CallArgument: 12 bytes
  • CopyBound: 0 bytes
  • SizedBound: 0 bytes
  • Assignment: 0 bytes
  • Usage: 0 bytes
  • OpaqueType: 0 bytes
  • ClosureUpvar: 4 bytes
  • Predicate: 8 bytes
  • Boring: 0 bytes
  • BoringNoLocation: 0 bytes
  • Internal: 0 bytes