struct MirLowerCtx<'a, 'db> {Show 14 fields
result: MirBody<'db>,
owner: InferBodyId<'db>,
store_owner: ExpressionStoreOwnerId,
current_loop_blocks: Option<LoopBlocks>,
labeled_loop_blocks: FxHashMap<LabelId, LoopBlocks>,
discr_temp: Option<Place>,
db: &'db dyn HirDatabase,
store: &'a ExpressionStore,
infer: &'a InferenceResult<'db>,
types: &'db DefaultAny<'db>,
resolver: Resolver<'db>,
drop_scopes: Vec<DropScope>,
env: ParamEnv<'db>,
infcx: InferCtxt<'db>,
}Fields§
§result: MirBody<'db>§owner: InferBodyId<'db>§store_owner: ExpressionStoreOwnerId§current_loop_blocks: Option<LoopBlocks>§labeled_loop_blocks: FxHashMap<LabelId, LoopBlocks>§discr_temp: Option<Place>§db: &'db dyn HirDatabase§store: &'a ExpressionStore§infer: &'a InferenceResult<'db>§types: &'db DefaultAny<'db>§resolver: Resolver<'db>§drop_scopes: Vec<DropScope>§env: ParamEnv<'db>§infcx: InferCtxt<'db>Implementations§
Source§impl<'db> MirLowerCtx<'_, 'db>
impl<'db> MirLowerCtx<'_, 'db>
fn lower_expr_to_some_place_without_adjust( &mut self, expr_id: ExprId, prev_block: BasicBlockId, ) -> Result<Option<(PlaceRef<'db>, BasicBlockId)>, MirLowerError<'db>>
fn lower_expr_to_some_place_with_adjust( &mut self, expr_id: ExprId, prev_block: BasicBlockId, adjustments: &[Adjustment], ) -> Result<Option<(PlaceRef<'db>, BasicBlockId)>, MirLowerError<'db>>
pub(super) fn lower_expr_as_place_with_adjust( &mut self, current: BasicBlockId, expr_id: ExprId, upgrade_rvalue: bool, adjustments: &[Adjustment], ) -> Result<Option<(PlaceRef<'db>, BasicBlockId)>, MirLowerError<'db>>
pub(super) fn lower_expr_as_place( &mut self, current: BasicBlockId, expr_id: ExprId, upgrade_rvalue: bool, ) -> Result<Option<(PlaceRef<'db>, BasicBlockId)>, MirLowerError<'db>>
pub(super) fn lower_expr_as_place_without_adjust( &mut self, current: BasicBlockId, expr_id: ExprId, upgrade_rvalue: bool, ) -> Result<Option<(PlaceRef<'db>, BasicBlockId)>, MirLowerError<'db>>
fn lower_overloaded_index( &mut self, current: BasicBlockId, place: PlaceRef<'db>, base_ty: Ty<'db>, result_ty: Ty<'db>, index_operand: Operand, span: MirSpan, index_fn: (FunctionId, GenericArgs<'db>), ) -> Result<Option<(PlaceRef<'db>, BasicBlockId)>, MirLowerError<'db>>
fn lower_overloaded_deref( &mut self, current: BasicBlockId, place: PlaceRef<'db>, source_ty: Ty<'db>, target_ty: Ty<'db>, span: MirSpan, mutability: bool, ) -> Result<Option<(PlaceRef<'db>, BasicBlockId)>, MirLowerError<'db>>
Source§impl<'db> MirLowerCtx<'_, 'db>
impl<'db> MirLowerCtx<'_, 'db>
Sourcepub(super) fn pattern_match(
&mut self,
current: BasicBlockId,
current_else: Option<BasicBlockId>,
cond_place: PlaceRef<'db>,
pattern: PatId,
) -> Result<(BasicBlockId, Option<BasicBlockId>), MirLowerError<'db>>
pub(super) fn pattern_match( &mut self, current: BasicBlockId, current_else: Option<BasicBlockId>, cond_place: PlaceRef<'db>, pattern: PatId, ) -> Result<(BasicBlockId, Option<BasicBlockId>), MirLowerError<'db>>
It gets a current unterminated block, appends some statements and possibly a terminator to it to check if
the pattern matches and write bindings, and returns two unterminated blocks, one for the matched path (which
can be the current block) and one for the mismatched path. If the input pattern is irrefutable, the
mismatched path block is None.
By default, it will create a new block for mismatched path. If you already have one, you can provide it with
current_else argument to save an unnecessary jump. If current_else isn’t None, the result mismatched path
wouldn’t be None as well. Note that this function will add jumps to the beginning of the current_else block,
so it should be an empty block.
pub(super) fn pattern_match_assignment( &mut self, current: BasicBlockId, value: PlaceRef<'db>, pattern: PatId, ) -> Result<BasicBlockId, MirLowerError<'db>>
pub(super) fn match_self_param( &mut self, id: BindingId, current: BasicBlockId, local: LocalId, ) -> Result<(BasicBlockId, Option<BasicBlockId>), MirLowerError<'db>>
fn pattern_match_inner( &mut self, current: BasicBlockId, current_else: Option<BasicBlockId>, cond_place: PlaceRef<'db>, pattern: PatId, mode: MatchingMode, ) -> Result<(BasicBlockId, Option<BasicBlockId>), MirLowerError<'db>>
fn pattern_match_binding( &mut self, id: BindingId, mode: BindingMode, cond_place: PlaceRef<'db>, span: MirSpan, current: BasicBlockId, current_else: Option<BasicBlockId>, ) -> Result<(BasicBlockId, Option<BasicBlockId>), MirLowerError<'db>>
fn push_match_assignment( &mut self, current: BasicBlockId, target_place: LocalId, mode: BindingMode, cond_place: PlaceRef<'db>, span: MirSpan, )
fn pattern_match_const( &mut self, current_else: Option<BasicBlockId>, current: BasicBlockId, c: Operand, cond_place: PlaceRef<'db>, pattern: Idx<Pat>, ) -> Result<(BasicBlockId, Option<BasicBlockId>), MirLowerError<'db>>
fn pattern_matching_variant( &mut self, cond_place: PlaceRef<'db>, variant: VariantId, current: BasicBlockId, span: MirSpan, current_else: Option<BasicBlockId>, shape: AdtPatternShape<'_>, mode: MatchingMode, ) -> Result<(BasicBlockId, Option<BasicBlockId>), MirLowerError<'db>>
fn pattern_matching_variant_fields( &mut self, shape: AdtPatternShape<'_>, variant_data: &VariantFields, v: VariantId, current: BasicBlockId, current_else: Option<BasicBlockId>, cond_place: &PlaceRef<'db>, mode: MatchingMode, ) -> Result<(BasicBlockId, Option<BasicBlockId>), MirLowerError<'db>>
fn pattern_match_adt( &mut self, current: BasicBlockId, current_else: Option<BasicBlockId>, args: impl Iterator<Item = (ProjectionElem<LocalId>, PatId)>, cond_place: &PlaceRef<'db>, mode: MatchingMode, ) -> Result<(BasicBlockId, Option<BasicBlockId>), MirLowerError<'db>>
fn pattern_match_tuple_like( &mut self, current: BasicBlockId, current_else: Option<BasicBlockId>, args: &[PatId], ellipsis: Option<u32>, fields: impl DoubleEndedIterator<Item = ProjectionElem<LocalId>> + Clone, cond_place: &PlaceRef<'db>, mode: MatchingMode, ) -> Result<(BasicBlockId, Option<BasicBlockId>), MirLowerError<'db>>
Source§impl<'a, 'db> MirLowerCtx<'a, 'db>
impl<'a, 'db> MirLowerCtx<'a, 'db>
fn new( db: &'db dyn HirDatabase, owner: InferBodyId<'db>, store: &'a ExpressionStore, infer: &'a InferenceResult<'db>, ) -> Self
fn interner(&self) -> DbInterner<'db>
fn lang_items(&self) -> &'db LangItems
fn temp( &mut self, ty: Ty<'db>, current: BasicBlockId, span: MirSpan, ) -> Result<LocalId, MirLowerError<'db>>
fn lower_expr_to_some_operand( &mut self, expr_id: ExprId, current: BasicBlockId, ) -> Result<Option<(Operand, BasicBlockId)>, MirLowerError<'db>>
fn lower_expr_to_place_with_adjust( &mut self, expr_id: ExprId, place: PlaceRef<'db>, current: BasicBlockId, adjustments: &[Adjustment], ) -> Result<Option<BasicBlockId>, MirLowerError<'db>>
fn lower_expr_to_place_with_borrow_adjust( &mut self, expr_id: ExprId, place: PlaceRef<'db>, current: BasicBlockId, rest: &[Adjustment], m: Mutability, ) -> Result<Option<BasicBlockId>, MirLowerError<'db>>
fn lower_expr_to_place( &mut self, expr_id: ExprId, place: PlaceRef<'db>, prev_block: BasicBlockId, ) -> Result<Option<BasicBlockId>, MirLowerError<'db>>
fn lower_expr_to_place_without_adjust( &mut self, expr_id: ExprId, place: PlaceRef<'db>, current: BasicBlockId, ) -> Result<Option<BasicBlockId>, MirLowerError<'db>>
fn push_field_projection( &mut self, place: &mut PlaceRef<'db>, expr_id: ExprId, ) -> Result<(), MirLowerError<'db>>
fn lower_literal_or_const_to_operand( &mut self, ty: Ty<'db>, loc: &ExprId, ) -> Result<Operand, MirLowerError<'db>>
fn lower_literal_to_operand( &mut self, ty: Ty<'db>, l: &Literal, ) -> Result<Operand, MirLowerError<'db>>
fn new_basic_block(&mut self) -> BasicBlockId
fn lower_const( &mut self, const_id: GeneralConstId<'db>, prev_block: BasicBlockId, place: PlaceRef<'db>, subst: GenericArgs<'db>, span: MirSpan, ) -> Result<(), MirLowerError<'db>>
fn lower_const_to_operand( &mut self, subst: GenericArgs<'db>, const_id: GeneralConstId<'db>, ) -> Result<Operand, MirLowerError<'db>>
fn write_bytes_to_place( &mut self, prev_block: BasicBlockId, place: PlaceRef<'db>, cv: Box<[u8]>, ty: Ty<'db>, span: MirSpan, ) -> Result<(), MirLowerError<'db>>
fn lower_enum_variant( &mut self, variant_id: EnumVariantId, prev_block: BasicBlockId, place: PlaceRef<'db>, ty: Ty<'db>, fields: Box<[Operand]>, span: MirSpan, ) -> Result<BasicBlockId, MirLowerError<'db>>
fn lower_call_and_args( &mut self, func: Operand, args: impl Iterator<Item = ExprId>, place: PlaceRef<'db>, current: BasicBlockId, is_uninhabited: bool, span: MirSpan, ) -> Result<Option<BasicBlockId>, MirLowerError<'db>>
fn lower_call( &mut self, func: Operand, args: Box<[Operand]>, place: PlaceRef<'db>, current: BasicBlockId, is_uninhabited: bool, span: MirSpan, ) -> Result<Option<BasicBlockId>, MirLowerError<'db>>
fn is_unterminated(&mut self, source: BasicBlockId) -> bool
fn set_terminator( &mut self, source: BasicBlockId, terminator: TerminatorKind, span: MirSpan, )
fn set_goto( &mut self, source: BasicBlockId, target: BasicBlockId, span: MirSpan, )
fn expr_ty_without_adjust(&self, e: ExprId) -> Ty<'db>
fn expr_ty_after_adjustments(&self, e: ExprId) -> Ty<'db>
fn push_statement(&mut self, block: BasicBlockId, statement: Statement)
fn push_fake_read( &mut self, block: BasicBlockId, p: PlaceRef<'db>, span: MirSpan, )
fn push_assignment( &mut self, block: BasicBlockId, place: PlaceRef<'db>, rvalue: Rvalue, span: MirSpan, )
fn discr_temp_place(&mut self, current: BasicBlockId) -> PlaceRef<'db>
fn lower_loop( &mut self, prev_block: BasicBlockId, place: PlaceRef<'db>, label: Option<LabelId>, span: MirSpan, f: impl FnOnce(&mut MirLowerCtx<'_, 'db>, BasicBlockId) -> Result<(), MirLowerError<'db>>, ) -> Result<Option<BasicBlockId>, MirLowerError<'db>>
fn has_adjustments(&self, expr_id: ExprId) -> bool
fn merge_blocks( &mut self, b1: Option<BasicBlockId>, b2: Option<BasicBlockId>, span: MirSpan, ) -> Option<BasicBlockId>
fn current_loop_end(&mut self) -> Result<BasicBlockId, MirLowerError<'db>>
fn is_uninhabited(&self, expr_id: ExprId) -> bool
Sourcefn push_storage_live(
&mut self,
b: BindingId,
current: BasicBlockId,
) -> Result<(), MirLowerError<'db>>
fn push_storage_live( &mut self, b: BindingId, current: BasicBlockId, ) -> Result<(), MirLowerError<'db>>
This function push StorageLive statement for the binding, and applies changes to add StorageDead and
Drop in the appropriated places.
fn push_storage_live_for_local( &mut self, l: LocalId, current: BasicBlockId, span: MirSpan, ) -> Result<(), MirLowerError<'db>>
fn lower_block_to_place( &mut self, statements: &[Statement], current: BasicBlockId, tail: Option<ExprId>, place: PlaceRef<'db>, span: MirSpan, ) -> Result<Option<Idx<BasicBlock>>, MirLowerError<'db>>
fn lower_params_and_bindings( &mut self, params: impl Iterator<Item = (PatId, Ty<'db>)> + Clone, self_binding: Option<(BindingId, Ty<'db>)>, pick_binding: impl Fn(BindingId) -> bool, ) -> Result<BasicBlockId, MirLowerError<'db>>
fn binding_local(&self, b: BindingId) -> Result<LocalId, MirLowerError<'db>>
fn const_eval_discriminant( &self, variant: EnumVariantId, ) -> Result<i128, MirLowerError<'db>>
fn edition(&self) -> Edition
fn krate(&self) -> Crate
fn display_target(&self) -> DisplayTarget
fn drop_until_scope( &mut self, scope_index: usize, current: BasicBlockId, span: MirSpan, ) -> BasicBlockId
fn push_drop_scope(&mut self) -> DropScopeToken
Sourcefn pop_drop_scope_assume_dropped_internal(&mut self)
fn pop_drop_scope_assume_dropped_internal(&mut self)
Don’t call directly
Sourcefn pop_drop_scope_internal(
&mut self,
current: BasicBlockId,
span: MirSpan,
) -> BasicBlockId
fn pop_drop_scope_internal( &mut self, current: BasicBlockId, span: MirSpan, ) -> BasicBlockId
Don’t call directly
fn pop_drop_scope_assert_finished( &mut self, current: BasicBlockId, span: MirSpan, ) -> Result<BasicBlockId, MirLowerError<'db>>
fn emit_drop_and_storage_dead_for_scope( &mut self, scope: &DropScope, current: &mut Idx<BasicBlock>, span: MirSpan, )
Auto Trait Implementations§
impl<'a, 'db> !Freeze for MirLowerCtx<'a, 'db>
impl<'a, 'db> !RefUnwindSafe for MirLowerCtx<'a, 'db>
impl<'a, 'db> !Send for MirLowerCtx<'a, 'db>
impl<'a, 'db> !Sync for MirLowerCtx<'a, 'db>
impl<'a, 'db> Unpin for MirLowerCtx<'a, 'db>
impl<'a, 'db> UnsafeUnpin for MirLowerCtx<'a, 'db>
impl<'a, 'db> !UnwindSafe for MirLowerCtx<'a, 'db>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more