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

pub enum ObligationCauseCode<'tcx> {
    MiscObligation,
    SliceOrArrayElem,
    TupleElem,
    ProjectionWf(ProjectionTy<'tcx>),
    ItemObligation(DefId),
    BindingObligation(DefId, Span),
    ReferenceOutlivesReferent(Ty<'tcx>),
    ObjectTypeBound(Ty<'tcx>, Region<'tcx>),
    ObjectCastObligation(Ty<'tcx>),
    Coercion {
        source: Ty<'tcx>,
        target: Ty<'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>>),
    Pattern {
        span: Option<Span>,
        root_ty: Ty<'tcx>,
        origin_expr: bool,
    },
    ConstPatternStructural,
    IfExpression(Box<IfExpressionCause>),
    IfExpressionWithNoElse,
    MainFunctionType,
    StartFunctionType,
    IntrinsicType,
    MethodReceiver,
    UnifyReceiver(Box<UnifyReceiverContext<'tcx>>),
    ReturnNoExpression,
    ReturnValue(HirId),
    ReturnType,
    BlockTailExpression(HirId),
    TrivialBound,
}

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(Ty<'tcx>)

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

ObjectTypeBound(Ty<'tcx>, Region<'tcx>)

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

ObjectCastObligation(Ty<'tcx>)

Obligation incurred due to an object cast.

Coercion

Obligation incurred due to a coercion.

Fields of Coercion

source: Ty<'tcx>target: Ty<'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 true, suggest const_in_array_repeat_expressions feature flag.

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>>)

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: Ty<'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>)

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>>)
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

Implementations

impl<'_> ObligationCauseCode<'_>[src]

pub fn peel_derives(&self) -> &Self[src]

Trait Implementations

impl<'tcx> Clone for ObligationCauseCode<'tcx>[src]

impl<'tcx> Debug for ObligationCauseCode<'tcx>[src]

impl<'tcx> Eq for ObligationCauseCode<'tcx>[src]

impl<'tcx> Hash for ObligationCauseCode<'tcx>[src]

impl<'tcx, '__lifted> Lift<'__lifted> for ObligationCauseCode<'tcx>[src]

type Lifted = ObligationCauseCode<'__lifted>

impl<'tcx> PartialEq<ObligationCauseCode<'tcx>> for ObligationCauseCode<'tcx>[src]

impl<'tcx> StructuralEq for ObligationCauseCode<'tcx>[src]

impl<'tcx> StructuralPartialEq for ObligationCauseCode<'tcx>[src]

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> MaybeResult<T> for T[src]

type Error = !

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]