Enum rustc_infer::traits::ObligationCauseCode[−][src]

pub enum ObligationCauseCode<'tcx> {
Show variants MiscObligation, SliceOrArrayElem, TupleElem, ProjectionWf(ProjectionTy<'tcx>), ItemObligation(DefId), BindingObligation(DefId, Span), ReferenceOutlivesReferent(&'tcx TyS<'tcx>), ObjectTypeBound(&'tcx TyS<'tcx>, &'tcx RegionKind), ObjectCastObligation(&'tcx TyS<'tcx>), Coercion { source: &'tcx TyS<'tcx>, target: &'tcx TyS<'tcx>, }, AssignmentLhsSized, TupleInitializerSized, StructInitializerSized, VariableType(HirId), SizedArgumentType(Option<Span>), SizedReturnType, SizedYieldType, InlineAsmSized, RepeatVec(bool), FieldSized { adt_kind: AdtKind, span: Span, last: bool, }, ConstSized, SharedStatic, BuiltinDerivedObligation(DerivedObligationCause<'tcx>), ImplDerivedObligation(DerivedObligationCause<'tcx>), DerivedObligation(DerivedObligationCause<'tcx>), CompareImplConstObligation, CompareImplMethodObligation { item_name: Symbol, impl_item_def_id: DefId, trait_item_def_id: DefId, }, CompareImplTypeObligation { item_name: Symbol, impl_item_def_id: DefId, trait_item_def_id: DefId, }, ExprAssignable, MatchExpressionArm(Box<MatchExpressionArmCause<'tcx>, Global>), Pattern { span: Option<Span>, root_ty: &'tcx TyS<'tcx>, origin_expr: bool, }, ConstPatternStructural, IfExpression(Box<IfExpressionCause, Global>), IfExpressionWithNoElse, MainFunctionType, StartFunctionType, IntrinsicType, MethodReceiver, UnifyReceiver(Box<UnifyReceiverContext<'tcx>, Global>), ReturnNoExpression, ReturnValue(HirId), ReturnType, BlockTailExpression(HirId), TrivialBound, OpaqueType,
}

Variants

MiscObligation

Not well classified or should be obvious from the span.

SliceOrArrayElem

A slice or array is WF only if T: Sized.

TupleElem

A tuple is WF only if its middle elements are Sized.

ProjectionWf(ProjectionTy<'tcx>)

This is the trait reference from the given projection.

ItemObligation(DefId)

In an impl of trait X for type Y, type Y must also implement all supertraits of X.

BindingObligation(DefId, Span)

Like ItemObligation, but with extra detail on the source of the obligation.

ReferenceOutlivesReferent(&'tcx TyS<'tcx>)

A type like &'a T is WF only if T: 'a.

ObjectTypeBound(&'tcx TyS<'tcx>, &'tcx RegionKind)

A type like Box<Foo<'a> + 'b> is WF only if 'b: 'a.

ObjectCastObligation(&'tcx TyS<'tcx>)

Obligation incurred due to an object cast.

Coercion

Obligation incurred due to a coercion.

Fields of Coercion

source: &'tcx TyS<'tcx>target: &'tcx TyS<'tcx>
AssignmentLhsSized

Various cases where expressions must be Sized / Copy / etc. L = X implies that L is Sized.

TupleInitializerSized

(x1, .., xn) must be Sized.

StructInitializerSized

S { ... } must be Sized.

VariableType(HirId)

Type of each variable must be Sized.

SizedArgumentType(Option<Span>)

Argument type must be Sized.

SizedReturnType

Return type must be Sized.

SizedYieldType

Yield type must be Sized.

InlineAsmSized

Inline asm operand type must be Sized.

RepeatVec(bool)

[T, ..n] implies that T must be Copy. If the function in the array repeat expression is a const fn, display a help message suggesting to move the function call to a new const item while saying that T doesn’t implement Copy.

FieldSized

Types of fields (other than the last, except for packed structs) in a struct must be sized.

Fields of FieldSized

adt_kind: AdtKindspan: Spanlast: bool
ConstSized

Constant expressions must be sized.

SharedStatic

static items must have Sync type.

BuiltinDerivedObligation(DerivedObligationCause<'tcx>)
ImplDerivedObligation(DerivedObligationCause<'tcx>)
DerivedObligation(DerivedObligationCause<'tcx>)
CompareImplConstObligation

Error derived when matching traits/impls; see ObligationCause for more details

CompareImplMethodObligation

Error derived when matching traits/impls; see ObligationCause for more details

Fields of CompareImplMethodObligation

item_name: Symbolimpl_item_def_id: DefIdtrait_item_def_id: DefId
CompareImplTypeObligation

Error derived when matching traits/impls; see ObligationCause for more details

Fields of CompareImplTypeObligation

item_name: Symbolimpl_item_def_id: DefIdtrait_item_def_id: DefId
ExprAssignable

Checking that this expression can be assigned where it needs to be

MatchExpressionArm(Box<MatchExpressionArmCause<'tcx>, Global>)

Computing common supertype in the arms of a match expression

Pattern

Type error arising from type checking a pattern against an expected type.

Fields of Pattern

span: Option<Span>

The span of the scrutinee or type expression which caused the root_ty type.

root_ty: &'tcx TyS<'tcx>

The root expected type induced by a scrutinee or type expression.

origin_expr: bool

Whether the Span came from an expression or a type expression.

ConstPatternStructural

Constants in patterns must have Structural type.

IfExpression(Box<IfExpressionCause, Global>)

Computing common supertype in an if expression

IfExpressionWithNoElse

Computing common supertype of an if expression with no else counter-part

MainFunctionType

main has wrong type

StartFunctionType

start has wrong type

IntrinsicType

Intrinsic has wrong type

MethodReceiver

Method receiver

UnifyReceiver(Box<UnifyReceiverContext<'tcx>, Global>)
ReturnNoExpression

return with no expression

ReturnValue(HirId)

return with an expression

ReturnType

Return type of this function

BlockTailExpression(HirId)

Block implicit return

TrivialBound

#[feature(trivial_bounds)] is not enabled

OpaqueType

If X is the concrete type of an opaque type impl Y, then X must implement Y

Auto Trait Implementations

impl<'tcx> !RefUnwindSafe for ObligationCauseCode<'tcx>

impl<'tcx> !Send for ObligationCauseCode<'tcx>

impl<'tcx> !Sync for ObligationCauseCode<'tcx>

impl<'tcx> Unpin for ObligationCauseCode<'tcx>

impl<'tcx> !UnwindSafe for ObligationCauseCode<'tcx>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized, 
[src]

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

impl<'a, T> Captures<'a> for T where
    T: ?Sized, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone, 
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> WithConstness for T[src]