-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
anonymous constants are overly restrictive wrt variance #90629
Copy link
Copy link
Closed
Labels
A-const-genericsArea: const generics (parameters and arguments)Area: const generics (parameters and arguments)A-varianceArea: Variance (https://doc.rust-lang.org/nomicon/subtyping.html)Area: Variance (https://doc.rust-lang.org/nomicon/subtyping.html)C-bugCategory: This is a bug.Category: This is a bug.F-generic_const_exprs`#![feature(generic_const_exprs)]``#![feature(generic_const_exprs)]`
Metadata
Metadata
Assignees
Labels
A-const-genericsArea: const generics (parameters and arguments)Area: const generics (parameters and arguments)A-varianceArea: Variance (https://doc.rust-lang.org/nomicon/subtyping.html)Area: Variance (https://doc.rust-lang.org/nomicon/subtyping.html)C-bugCategory: This is a bug.Category: This is a bug.F-generic_const_exprs`#![feature(generic_const_exprs)]``#![feature(generic_const_exprs)]`
Type
Fields
Give feedbackNo fields configured for issues without a type.
cc #89829 (comment)
this currently causes an error as
'ais considered invariant because it is used in an anonymous constant.This shouldn't actually be needed for
std::mem::size_ofas it doesn't care about variance.Once stuff like the following causes an error (instead of a future imcompat lint, cc #56105), subtyping should not be able to influence const eval, so we could allow lifetimes used in constants to remain bivariant. It is not clear that we should do that, as this restriction on subtyping is definitely not obvious or even necessarily desirable.