Skip to main content

Module as_place

Module as_place 

Source
Expand description

See docs in build/expr/mod.rs

Re-exportsΒ§

use std::assert_matches; πŸ”’
use std::iter; πŸ”’
use rustc_abi::FIRST_VARIANT; πŸ”’
use rustc_abi::FieldIdx; πŸ”’
use rustc_abi::VariantIdx; πŸ”’
use rustc_hir::def_id::LocalDefId; πŸ”’
use rustc_middle::hir::place::Projection as HirProjection; πŸ”’
use rustc_middle::hir::place::ProjectionKind as HirProjectionKind; πŸ”’
use rustc_middle::mir::AssertKind::BoundsCheck; πŸ”’
use rustc_middle::ty; πŸ”’
use rustc_middle::ty::AdtDef; πŸ”’
use rustc_middle::ty::CanonicalUserTypeAnnotation; πŸ”’
use rustc_middle::ty::Ty; πŸ”’
use rustc_middle::ty::Variance; πŸ”’
use rustc_span::Span; πŸ”’
use rustc_span::bug; πŸ”’
use rustc_span::span_bug; πŸ”’
use tracing::debug; πŸ”’
use tracing::instrument; πŸ”’
use tracing::instrument; πŸ”’
use tracing::trace; πŸ”’
use crate::builder::ForGuard::OutsideGuard; πŸ”’
use crate::builder::ForGuard::RefWithinGuard; πŸ”’
use crate::builder::expr::category::Category; πŸ”’
use crate::builder::scope::LintLevel; πŸ”’
use crate::builder::BlockAnd; πŸ”’
use crate::builder::BlockAndExtension; πŸ”’
use crate::builder::Builder; πŸ”’
use crate::builder::Capture; πŸ”’
use crate::builder::CaptureMap; πŸ”’
use rustc_middle::mir::*; πŸ”’
use rustc_middle::thir::*; πŸ”’

StructsΒ§

PlaceBuilder πŸ”’
PlaceBuilder is used to create places during MIR construction. It allows you to β€œbuild up” a place by pushing more and more projections onto the end, and then convert the final set into a place using the to_place method.

EnumsΒ§

PlaceBase πŸ”’
The β€œoutermost” place that holds this value.

FunctionsΒ§

convert_to_hir_projections_and_truncate_for_capture πŸ”’
Given a list of MIR projections, convert them to list of HIR ProjectionKind. The projections are truncated to represent a path that might be captured by a closure/coroutine. This implies the vector returned from this function doesn’t contain ProjectionElems Downcast, ConstantIndex, Index, or Subslice because those will never be part of a path that is captured by a closure. We stop applying projections once we see the first projection that isn’t captured by a closure.
enable_precise_capture πŸ”’
Precise capture is enabled if user is using Rust Edition 2021 or higher.
find_capture_matching_projections πŸ”’
Given a closure, returns the index of a capture within the desugared closure struct and the ty::CapturedPlace which is the ancestor of the Place represented using the var_hir_id and projection.
is_ancestor_or_same_capture πŸ”’
Return true if the proj_possible_ancestor represents an ancestor path to proj_capture or proj_possible_ancestor is same as proj_capture, assuming they both start off of the same root variable.
strip_prefix πŸ”’
Returns projections remaining after stripping an initial prefix of HIR projections.
to_upvars_resolved_place_builder πŸ”’
Takes an upvar place and tries to resolve it into a PlaceBuilder with PlaceBase::Local