pub enum UnsupportedTypeReason {
UnsupportedForm,
DisallowedImplTrait,
WrongGenericArity {
expected: usize,
},
WrongGenericArguments {
expected: &'static str,
},
UnsupportedTuple,
OwnedUninit,
SharedUninit,
AssociatedType,
UnsupportedGenericArgument,
BadArrayExtent(Box<UnsupportedArrayLen>),
}Expand description
Why a type was refused.
Variants§
UnsupportedForm
A syntactic form with no place in the language: a raw pointer, a bare
trait object, a closure type, a macro, Self, a never type, an inferred
type.
A #[prebindgen] crate is idiomatic Rust — the adapter owns the lowering
to pointers — so *const T / *mut T are refused here rather than
modelled. No adapter has a selection arm for one, so accepting them would
only defer the failure to a late “unresolved type”.
DisallowedImplTrait
impl Trait that is not the accepted callback form — anything but
impl Fn(..) + Send + Sync + 'static returning ().
WrongGenericArity
A generic that takes a fixed arity and did not get it — Option with no
argument, Result with one.
Counts type arguments, which is the whole question for every builtin
but one: a lifetime on Option, Vec, Box or Result is not a shape
this language has, and such a spelling is a nominal type nobody declared
rather than a builtin with a bad argument. Cow is the exception and has
its own reason, WrongGenericArguments.
WrongGenericArguments
A builtin whose whole argument list is not the shape it takes —
Cow<u8> (no lifetime), Cow<u8, 'a> (wrong order), Cow<'a, 'b, u8>
(two lifetimes).
Separate from WrongGenericArity because it
is about the list and not its type-argument count: each of those three
has exactly one type argument, and refusing them is what keeps every
accepted form rebuildable from its kind.
UnsupportedTuple
A non-empty tuple. Only () is in the language: no adapter has ever
lowered a tuple, so accepting one would defer the failure to a late
“unresolved type” instead of naming it here.
OwnedUninit
MaybeUninit<T> somewhere other than directly under a &mut.
The one acceptance rule about a position rather than a form:
Uninit exists, and only an out-parameter can hold
one. Owned, returned or stored in a field it promises nothing a
destination language can use, and reading it would be undefined.
&MaybeUninit<T> — a shared borrow of uninitialized storage.
A shared borrow promises a readable T, and this supplies storage that may
not be one. Only &mut MaybeUninit<T> means anything — see
Uninit.
AssociatedType
A path with a qualified self — <T as Trait>::Assoc.
The frontend never captures impl blocks, so it cannot know what an
associated type resolves to; carrying the spelling would only move the
failure downstream.
UnsupportedGenericArgument
A generic argument that is neither a type nor a lifetime — a const generic, an associated-type binding.
BadArrayExtent(Box<UnsupportedArrayLen>)
The array’s extent — see ArrayLenReason.
Trait Implementations§
Source§impl Clone for UnsupportedTypeReason
impl Clone for UnsupportedTypeReason
Source§fn clone(&self) -> UnsupportedTypeReason
fn clone(&self) -> UnsupportedTypeReason
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for UnsupportedTypeReason
impl Debug for UnsupportedTypeReason
impl Eq for UnsupportedTypeReason
Source§impl PartialEq for UnsupportedTypeReason
impl PartialEq for UnsupportedTypeReason
impl StructuralPartialEq for UnsupportedTypeReason
Auto Trait Implementations§
impl Freeze for UnsupportedTypeReason
impl RefUnwindSafe for UnsupportedTypeReason
impl Send for UnsupportedTypeReason
impl Sync for UnsupportedTypeReason
impl Unpin for UnsupportedTypeReason
impl UnsafeUnpin for UnsupportedTypeReason
impl UnwindSafe for UnsupportedTypeReason
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more