Struct rustc_ty_utils::consts::AbstractConstBuilder
source · [−]pub struct AbstractConstBuilder<'a, 'tcx> {
tcx: TyCtxt<'tcx>,
body_id: ExprId,
body: &'a Thir<'tcx>,
nodes: IndexVec<NodeId, Node<'tcx>>,
}
Fields
tcx: TyCtxt<'tcx>
body_id: ExprId
body: &'a Thir<'tcx>
nodes: IndexVec<NodeId, Node<'tcx>>
The current WIP node tree.
Implementations
sourceimpl<'a, 'tcx> AbstractConstBuilder<'a, 'tcx>
impl<'a, 'tcx> AbstractConstBuilder<'a, 'tcx>
fn root_span(&self) -> Span
fn error(
&mut self,
sub: GenericConstantTooComplexSub
) -> Result<!, ErrorGuaranteed>
fn maybe_supported_error(
&mut self,
sub: GenericConstantTooComplexSub
) -> Result<!, ErrorGuaranteed>
pub fn new(
tcx: TyCtxt<'tcx>,
(body, body_id): (&'a Thir<'tcx>, ExprId)
) -> Result<Option<AbstractConstBuilder<'a, 'tcx>>, ErrorGuaranteed>
sourcefn check_binop(op: BinOp) -> bool
fn check_binop(op: BinOp) -> bool
We do not allow all binary operations in abstract consts, so filter disallowed ones.
sourcefn check_unop(op: UnOp) -> bool
fn check_unop(op: UnOp) -> bool
While we currently allow all unary operations, we still want to explicitly guard against future changes here.
sourcepub fn build(self) -> Result<&'tcx [Node<'tcx>], ErrorGuaranteed>
pub fn build(self) -> Result<&'tcx [Node<'tcx>], ErrorGuaranteed>
Builds the abstract const by walking the thir and bailing out when encountering an unsupported operation.
fn recurse_build(&mut self, node: ExprId) -> Result<NodeId, ErrorGuaranteed>
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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Layout
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 48 bytes