[−][src]Struct rustc_trait_selection::traits::const_evaluatable::AbstractConstBuilder

struct AbstractConstBuilder<'a, 'tcx> {
    tcx: TyCtxt<'tcx>,
    body: &'a Body<'tcx>,
    nodes: IndexVec<NodeId, Node<'tcx>>,
    locals: IndexVec<Local, NodeId>,
    checked_op_locals: BitSet<Local>,
}

Fields

tcx: TyCtxt<'tcx>body: &'a Body<'tcx>nodes: IndexVec<NodeId, Node<'tcx>>

The current WIP node tree.

locals: IndexVec<Local, NodeId>checked_op_locals: BitSet<Local>

We only allow field accesses if they access the result of a checked operation.

Implementations

impl<'a, 'tcx> AbstractConstBuilder<'a, 'tcx>[src]

fn error(&mut self, span: Option<Span>, msg: &str) -> Result<!, ErrorReported>[src]

fn new(
    tcx: TyCtxt<'tcx>,
    body: &'a Body<'tcx>
) -> Result<Option<AbstractConstBuilder<'a, 'tcx>>, ErrorReported>
[src]

fn place_to_local(
    &mut self,
    span: Span,
    p: &Place<'tcx>
) -> Result<Local, ErrorReported>
[src]

fn operand_to_node(
    &mut self,
    span: Span,
    op: &Operand<'tcx>
) -> Result<NodeId, ErrorReported>
[src]

fn check_binop(op: BinOp) -> bool[src]

We do not allow all binary operations in abstract consts, so filter disallowed ones.

fn check_unop(op: UnOp) -> bool[src]

While we currently allow all unary operations, we still want to explicitly guard against future changes here.

fn build_statement(
    &mut self,
    stmt: &Statement<'tcx>
) -> Result<(), ErrorReported>
[src]

fn build_terminator(
    &mut self,
    terminator: &Terminator<'tcx>
) -> Result<Option<BasicBlock>, ErrorReported>
[src]

Possible return values:

  • None: unsupported terminator, stop building
  • Some(None): supported terminator, finish building
  • Some(Some(block)): support terminator, build block next

fn build(self) -> Result<&'tcx [Node<'tcx>], ErrorReported>[src]

Builds the abstract const by walking the mir from start to finish and bailing out when encountering an unsupported operation.

Auto Trait Implementations

impl<'a, 'tcx> !RefUnwindSafe for AbstractConstBuilder<'a, 'tcx>

impl<'a, 'tcx> !Send for AbstractConstBuilder<'a, 'tcx>

impl<'a, 'tcx> !Sync for AbstractConstBuilder<'a, 'tcx>

impl<'a, 'tcx> Unpin for AbstractConstBuilder<'a, 'tcx> where
    'tcx: 'a, 

impl<'a, 'tcx> !UnwindSafe for AbstractConstBuilder<'a, 'tcx>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized, 
[src]

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> WithConstness for T[src]