-
Couldn't load subscription status.
- Fork 192
Open
Labels
Description
Handle all const contexts properly:
- Array type length expressions
- Array repeat length expressions
- constants
- statics
- enum discriminants
- const generic arguments
Handle allowed subset properly in const contexts:
- Literals.
- Const parameters.
- Paths to functions and constants. Recursively defining constants is not allowed.
- Paths to statics. These are only allowed within the initializer of a static.
- Tuple expressions.
- Array expressions.
- Struct expressions.
- Block expressions, including unsafe blocks.
- let statements and thus irrefutable patterns, including mutable bindings
- assignment expressions
- compound assignment expressions
- expression statements
- Field expressions.
- Index expressions, array indexing or slice with a usize.
- Range expressions.
- Closure expressions which don't capture variables from the environment.
- Built-in negation, arithmetic, logical, comparison or lazy boolean operators used on integer and floating point types, bool, and char.
- Shared borrows, except if applied to a type with interior mutability.
- The dereference operator except for raw pointers.
- Grouped expressions.
- Cast expressions, except
- pointer to address casts,
- function pointer to address casts, and
- unsizing casts to trait objects.
- Calls of const functions and const methods.
- loop, while and while let expressions.
- if, if let and match expressions.
- Mutable references are forbidden in const functions #1552
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Todo