[−][src]Trait rustc_mir::transform::check_consts::ops::NonConstOp

pub trait NonConstOp: Debug {
    fn feature_gate() -> Option<Symbol> { ... }
fn is_allowed_in_item(&self, ccx: &ConstCx<'_, '_>) -> bool { ... }
fn emit_error(&self, ccx: &ConstCx<'_, '_>, span: Span) { ... } }

An operation that is not always allowed in a const context.

Provided methods

fn feature_gate() -> Option<Symbol>

Returns the Symbol corresponding to the feature gate that would enable this operation, or None if such a feature gate does not exist.

fn is_allowed_in_item(&self, ccx: &ConstCx<'_, '_>) -> bool

Returns true if this operation is allowed in the given item.

This check should assume that we are not in a non-const fn, where all operations are legal.

By default, it returns true if and only if this operation has a corresponding feature gate and that gate is enabled.

fn emit_error(&self, ccx: &ConstCx<'_, '_>, span: Span)

Loading content...

Implementors

impl NonConstOp for CellBorrow[src]

impl NonConstOp for FnCallIndirect[src]

impl NonConstOp for FnCallNonConst[src]

impl NonConstOp for FnCallUnstable[src]

impl NonConstOp for HeapAllocation[src]

impl NonConstOp for InlineAsm[src]

impl NonConstOp for LiveDrop[src]

impl NonConstOp for MutAddressOf[src]

impl NonConstOp for MutBorrow[src]

impl NonConstOp for MutDeref[src]

impl NonConstOp for Panic[src]

impl NonConstOp for RawPtrComparison[src]

impl NonConstOp for RawPtrDeref[src]

impl NonConstOp for RawPtrToIntCast[src]

impl NonConstOp for StaticAccess[src]

impl NonConstOp for ThreadLocalAccess[src]

impl NonConstOp for UnionAccess[src]

Loading content...