Enum rustc_infer::traits::MethodViolationCode
source · pub enum MethodViolationCode {
StaticMethod(Option<((String, Span), (String, Span))>),
ReferencesSelfInput(Option<Span>),
ReferencesSelfOutput,
ReferencesImplTraitInTrait(Span),
AsyncFn,
WhereClauseReferencesSelf,
Generic,
UndispatchableReceiver(Option<Span>),
}
Expand description
Reasons a method might not be object-safe.
Variants§
StaticMethod(Option<((String, Span), (String, Span))>)
e.g., fn foo()
ReferencesSelfInput(Option<Span>)
e.g., fn foo(&self, x: Self)
ReferencesSelfOutput
e.g., fn foo(&self) -> Self
ReferencesImplTraitInTrait(Span)
e.g., fn foo(&self) -> impl Sized
AsyncFn
e.g., async fn foo(&self)
WhereClauseReferencesSelf
e.g., fn foo(&self) where Self: Clone
Generic
e.g., fn foo<A>()
UndispatchableReceiver(Option<Span>)
the method’s receiver (self
argument) can’t be dispatched on
Auto Trait Implementations§
impl RefUnwindSafe for MethodViolationCode
impl !Send for MethodViolationCode
impl !Sync for MethodViolationCode
impl Unpin for MethodViolationCode
impl UnwindSafe for MethodViolationCode
Blanket Implementations§
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: 72 bytes
Size for each variant:
StaticMethod
: 68 bytesReferencesSelfInput
: 12 bytesReferencesSelfOutput
: 0 bytesReferencesImplTraitInTrait
: 8 bytesAsyncFn
: 0 bytesWhereClauseReferencesSelf
: 0 bytesGeneric
: 0 bytesUndispatchableReceiver
: 12 bytes