Skip to main content

UnsupportedTypeReason

Enum UnsupportedTypeReason 

Source
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.

Fields

§expected: usize
§

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.

Fields

§expected: &'static str
§

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.

§

SharedUninit

&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

Source§

fn clone(&self) -> UnsupportedTypeReason

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for UnsupportedTypeReason

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for UnsupportedTypeReason

Source§

impl PartialEq for UnsupportedTypeReason

Source§

fn eq(&self, other: &UnsupportedTypeReason) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for UnsupportedTypeReason

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.