pub(crate) enum NoConstantGenericsReason {
NonTrivialConstArg,
IsEnumDiscriminant,
}
Expand description
Reason for why an anon const is not allowed to reference generic parameters
Variants§
NonTrivialConstArg
Const arguments are only allowed to use generic parameters when:
feature(generic_const_exprs)
is enabled or- the const argument is a sole const generic paramater, i.e.
foo::<{ N }>()
If neither of the above are true then this is used as the cause.
IsEnumDiscriminant
Enum discriminants are not allowed to reference generic parameters ever, this is used when an anon const is in the following position:
ⓘ
enum Foo<const N: isize> {
Variant = { N }, // this anon const is not allowed to use generics
}
Trait Implementations§
source§impl Clone for NoConstantGenericsReason
impl Clone for NoConstantGenericsReason
source§fn clone(&self) -> NoConstantGenericsReason
fn clone(&self) -> NoConstantGenericsReason
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for NoConstantGenericsReason
impl Debug for NoConstantGenericsReason
source§impl PartialEq<NoConstantGenericsReason> for NoConstantGenericsReason
impl PartialEq<NoConstantGenericsReason> for NoConstantGenericsReason
source§fn eq(&self, other: &NoConstantGenericsReason) -> bool
fn eq(&self, other: &NoConstantGenericsReason) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Copy for NoConstantGenericsReason
impl Eq for NoConstantGenericsReason
impl StructuralEq for NoConstantGenericsReason
impl StructuralPartialEq for NoConstantGenericsReason
Auto Trait Implementations§
impl RefUnwindSafe for NoConstantGenericsReason
impl Send for NoConstantGenericsReason
impl Sync for NoConstantGenericsReason
impl Unpin for NoConstantGenericsReason
impl UnwindSafe for NoConstantGenericsReason
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
Mutably borrows from an owned value. Read more
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: 1 byte
Size for each variant:
NonTrivialConstArg
: 0 bytesIsEnumDiscriminant
: 0 bytes