Struct rustc_mir::build::Builder [−][src]
struct Builder<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
hir: Cx<'a, 'gcx, 'tcx>,
cfg: CFG<'tcx>,
fn_span: Span,
arg_count: usize,
scopes: Vec<Scope<'tcx>>,
unpushed_unsafe: Safety,
push_unsafe_count: usize,
breakable_scopes: Vec<BreakableScope<'tcx>>,
source_scopes: IndexVec<SourceScope, SourceScopeData>,
source_scope_local_data: IndexVec<SourceScope, SourceScopeLocalData>,
source_scope: SourceScope,
guard_context: Vec<GuardFrame>,
var_indices: NodeMap<LocalsForNode>,
local_decls: IndexVec<Local, LocalDecl<'tcx>>,
unit_temp: Option<Place<'tcx>>,
cached_resume_block: Option<BasicBlock>,
cached_return_block: Option<BasicBlock>,
cached_unreachable_block: Option<BasicBlock>,
}🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Fields
hir: Cx<'a, 'gcx, 'tcx>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
cfg: CFG<'tcx>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
fn_span: Span
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
arg_count: usize
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
scopes: Vec<Scope<'tcx>>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
the current set of scopes, updated as we traverse;
see the scope module for more details
unpushed_unsafe: Safety
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
The current unsafe block in scope, even if it is hidden by a PushUnsafeBlock
push_unsafe_count: usize
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
The number of push_unsafe_block levels in scope
breakable_scopes: Vec<BreakableScope<'tcx>>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
the current set of breakables; see the scope module for more
details
source_scopes: IndexVec<SourceScope, SourceScopeData>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
the vector of all scopes that we have created thus far; we track this for debuginfo later
source_scope_local_data: IndexVec<SourceScope, SourceScopeLocalData>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
source_scope: SourceScope
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
guard_context: Vec<GuardFrame>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
the guard-context: each time we build the guard expression for a match arm, we push onto this stack, and then pop when we finish building it.
var_indices: NodeMap<LocalsForNode>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Maps node ids of variable bindings to the Locals created for them.
(A match binding can have two locals; the 2nd is for the arm's guard.)
local_decls: IndexVec<Local, LocalDecl<'tcx>>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
unit_temp: Option<Place<'tcx>>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
cached_resume_block: Option<BasicBlock>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
cached block with the RESUME terminator; this is created when first set of cleanups are built.
cached_return_block: Option<BasicBlock>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
cached block with the RETURN terminator
cached_unreachable_block: Option<BasicBlock>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
cached block with the UNREACHABLE terminator
Methods
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>[src]
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>pub fn ast_block(
&mut self,
destination: &Place<'tcx>,
block: BasicBlock,
ast_block: &'tcx Block,
source_info: SourceInfo
) -> BlockAnd<()>[src]
pub fn ast_block(
&mut self,
destination: &Place<'tcx>,
block: BasicBlock,
ast_block: &'tcx Block,
source_info: SourceInfo
) -> BlockAnd<()>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
fn ast_block_stmts(
&mut self,
destination: &Place<'tcx>,
block: BasicBlock,
span: Span,
stmts: Vec<StmtRef<'tcx>>,
expr: Option<ExprRef<'tcx>>,
safety_mode: BlockSafety
) -> BlockAnd<()>[src]
fn ast_block_stmts(
&mut self,
destination: &Place<'tcx>,
block: BasicBlock,
span: Span,
stmts: Vec<StmtRef<'tcx>>,
expr: Option<ExprRef<'tcx>>,
safety_mode: BlockSafety
) -> BlockAnd<()>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
fn update_source_scope_for_safety_mode(
&mut self,
span: Span,
safety_mode: BlockSafety
)[src]
fn update_source_scope_for_safety_mode(
&mut self,
span: Span,
safety_mode: BlockSafety
)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
If we are changing the safety mode, create a new source scope
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>[src]
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>pub fn as_constant<M>(&mut self, expr: M) -> Constant<'tcx> where
M: Mirror<'tcx, Output = Expr<'tcx>>, [src]
pub fn as_constant<M>(&mut self, expr: M) -> Constant<'tcx> where
M: Mirror<'tcx, Output = Expr<'tcx>>, 🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Compile expr, yielding a compile-time constant. Assumes that
expr is a valid compile-time constant!
fn expr_as_constant(&mut self, expr: Expr<'tcx>) -> Constant<'tcx>[src]
fn expr_as_constant(&mut self, expr: Expr<'tcx>) -> Constant<'tcx>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>[src]
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>pub fn as_place<M>(
&mut self,
block: BasicBlock,
expr: M
) -> BlockAnd<Place<'tcx>> where
M: Mirror<'tcx, Output = Expr<'tcx>>, [src]
pub fn as_place<M>(
&mut self,
block: BasicBlock,
expr: M
) -> BlockAnd<Place<'tcx>> where
M: Mirror<'tcx, Output = Expr<'tcx>>, 🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Compile expr, yielding a place that we can move from etc.
fn expr_as_place(
&mut self,
block: BasicBlock,
expr: Expr<'tcx>
) -> BlockAnd<Place<'tcx>>[src]
fn expr_as_place(
&mut self,
block: BasicBlock,
expr: Expr<'tcx>
) -> BlockAnd<Place<'tcx>>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>[src]
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>pub fn as_local_rvalue<M>(
&mut self,
block: BasicBlock,
expr: M
) -> BlockAnd<Rvalue<'tcx>> where
M: Mirror<'tcx, Output = Expr<'tcx>>, [src]
pub fn as_local_rvalue<M>(
&mut self,
block: BasicBlock,
expr: M
) -> BlockAnd<Rvalue<'tcx>> where
M: Mirror<'tcx, Output = Expr<'tcx>>, 🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
See comment on as_local_operand
pub fn as_rvalue<M>(
&mut self,
block: BasicBlock,
scope: Option<Scope>,
expr: M
) -> BlockAnd<Rvalue<'tcx>> where
M: Mirror<'tcx, Output = Expr<'tcx>>, [src]
pub fn as_rvalue<M>(
&mut self,
block: BasicBlock,
scope: Option<Scope>,
expr: M
) -> BlockAnd<Rvalue<'tcx>> where
M: Mirror<'tcx, Output = Expr<'tcx>>, 🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Compile expr, yielding an rvalue.
fn expr_as_rvalue(
&mut self,
block: BasicBlock,
scope: Option<Scope>,
expr: Expr<'tcx>
) -> BlockAnd<Rvalue<'tcx>>[src]
fn expr_as_rvalue(
&mut self,
block: BasicBlock,
scope: Option<Scope>,
expr: Expr<'tcx>
) -> BlockAnd<Rvalue<'tcx>>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn build_binary_op(
&mut self,
block: BasicBlock,
op: BinOp,
span: Span,
ty: Ty<'tcx>,
lhs: Operand<'tcx>,
rhs: Operand<'tcx>
) -> BlockAnd<Rvalue<'tcx>>[src]
pub fn build_binary_op(
&mut self,
block: BasicBlock,
op: BinOp,
span: Span,
ty: Ty<'tcx>,
lhs: Operand<'tcx>,
rhs: Operand<'tcx>
) -> BlockAnd<Rvalue<'tcx>>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
fn neg_1_literal(&mut self, span: Span, ty: Ty<'tcx>) -> Operand<'tcx>[src]
fn neg_1_literal(&mut self, span: Span, ty: Ty<'tcx>) -> Operand<'tcx>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
fn minval_literal(&mut self, span: Span, ty: Ty<'tcx>) -> Operand<'tcx>[src]
fn minval_literal(&mut self, span: Span, ty: Ty<'tcx>) -> Operand<'tcx>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>[src]
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>pub fn as_local_operand<M>(
&mut self,
block: BasicBlock,
expr: M
) -> BlockAnd<Operand<'tcx>> where
M: Mirror<'tcx, Output = Expr<'tcx>>, [src]
pub fn as_local_operand<M>(
&mut self,
block: BasicBlock,
expr: M
) -> BlockAnd<Operand<'tcx>> where
M: Mirror<'tcx, Output = Expr<'tcx>>, 🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Returns an operand suitable for use until the end of the current scope expression.
The operand returned from this function will not be valid after an ExprKind::Scope is passed, so please do not return it from functions to avoid bad miscompiles.
pub fn as_operand<M>(
&mut self,
block: BasicBlock,
scope: Option<Scope>,
expr: M
) -> BlockAnd<Operand<'tcx>> where
M: Mirror<'tcx, Output = Expr<'tcx>>, [src]
pub fn as_operand<M>(
&mut self,
block: BasicBlock,
scope: Option<Scope>,
expr: M
) -> BlockAnd<Operand<'tcx>> where
M: Mirror<'tcx, Output = Expr<'tcx>>, 🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Compile expr into a value that can be used as an operand.
If expr is a place like x, this will introduce a
temporary tmp = x, so that we capture the value of x at
this time.
The operand is known to be live until the end of scope.
fn expr_as_operand(
&mut self,
block: BasicBlock,
scope: Option<Scope>,
expr: Expr<'tcx>
) -> BlockAnd<Operand<'tcx>>[src]
fn expr_as_operand(
&mut self,
block: BasicBlock,
scope: Option<Scope>,
expr: Expr<'tcx>
) -> BlockAnd<Operand<'tcx>>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>[src]
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>pub fn as_temp<M>(
&mut self,
block: BasicBlock,
temp_lifetime: Option<Scope>,
expr: M
) -> BlockAnd<Local> where
M: Mirror<'tcx, Output = Expr<'tcx>>, [src]
pub fn as_temp<M>(
&mut self,
block: BasicBlock,
temp_lifetime: Option<Scope>,
expr: M
) -> BlockAnd<Local> where
M: Mirror<'tcx, Output = Expr<'tcx>>, 🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Compile expr into a fresh temporary. This is used when building
up rvalues so as to freeze the value that will be consumed.
fn expr_as_temp(
&mut self,
block: BasicBlock,
temp_lifetime: Option<Scope>,
expr: Expr<'tcx>
) -> BlockAnd<Local>[src]
fn expr_as_temp(
&mut self,
block: BasicBlock,
temp_lifetime: Option<Scope>,
expr: Expr<'tcx>
) -> BlockAnd<Local>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>[src]
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>pub fn into_expr(
&mut self,
destination: &Place<'tcx>,
block: BasicBlock,
expr: Expr<'tcx>
) -> BlockAnd<()>[src]
pub fn into_expr(
&mut self,
destination: &Place<'tcx>,
block: BasicBlock,
expr: Expr<'tcx>
) -> BlockAnd<()>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Compile expr, storing the result into destination, which
is assumed to be uninitialized.
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>[src]
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>pub fn stmt_expr(&mut self, block: BasicBlock, expr: Expr<'tcx>) -> BlockAnd<()>[src]
pub fn stmt_expr(&mut self, block: BasicBlock, expr: Expr<'tcx>) -> BlockAnd<()>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>[src]
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>pub fn into<E>(
&mut self,
destination: &Place<'tcx>,
block: BasicBlock,
expr: E
) -> BlockAnd<()> where
E: EvalInto<'tcx>, [src]
pub fn into<E>(
&mut self,
destination: &Place<'tcx>,
block: BasicBlock,
expr: E
) -> BlockAnd<()> where
E: EvalInto<'tcx>, 🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>[src]
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>pub fn simplify_candidate<'pat>(
&mut self,
block: BasicBlock,
candidate: &mut Candidate<'pat, 'tcx>
) -> BlockAnd<()>[src]
pub fn simplify_candidate<'pat>(
&mut self,
block: BasicBlock,
candidate: &mut Candidate<'pat, 'tcx>
) -> BlockAnd<()>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
fn simplify_match_pair<'pat>(
&mut self,
match_pair: MatchPair<'pat, 'tcx>,
candidate: &mut Candidate<'pat, 'tcx>
) -> Result<(), MatchPair<'pat, 'tcx>>[src]
fn simplify_match_pair<'pat>(
&mut self,
match_pair: MatchPair<'pat, 'tcx>,
candidate: &mut Candidate<'pat, 'tcx>
) -> Result<(), MatchPair<'pat, 'tcx>>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Tries to simplify match_pair, returning true if
successful. If successful, new match pairs and bindings will
have been pushed into the candidate. If no simplification is
possible, Err is returned and no changes are made to
candidate.
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>[src]
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>pub fn test<'pat>(&mut self, match_pair: &MatchPair<'pat, 'tcx>) -> Test<'tcx>[src]
pub fn test<'pat>(&mut self, match_pair: &MatchPair<'pat, 'tcx>) -> Test<'tcx>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Identifies what test is needed to decide if match_pair is applicable.
It is a bug to call this with a simplifyable pattern.
pub fn add_cases_to_switch<'pat>(
&mut self,
test_place: &Place<'tcx>,
candidate: &Candidate<'pat, 'tcx>,
switch_ty: Ty<'tcx>,
options: &mut Vec<u128>,
indices: &mut FxHashMap<&'tcx Const<'tcx>, usize>
) -> bool[src]
pub fn add_cases_to_switch<'pat>(
&mut self,
test_place: &Place<'tcx>,
candidate: &Candidate<'pat, 'tcx>,
switch_ty: Ty<'tcx>,
options: &mut Vec<u128>,
indices: &mut FxHashMap<&'tcx Const<'tcx>, usize>
) -> bool🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn add_variants_to_switch<'pat>(
&mut self,
test_place: &Place<'tcx>,
candidate: &Candidate<'pat, 'tcx>,
variants: &mut BitVector
) -> bool[src]
pub fn add_variants_to_switch<'pat>(
&mut self,
test_place: &Place<'tcx>,
candidate: &Candidate<'pat, 'tcx>,
variants: &mut BitVector
) -> bool🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn perform_test(
&mut self,
block: BasicBlock,
place: &Place<'tcx>,
test: &Test<'tcx>
) -> Vec<BasicBlock>[src]
pub fn perform_test(
&mut self,
block: BasicBlock,
place: &Place<'tcx>,
test: &Test<'tcx>
) -> Vec<BasicBlock>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Generates the code to perform a test.
fn compare(
&mut self,
block: BasicBlock,
fail_block: BasicBlock,
span: Span,
op: BinOp,
left: Operand<'tcx>,
right: Operand<'tcx>
) -> BasicBlock[src]
fn compare(
&mut self,
block: BasicBlock,
fail_block: BasicBlock,
span: Span,
op: BinOp,
left: Operand<'tcx>,
right: Operand<'tcx>
) -> BasicBlock🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn sort_candidate<'pat>(
&mut self,
test_place: &Place<'tcx>,
test: &Test<'tcx>,
candidate: &Candidate<'pat, 'tcx>,
resulting_candidates: &mut [Vec<Candidate<'pat, 'tcx>>]
) -> bool[src]
pub fn sort_candidate<'pat>(
&mut self,
test_place: &Place<'tcx>,
test: &Test<'tcx>,
candidate: &Candidate<'pat, 'tcx>,
resulting_candidates: &mut [Vec<Candidate<'pat, 'tcx>>]
) -> bool🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Given that we are performing test against test_place,
this job sorts out what the status of candidate will be
after the test. The resulting_candidates vector stores, for
each possible outcome of test, a vector of the candidates
that will result. This fn should add a (possibly modified)
clone of candidate into resulting_candidates wherever
appropriate.
So, for example, if this candidate is x @ Some(P0) and the
test is a variant test, then we would add (x as Option).0 @ P0 to the resulting_candidates entry corresponding to the
variant Some.
However, in some cases, the test may just not be relevant to
candidate. For example, suppose we are testing whether foo.x == 22,
but in one match arm we have Foo { x: _, ... }... in that case,
the test for what value x has has no particular relevance
to this candidate. In such cases, this function just returns false
without doing anything. This is used by the overall match_candidates
algorithm to structure the match as a whole. See match_candidates for
more details.
FIXME(#29623). In some cases, we have some tricky choices to
make. for example, if we are testing that x == 22, but the
candidate is x @ 13..55, what should we do? In the event
that the test is true, we know that the candidate applies, but
in the event of false, we don't know that it doesn't
apply. For now, we return false, indicate that the test does
not apply to this candidate, but it might be we can get
tighter match code if we do something a bit different.
fn candidate_without_match_pair<'pat>(
&mut self,
match_pair_index: usize,
candidate: &Candidate<'pat, 'tcx>
) -> Candidate<'pat, 'tcx>[src]
fn candidate_without_match_pair<'pat>(
&mut self,
match_pair_index: usize,
candidate: &Candidate<'pat, 'tcx>
) -> Candidate<'pat, 'tcx>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
fn candidate_after_slice_test<'pat>(
&mut self,
match_pair_index: usize,
candidate: &Candidate<'pat, 'tcx>,
prefix: &'pat [Pattern<'tcx>],
opt_slice: Option<&'pat Pattern<'tcx>>,
suffix: &'pat [Pattern<'tcx>]
) -> Candidate<'pat, 'tcx>[src]
fn candidate_after_slice_test<'pat>(
&mut self,
match_pair_index: usize,
candidate: &Candidate<'pat, 'tcx>,
prefix: &'pat [Pattern<'tcx>],
opt_slice: Option<&'pat Pattern<'tcx>>,
suffix: &'pat [Pattern<'tcx>]
) -> Candidate<'pat, 'tcx>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
fn candidate_after_variant_switch<'pat>(
&mut self,
match_pair_index: usize,
adt_def: &'tcx AdtDef,
variant_index: usize,
subpatterns: &'pat [FieldPattern<'tcx>],
candidate: &Candidate<'pat, 'tcx>
) -> Candidate<'pat, 'tcx>[src]
fn candidate_after_variant_switch<'pat>(
&mut self,
match_pair_index: usize,
adt_def: &'tcx AdtDef,
variant_index: usize,
subpatterns: &'pat [FieldPattern<'tcx>],
candidate: &Candidate<'pat, 'tcx>
) -> Candidate<'pat, 'tcx>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
fn error_simplifyable<'pat>(&mut self, match_pair: &MatchPair<'pat, 'tcx>) -> ![src]
fn error_simplifyable<'pat>(&mut self, match_pair: &MatchPair<'pat, 'tcx>) -> !🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>[src]
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>pub fn field_match_pairs<'pat>(
&mut self,
place: Place<'tcx>,
subpatterns: &'pat [FieldPattern<'tcx>]
) -> Vec<MatchPair<'pat, 'tcx>>[src]
pub fn field_match_pairs<'pat>(
&mut self,
place: Place<'tcx>,
subpatterns: &'pat [FieldPattern<'tcx>]
) -> Vec<MatchPair<'pat, 'tcx>>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn prefix_slice_suffix<'pat>(
&mut self,
match_pairs: &mut Vec<MatchPair<'pat, 'tcx>>,
place: &Place<'tcx>,
prefix: &'pat [Pattern<'tcx>],
opt_slice: Option<&'pat Pattern<'tcx>>,
suffix: &'pat [Pattern<'tcx>]
)[src]
pub fn prefix_slice_suffix<'pat>(
&mut self,
match_pairs: &mut Vec<MatchPair<'pat, 'tcx>>,
place: &Place<'tcx>,
prefix: &'pat [Pattern<'tcx>],
opt_slice: Option<&'pat Pattern<'tcx>>,
suffix: &'pat [Pattern<'tcx>]
)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>[src]
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>pub fn match_expr(
&mut self,
destination: &Place<'tcx>,
span: Span,
block: BasicBlock,
discriminant: ExprRef<'tcx>,
arms: Vec<Arm<'tcx>>
) -> BlockAnd<()>[src]
pub fn match_expr(
&mut self,
destination: &Place<'tcx>,
span: Span,
block: BasicBlock,
discriminant: ExprRef<'tcx>,
arms: Vec<Arm<'tcx>>
) -> BlockAnd<()>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn user_assert_ty(
&mut self,
block: BasicBlock,
hir_id: HirId,
var: NodeId,
span: Span
)[src]
pub fn user_assert_ty(
&mut self,
block: BasicBlock,
hir_id: HirId,
var: NodeId,
span: Span
)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn expr_into_pattern(
&mut self,
block: BasicBlock,
ty: Option<HirId>,
irrefutable_pat: Pattern<'tcx>,
initializer: ExprRef<'tcx>
) -> BlockAnd<()>[src]
pub fn expr_into_pattern(
&mut self,
block: BasicBlock,
ty: Option<HirId>,
irrefutable_pat: Pattern<'tcx>,
initializer: ExprRef<'tcx>
) -> BlockAnd<()>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn place_into_pattern(
&mut self,
block: BasicBlock,
irrefutable_pat: Pattern<'tcx>,
initializer: &Place<'tcx>
) -> BlockAnd<()>[src]
pub fn place_into_pattern(
&mut self,
block: BasicBlock,
irrefutable_pat: Pattern<'tcx>,
initializer: &Place<'tcx>
) -> BlockAnd<()>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn declare_bindings(
&mut self,
visibility_scope: Option<SourceScope>,
scope_span: Span,
lint_level: LintLevel,
pattern: &Pattern<'tcx>,
has_guard: ArmHasGuard
) -> Option<SourceScope>[src]
pub fn declare_bindings(
&mut self,
visibility_scope: Option<SourceScope>,
scope_span: Span,
lint_level: LintLevel,
pattern: &Pattern<'tcx>,
has_guard: ArmHasGuard
) -> Option<SourceScope>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Declares the bindings of the given pattern and returns the visibility scope for the bindings in this patterns, if such a scope had to be created. NOTE: Declaring the bindings should always be done in their drop scope.
pub fn storage_live_binding(
&mut self,
block: BasicBlock,
var: NodeId,
span: Span,
for_guard: ForGuard
) -> Place<'tcx>[src]
pub fn storage_live_binding(
&mut self,
block: BasicBlock,
var: NodeId,
span: Span,
for_guard: ForGuard
) -> Place<'tcx>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn schedule_drop_for_binding(
&mut self,
var: NodeId,
span: Span,
for_guard: ForGuard
)[src]
pub fn schedule_drop_for_binding(
&mut self,
var: NodeId,
span: Span,
for_guard: ForGuard
)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn visit_bindings<F>(&mut self, pattern: &Pattern<'tcx>, f: &mut F) where
F: FnMut(&mut Self, Mutability, Name, BindingMode, NodeId, Span, Ty<'tcx>), [src]
pub fn visit_bindings<F>(&mut self, pattern: &Pattern<'tcx>, f: &mut F) where
F: FnMut(&mut Self, Mutability, Name, BindingMode, NodeId, Span, Ty<'tcx>), 🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>[src]
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>fn match_candidates<'pat>(
&mut self,
span: Span,
arm_blocks: &mut ArmBlocks,
candidates: Vec<Candidate<'pat, 'tcx>>,
block: BasicBlock
) -> Vec<BasicBlock>[src]
fn match_candidates<'pat>(
&mut self,
span: Span,
arm_blocks: &mut ArmBlocks,
candidates: Vec<Candidate<'pat, 'tcx>>,
block: BasicBlock
) -> Vec<BasicBlock>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
The main match algorithm. It begins with a set of candidates
candidates and has the job of generating code to determine
which of these candidates, if any, is the correct one. The
candidates are sorted such that the first item in the list
has the highest priority. When a candidate is found to match
the value, we will generate a branch to the appropriate
block found in arm_blocks.
The return value is a list of "otherwise" blocks. These are points in execution where we found that NONE of the candidates apply. In principle, this means that the input list was not exhaustive, though at present we sometimes are not smart enough to recognize all exhaustive inputs.
It might be surprising that the input can be inexhaustive.
Indeed, initially, it is not, because all matches are
exhaustive in Rust. But during processing we sometimes divide
up the list of candidates and recurse with a non-exhaustive
list. This is important to keep the size of the generated code
under control. See test_candidates for more details.
fn join_otherwise_blocks(
&mut self,
span: Span,
otherwise: Vec<BasicBlock>
) -> BasicBlock[src]
fn join_otherwise_blocks(
&mut self,
span: Span,
otherwise: Vec<BasicBlock>
) -> BasicBlock🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
fn test_candidates<'pat>(
&mut self,
span: Span,
arm_blocks: &mut ArmBlocks,
candidates: &[Candidate<'pat, 'tcx>],
block: BasicBlock
) -> (Vec<BasicBlock>, usize)[src]
fn test_candidates<'pat>(
&mut self,
span: Span,
arm_blocks: &mut ArmBlocks,
candidates: &[Candidate<'pat, 'tcx>],
block: BasicBlock
) -> (Vec<BasicBlock>, usize)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
This is the most subtle part of the matching algorithm. At
this point, the input candidates have been fully simplified,
and so we know that all remaining match-pairs require some
sort of test. To decide what test to do, we take the highest
priority candidate (last one in the list) and extract the
first match-pair from the list. From this we decide what kind
of test is needed using test, defined in the test module.
Note: taking the first match pair is somewhat arbitrary, and we might do better here by choosing more carefully what to test.
For example, consider the following possible match-pairs:
x @ Some(P)-- we will do aSwitchto decide what variantxhasx @ 22-- we will do aSwitchIntx @ 3..5-- we will do a range test- etc.
Once we know what sort of test we are going to perform, this
test may also help us with other candidates. So we walk over
the candidates (from high to low priority) and check. This
gives us, for each outcome of the test, a transformed list of
candidates. For example, if we are testing the current
variant of x.0, and we have a candidate {x.0 @ Some(v), x.1 @ 22}, then we would have a resulting candidate of {(x.0 as Some).0 @ v, x.1 @ 22}. Note that the first match-pair is now
simpler (and, in fact, irrefutable).
But there may also be candidates that the test just doesn't apply to. The classical example involves wildcards:
match (x, y, z) { (true, _, true) => true, // (0) (_, true, _) => true, // (1) (false, false, _) => false, // (2) (true, _, false) => false, // (3) }
In that case, after we test on x, there are 2 overlapping candidate
sets:
- If the outcome is that
xis true, candidates 0, 1, and 3 - If the outcome is that
xis false, candidates 1 and 2
Here, the traditional "decision tree" method would generate 2 separate code-paths for the 2 separate cases.
In some cases, this duplication can create an exponential amount of code. This is most easily seen by noticing that this method terminates with precisely the reachable arms being reachable - but that problem is trivially NP-complete:
match (var0, var1, var2, var3, ..) {
(true, _, _, false, true, ...) => false,
(_, true, true, false, _, ...) => false,
(false, _, false, false, _, ...) => false,
...
_ => true
}
Here the last arm is reachable only if there is an assignment to the variables that does not match any of the literals. Therefore, compilation would take an exponential amount of time in some cases.
That kind of exponential worst-case might not occur in practice, but our simplistic treatment of constants and guards would make it occur in very common situations - for example #29740:
match x { "foo" if foo_guard => ..., "bar" if bar_guard => ..., "baz" if baz_guard => ..., ... }
Here we first test the match-pair x @ "foo", which is an Eq test.
It might seem that we would end up with 2 disjoint candidate sets, consisting of the first candidate or the other 3, but our algorithm doesn't reason about "foo" being distinct from the other constants; it considers the latter arms to potentially match after both outcomes, which obviously leads to an exponential amount of tests.
To avoid these kinds of problems, our algorithm tries to ensure
the amount of generated tests is linear. When we do a k-way test,
we return an additional "unmatched" set alongside the obvious k
sets. When we encounter a candidate that would be present in more
than one of the sets, we put it and all candidates below it into the
"unmatched" set. This ensures these k+1 sets are disjoint.
After we perform our test, we branch into the appropriate candidate
set and recurse with match_candidates. These sub-matches are
obviously inexhaustive - as we discarded our otherwise set - so
we set their continuation to do match_candidates on the
"unmatched" set (which is again inexhaustive).
If you apply this to the above test, you basically wind up with an if-else-if chain, testing each candidate in turn, which is precisely what we want.
In addition to avoiding exponential-time blowups, this algorithm also has nice property that each guard and arm is only generated once.
fn bind_and_guard_matched_candidate<'pat>(
&mut self,
block: BasicBlock,
arm_blocks: &mut ArmBlocks,
candidate: Candidate<'pat, 'tcx>
) -> Option<BasicBlock>[src]
fn bind_and_guard_matched_candidate<'pat>(
&mut self,
block: BasicBlock,
arm_blocks: &mut ArmBlocks,
candidate: Candidate<'pat, 'tcx>
) -> Option<BasicBlock>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Initializes each of the bindings from the candidate by moving/copying/ref'ing the source as appropriate. Tests the guard, if any, and then branches to the arm. Returns the block for the case where the guard fails.
Note: we check earlier that if there is a guard, there cannot be move bindings. This isn't really important for the self-consistency of this fn, but the reason for it should be clear: after we've done the assignments, if there were move bindings, further tests would be a use-after-move (which would in turn be detected by the borrowck code that runs on the MIR).
fn bind_matched_candidate_for_guard(
&mut self,
block: BasicBlock,
bindings: &[Binding<'tcx>]
)[src]
fn bind_matched_candidate_for_guard(
&mut self,
block: BasicBlock,
bindings: &[Binding<'tcx>]
)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
fn bind_matched_candidate_for_arm_body(
&mut self,
block: BasicBlock,
bindings: &[Binding<'tcx>]
)[src]
fn bind_matched_candidate_for_arm_body(
&mut self,
block: BasicBlock,
bindings: &[Binding<'tcx>]
)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
fn declare_binding(
&mut self,
source_info: SourceInfo,
visibility_scope: SourceScope,
mutability: Mutability,
name: Name,
mode: BindingMode,
var_id: NodeId,
var_ty: Ty<'tcx>,
has_guard: ArmHasGuard
)[src]
fn declare_binding(
&mut self,
source_info: SourceInfo,
visibility_scope: SourceScope,
mutability: Mutability,
name: Name,
mode: BindingMode,
var_id: NodeId,
var_ty: Ty<'tcx>,
has_guard: ArmHasGuard
)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Each binding (ref mut var/ref var/mut var/var, where
the bound var has type T in the arm body) in a pattern
maps to two locals. The first local is a binding for
occurrences of var in the guard, which will all have type
&T. The second local is a binding for occurrences of var
in the arm body, which will have type T.
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>[src]
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>pub fn temp(&mut self, ty: Ty<'tcx>, span: Span) -> Place<'tcx>[src]
pub fn temp(&mut self, ty: Ty<'tcx>, span: Span) -> Place<'tcx>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Add a new temporary value of type ty storing the result of
evaluating expr.
NB: No cleanup is scheduled for this temporary. You should
call schedule_drop once the temporary is initialized.
pub fn literal_operand(
&mut self,
span: Span,
ty: Ty<'tcx>,
literal: Literal<'tcx>
) -> Operand<'tcx>[src]
pub fn literal_operand(
&mut self,
span: Span,
ty: Ty<'tcx>,
literal: Literal<'tcx>
) -> Operand<'tcx>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn unit_rvalue(&mut self) -> Rvalue<'tcx>[src]
pub fn unit_rvalue(&mut self) -> Rvalue<'tcx>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn zero_literal(&mut self, span: Span, ty: Ty<'tcx>) -> Operand<'tcx>[src]
pub fn zero_literal(&mut self, span: Span, ty: Ty<'tcx>) -> Operand<'tcx>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn push_usize(
&mut self,
block: BasicBlock,
source_info: SourceInfo,
value: u64
) -> Place<'tcx>[src]
pub fn push_usize(
&mut self,
block: BasicBlock,
source_info: SourceInfo,
value: u64
) -> Place<'tcx>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn consume_by_copy_or_move(&self, place: Place<'tcx>) -> Operand<'tcx>[src]
pub fn consume_by_copy_or_move(&self, place: Place<'tcx>) -> Operand<'tcx>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>[src]
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>pub fn in_breakable_scope<F, R>(
&mut self,
loop_block: Option<BasicBlock>,
break_block: BasicBlock,
break_destination: Place<'tcx>,
f: F
) -> R where
F: FnOnce(&mut Builder<'a, 'gcx, 'tcx>) -> R, [src]
pub fn in_breakable_scope<F, R>(
&mut self,
loop_block: Option<BasicBlock>,
break_block: BasicBlock,
break_destination: Place<'tcx>,
f: F
) -> R where
F: FnOnce(&mut Builder<'a, 'gcx, 'tcx>) -> R, 🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Start a breakable scope, which tracks where continue and break
should branch to. See module comment for more details.
Returns the might_break attribute of the BreakableScope used.
pub fn in_opt_scope<F, R>(
&mut self,
opt_scope: Option<(Scope, SourceInfo)>,
block: BasicBlock,
f: F
) -> BlockAnd<R> where
F: FnOnce(&mut Builder<'a, 'gcx, 'tcx>) -> BlockAnd<R>, [src]
pub fn in_opt_scope<F, R>(
&mut self,
opt_scope: Option<(Scope, SourceInfo)>,
block: BasicBlock,
f: F
) -> BlockAnd<R> where
F: FnOnce(&mut Builder<'a, 'gcx, 'tcx>) -> BlockAnd<R>, 🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn in_scope<F, R>(
&mut self,
region_scope: (Scope, SourceInfo),
lint_level: LintLevel,
block: BasicBlock,
f: F
) -> BlockAnd<R> where
F: FnOnce(&mut Builder<'a, 'gcx, 'tcx>) -> BlockAnd<R>, [src]
pub fn in_scope<F, R>(
&mut self,
region_scope: (Scope, SourceInfo),
lint_level: LintLevel,
block: BasicBlock,
f: F
) -> BlockAnd<R> where
F: FnOnce(&mut Builder<'a, 'gcx, 'tcx>) -> BlockAnd<R>, 🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Convenience wrapper that pushes a scope and then executes f
to build its contents, popping the scope afterwards.
pub fn push_scope(&mut self, region_scope: (Scope, SourceInfo))[src]
pub fn push_scope(&mut self, region_scope: (Scope, SourceInfo))🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Push a scope onto the stack. You can then build code in this
scope and call pop_scope afterwards. Note that these two
calls must be paired; using in_scope as a convenience
wrapper maybe preferable.
pub fn pop_scope(
&mut self,
region_scope: (Scope, SourceInfo),
block: BasicBlock
) -> BlockAnd<()>[src]
pub fn pop_scope(
&mut self,
region_scope: (Scope, SourceInfo),
block: BasicBlock
) -> BlockAnd<()>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Pops a scope, which should have region scope region_scope,
adding any drops onto the end of block that are needed.
This must match 1-to-1 with push_scope.
pub fn exit_scope(
&mut self,
span: Span,
region_scope: (Scope, SourceInfo),
block: BasicBlock,
target: BasicBlock
)[src]
pub fn exit_scope(
&mut self,
span: Span,
region_scope: (Scope, SourceInfo),
block: BasicBlock,
target: BasicBlock
)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Branch out of block to target, exiting all scopes up to
and including region_scope. This will insert whatever drops are
needed, as well as tracking this exit for the SEME region. See
module comment for details.
pub fn generator_drop_cleanup(&mut self) -> Option<BasicBlock>[src]
pub fn generator_drop_cleanup(&mut self) -> Option<BasicBlock>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Creates a path that performs all required cleanup for dropping a generator.
This path terminates in GeneratorDrop. Returns the start of the path. None indicates there’s no cleanup to do at this point.
pub fn new_source_scope(
&mut self,
span: Span,
lint_level: LintLevel,
safety: Option<Safety>
) -> SourceScope[src]
pub fn new_source_scope(
&mut self,
span: Span,
lint_level: LintLevel,
safety: Option<Safety>
) -> SourceScope🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Creates a new source scope, nested in the current one.
pub fn find_breakable_scope(
&mut self,
span: Span,
label: Scope
) -> &mut BreakableScope<'tcx>[src]
pub fn find_breakable_scope(
&mut self,
span: Span,
label: Scope
) -> &mut BreakableScope<'tcx>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Finds the breakable scope for a given label. This is used for
resolving break and continue.
pub fn source_info(&self, span: Span) -> SourceInfo[src]
pub fn source_info(&self, span: Span) -> SourceInfo🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Given a span and the current source scope, make a SourceInfo.
pub fn region_scope_of_return_scope(&self) -> Scope[src]
pub fn region_scope_of_return_scope(&self) -> Scope🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Returns the region::Scope of the scope which should be exited by a
return.
pub fn topmost_scope(&self) -> Scope[src]
pub fn topmost_scope(&self) -> Scope🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Returns the topmost active scope, which is known to be alive until the next scope expression.
pub fn local_scope(&self) -> Option<Scope>[src]
pub fn local_scope(&self) -> Option<Scope>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Returns the scope that we should use as the lifetime of an operand. Basically, an operand must live until it is consumed. This is similar to, but not quite the same as, the temporary scope (which can be larger or smaller).
Consider:
let x = foo(bar(X, Y));
We wish to pop the storage for X and Y after bar() is
called, not after the whole let is completed.
As another example, if the second argument diverges:
foo(Box::new(2), panic!())
We would allocate the box but then free it on the unwinding path; we would also emit a free on the 'success' path from panic, but that will turn out to be removed as dead-code.
When building statics/constants, returns None since
intermediate values do not have to be dropped in that case.
pub fn schedule_abort(&mut self) -> BasicBlock[src]
pub fn schedule_abort(&mut self) -> BasicBlock🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn schedule_drop(
&mut self,
span: Span,
region_scope: Scope,
place: &Place<'tcx>,
place_ty: Ty<'tcx>
)[src]
pub fn schedule_drop(
&mut self,
span: Span,
region_scope: Scope,
place: &Place<'tcx>,
place_ty: Ty<'tcx>
)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Indicates that place should be dropped on exit from
region_scope.
pub fn diverge_cleanup(&mut self) -> BasicBlock[src]
pub fn diverge_cleanup(&mut self) -> BasicBlock🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Creates a path that performs all required cleanup for unwinding.
This path terminates in Resume. Returns the start of the path. See module comment for more details. None indicates there’s no cleanup to do at this point.
fn resume_block(&mut self) -> BasicBlock[src]
fn resume_block(&mut self) -> BasicBlock🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
fn diverge_cleanup_gen(&mut self, generator_drop: bool) -> BasicBlock[src]
fn diverge_cleanup_gen(&mut self, generator_drop: bool) -> BasicBlock🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn build_drop(
&mut self,
block: BasicBlock,
span: Span,
location: Place<'tcx>,
ty: Ty<'tcx>
) -> BlockAnd<()>[src]
pub fn build_drop(
&mut self,
block: BasicBlock,
span: Span,
location: Place<'tcx>,
ty: Ty<'tcx>
) -> BlockAnd<()>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Utility function for non-scope code to build their own drops
pub fn build_drop_and_replace(
&mut self,
block: BasicBlock,
span: Span,
location: Place<'tcx>,
value: Operand<'tcx>
) -> BlockAnd<()>[src]
pub fn build_drop_and_replace(
&mut self,
block: BasicBlock,
span: Span,
location: Place<'tcx>,
value: Operand<'tcx>
) -> BlockAnd<()>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Utility function for non-scope code to build their own drops
pub fn assert(
&mut self,
block: BasicBlock,
cond: Operand<'tcx>,
expected: bool,
msg: AssertMessage<'tcx>,
span: Span
) -> BasicBlock[src]
pub fn assert(
&mut self,
block: BasicBlock,
cond: Operand<'tcx>,
expected: bool,
msg: AssertMessage<'tcx>,
span: Span
) -> BasicBlock🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Create an Assert terminator and return the success block. If the boolean condition operand is not the expected value, a runtime panic will be caused with the given message.
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>[src]
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>fn is_bound_var_in_guard(&self, id: NodeId) -> bool[src]
fn is_bound_var_in_guard(&self, id: NodeId) -> bool🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
fn var_local_id(&self, id: NodeId, for_guard: ForGuard) -> Local[src]
fn var_local_id(&self, id: NodeId, for_guard: ForGuard) -> Local🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>[src]
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx>fn new(
hir: Cx<'a, 'gcx, 'tcx>,
span: Span,
arg_count: usize,
safety: Safety,
return_ty: Ty<'tcx>
) -> Builder<'a, 'gcx, 'tcx>[src]
fn new(
hir: Cx<'a, 'gcx, 'tcx>,
span: Span,
arg_count: usize,
safety: Safety,
return_ty: Ty<'tcx>
) -> Builder<'a, 'gcx, 'tcx>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
fn finish(
self,
upvar_decls: Vec<UpvarDecl>,
yield_ty: Option<Ty<'tcx>>
) -> Mir<'tcx>[src]
fn finish(
self,
upvar_decls: Vec<UpvarDecl>,
yield_ty: Option<Ty<'tcx>>
) -> Mir<'tcx>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
fn args_and_body(
&mut self,
block: BasicBlock,
arguments: &[ArgInfo<'gcx>],
argument_scope: Scope,
ast_body: &'gcx Expr
) -> BlockAnd<()>[src]
fn args_and_body(
&mut self,
block: BasicBlock,
arguments: &[ArgInfo<'gcx>],
argument_scope: Scope,
ast_body: &'gcx Expr
) -> BlockAnd<()>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
fn get_unit_temp(&mut self) -> Place<'tcx>[src]
fn get_unit_temp(&mut self) -> Place<'tcx>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
fn return_block(&mut self) -> BasicBlock[src]
fn return_block(&mut self) -> BasicBlock🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
fn unreachable_block(&mut self) -> BasicBlock[src]
fn unreachable_block(&mut self) -> BasicBlock🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?