Enum rustc_trait_selection::traits::ObligationCauseCode [−][src]
pub enum ObligationCauseCode<'tcx> {
Show 47 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,
WellFormed(Option<WellFormedLoc>),
MatchImpl(Rc<ObligationCauseCode<'tcx>>, DefId),
}Variants
Not well classified or should be obvious from the span.
A slice or array is WF only if T: Sized.
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.
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.
Obligation incurred due to a coercion.
Various cases where expressions must be Sized / Copy / etc.
L = X implies that L is Sized.
(x1, .., xn) must be Sized.
S { ... } must be Sized.
VariableType(HirId)Type of each variable must be Sized.
Argument type must be Sized.
Return type must be Sized.
Yield type must be Sized.
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.
Types of fields (other than the last, except for packed structs) in a struct must be sized.
Constant expressions must be sized.
static items must have Sync type.
BuiltinDerivedObligation(DerivedObligationCause<'tcx>)ImplDerivedObligation(DerivedObligationCause<'tcx>)DerivedObligation(DerivedObligationCause<'tcx>)Error derived when matching traits/impls; see ObligationCause for more details
Error derived when matching traits/impls; see ObligationCause for more details
Fields of CompareImplMethodObligation
Error derived when matching traits/impls; see ObligationCause for more details
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
Type error arising from type checking a pattern against an expected type.
Fields of Pattern
Constants in patterns must have Structural type.
IfExpression(Box<IfExpressionCause, Global>)Computing common supertype in an if expression
Computing common supertype of an if expression with no else counter-part
main has wrong type
start has wrong type
Intrinsic has wrong type
Method receiver
UnifyReceiver(Box<UnifyReceiverContext<'tcx>, Global>)return with no expression
ReturnValue(HirId)return with an expression
Return type of this function
BlockTailExpression(HirId)Block implicit return
#[feature(trivial_bounds)] is not enabled
If X is the concrete type of an opaque type impl Y, then X must implement Y
WellFormed(Option<WellFormedLoc>)Well-formed checking. If a WellFormedLoc is provided,
then it will be used to eprform HIR-based wf checking
after an error occurs, in order to generate a more precise error span.
This is purely for diagnostic purposes - it is always
correct to use MiscObligation instead, or to specify
WellFormed(None)
MatchImpl(Rc<ObligationCauseCode<'tcx>>, DefId)From match_impl. The cause for us having to match an impl, and the DefId we are matching against.
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
Mutably borrows from an owned value. Read more
Layout
Note: Most layout information is completely unstable and may be different between compiler versions and platforms. 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: 40 bytes