Expand description
Concrete error types for all operations which may be invalid in a certain const context.
StructsΒ§
- Call
Unstable π - A call to an
#[unstable]
const fn,#[rustc_const_unstable]
function or trait. - Conditionally
Const πCall - A call to a function that is in a trait, or has trait bounds that make it conditionally-const.
- Coroutine π
- Escaping
Cell πBorrow - A borrow of a type that contains an
UnsafeCell
somewhere. The borrow might escape to the final value of the constant, and thus we cannot allow this (for now). We may allow it in the future for static items. - Escaping
MutBorrow π - This op is for
&mut
borrows in the trailing expression of a constant which uses the βenclosing scopes ruleβ to leak its locals into anonymous static or const items. - FnCall
Indirect π - A function call where the callee is a pointer.
- FnCall
NonConst π - A function call where the callee is not marked as
const
. - Heap
Allocation π - Inline
Asm π - Intrinsic
NonConst π - A call to an intrinsic that is just not const-callable at all.
- Intrinsic
Unstable π - A call to an intrinsic that is just not const-callable at all.
- Live
Drop π - Panic
NonStr π - A call to a
panic()
lang item where the first argument is not a&str
. - RawPtr
Comparison π - Comparing raw pointers for equality. Not currently intended to ever be allowed, even behind a feature gate: operation depends on allocation base addresses that are not known at compile-time.
- RawPtr
ToInt πCast - Casting raw pointer or function pointer to an integer. Not currently intended to ever be allowed, even behind a feature gate: operation depends on allocation base addresses that are not known at compile-time.
- Thread
Local πAccess - An access to a thread-local
static
.
EnumsΒ§
TraitsΒ§
- NonConst
Op - An operation that is not allowed in a const context.
FunctionsΒ§
- build_
error_ πfor_ const_ call - Build an error message reporting that a function call is not const (or only
conditionally const). In case that this call is desugared (like an operator
or sugar from something like a
for
loop), try to build a better error message that doesnβt call it a method.