Rollup merge of #69714 - spastorino:place-ref-lifetime, r=oli-obk
Make PlaceRef take just one lifetime r? @eddyb
This commit is contained in:
commit
977d69fc19
@ -1827,9 +1827,9 @@ pub struct Field {
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub struct PlaceRef<'a, 'tcx> {
|
||||
pub struct PlaceRef<'tcx> {
|
||||
pub local: Local,
|
||||
pub projection: &'a [PlaceElem<'tcx>],
|
||||
pub projection: &'tcx [PlaceElem<'tcx>],
|
||||
}
|
||||
|
||||
impl<'tcx> Place<'tcx> {
|
||||
@ -1864,7 +1864,7 @@ pub fn as_local(&self) -> Option<Local> {
|
||||
self.as_ref().as_local()
|
||||
}
|
||||
|
||||
pub fn as_ref(&self) -> PlaceRef<'_, 'tcx> {
|
||||
pub fn as_ref(&self) -> PlaceRef<'tcx> {
|
||||
PlaceRef { local: self.local, projection: &self.projection }
|
||||
}
|
||||
}
|
||||
@ -1875,7 +1875,7 @@ fn from(local: Local) -> Self {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> PlaceRef<'a, 'tcx> {
|
||||
impl<'tcx> PlaceRef<'tcx> {
|
||||
/// Finds the innermost `Local` from this `Place`, *if* it is either a local itself or
|
||||
/// a single deref of a local.
|
||||
//
|
||||
|
@ -97,7 +97,7 @@ fn assign(&mut self, local: mir::Local, location: Location) {
|
||||
|
||||
fn process_place(
|
||||
&mut self,
|
||||
place_ref: &mir::PlaceRef<'_, 'tcx>,
|
||||
place_ref: &mir::PlaceRef<'tcx>,
|
||||
context: PlaceContext,
|
||||
location: Location,
|
||||
) {
|
||||
|
@ -364,7 +364,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
fn maybe_codegen_consume_direct(
|
||||
&mut self,
|
||||
bx: &mut Bx,
|
||||
place_ref: mir::PlaceRef<'_, 'tcx>,
|
||||
place_ref: mir::PlaceRef<'tcx>,
|
||||
) -> Option<OperandRef<'tcx, Bx::Value>> {
|
||||
debug!("maybe_codegen_consume_direct(place_ref={:?})", place_ref);
|
||||
|
||||
@ -408,7 +408,7 @@ fn maybe_codegen_consume_direct(
|
||||
pub fn codegen_consume(
|
||||
&mut self,
|
||||
bx: &mut Bx,
|
||||
place_ref: mir::PlaceRef<'_, 'tcx>,
|
||||
place_ref: mir::PlaceRef<'tcx>,
|
||||
) -> OperandRef<'tcx, Bx::Value> {
|
||||
debug!("codegen_consume(place_ref={:?})", place_ref);
|
||||
|
||||
|
@ -408,7 +408,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
pub fn codegen_place(
|
||||
&mut self,
|
||||
bx: &mut Bx,
|
||||
place_ref: mir::PlaceRef<'_, 'tcx>,
|
||||
place_ref: mir::PlaceRef<'tcx>,
|
||||
) -> PlaceRef<'tcx, Bx::Value> {
|
||||
debug!("codegen_place(place_ref={:?})", place_ref);
|
||||
let cx = self.cx;
|
||||
@ -497,7 +497,7 @@ pub fn codegen_place(
|
||||
result
|
||||
}
|
||||
|
||||
pub fn monomorphized_place_ty(&self, place_ref: mir::PlaceRef<'_, 'tcx>) -> Ty<'tcx> {
|
||||
pub fn monomorphized_place_ty(&self, place_ref: mir::PlaceRef<'tcx>) -> Ty<'tcx> {
|
||||
let tcx = self.cx.tcx();
|
||||
let place_ty = mir::Place::ty_from(place_ref.local, place_ref.projection, *self.mir, tcx);
|
||||
self.monomorphize(&place_ty.ty)
|
||||
|
@ -51,7 +51,7 @@ pub(in crate::borrow_check) fn report_use_of_moved_or_uninitialized(
|
||||
&mut self,
|
||||
location: Location,
|
||||
desired_action: InitializationRequiringAction,
|
||||
(moved_place, used_place, span): (PlaceRef<'cx, 'tcx>, PlaceRef<'cx, 'tcx>, Span),
|
||||
(moved_place, used_place, span): (PlaceRef<'tcx>, PlaceRef<'tcx>, Span),
|
||||
mpi: MovePathIndex,
|
||||
) {
|
||||
debug!(
|
||||
@ -647,7 +647,7 @@ pub(in crate::borrow_check) fn describe_place_for_conflicting_borrow(
|
||||
// borrowed place and look for a access to a different field of the same union.
|
||||
let Place { local, projection } = second_borrowed_place;
|
||||
|
||||
let mut cursor = projection.as_ref();
|
||||
let mut cursor = &projection[..];
|
||||
while let [proj_base @ .., elem] = cursor {
|
||||
cursor = proj_base;
|
||||
|
||||
@ -1521,7 +1521,7 @@ pub(in crate::borrow_check) fn report_illegal_reassignment(
|
||||
err.buffer(&mut self.errors_buffer);
|
||||
}
|
||||
|
||||
fn classify_drop_access_kind(&self, place: PlaceRef<'cx, 'tcx>) -> StorageDeadOrDrop<'tcx> {
|
||||
fn classify_drop_access_kind(&self, place: PlaceRef<'tcx>) -> StorageDeadOrDrop<'tcx> {
|
||||
let tcx = self.infcx.tcx;
|
||||
match place.projection {
|
||||
[] => StorageDeadOrDrop::LocalStorageDead,
|
||||
|
@ -51,7 +51,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||
pub(super) fn add_moved_or_invoked_closure_note(
|
||||
&self,
|
||||
location: Location,
|
||||
place: PlaceRef<'cx, 'tcx>,
|
||||
place: PlaceRef<'tcx>,
|
||||
diag: &mut DiagnosticBuilder<'_>,
|
||||
) {
|
||||
debug!("add_moved_or_invoked_closure_note: location={:?} place={:?}", location, place);
|
||||
@ -139,7 +139,7 @@ pub(super) fn add_moved_or_invoked_closure_note(
|
||||
|
||||
/// End-user visible description of `place` if one can be found. If the
|
||||
/// place is a temporary for instance, None will be returned.
|
||||
pub(super) fn describe_place(&self, place_ref: PlaceRef<'cx, 'tcx>) -> Option<String> {
|
||||
pub(super) fn describe_place(&self, place_ref: PlaceRef<'tcx>) -> Option<String> {
|
||||
self.describe_place_with_options(place_ref, IncludingDowncast(false))
|
||||
}
|
||||
|
||||
@ -149,7 +149,7 @@ pub(super) fn describe_place(&self, place_ref: PlaceRef<'cx, 'tcx>) -> Option<St
|
||||
/// `Downcast` and `IncludingDowncast` is true
|
||||
pub(super) fn describe_place_with_options(
|
||||
&self,
|
||||
place: PlaceRef<'cx, 'tcx>,
|
||||
place: PlaceRef<'tcx>,
|
||||
including_downcast: IncludingDowncast,
|
||||
) -> Option<String> {
|
||||
let mut buf = String::new();
|
||||
@ -162,7 +162,7 @@ pub(super) fn describe_place_with_options(
|
||||
/// Appends end-user visible description of `place` to `buf`.
|
||||
fn append_place_to_string(
|
||||
&self,
|
||||
place: PlaceRef<'cx, 'tcx>,
|
||||
place: PlaceRef<'tcx>,
|
||||
buf: &mut String,
|
||||
mut autoderef: bool,
|
||||
including_downcast: &IncludingDowncast,
|
||||
@ -303,7 +303,7 @@ fn append_local_to_string(&self, local: Local, buf: &mut String) -> Result<(), (
|
||||
}
|
||||
|
||||
/// End-user visible description of the `field`nth field of `base`
|
||||
fn describe_field(&self, place: PlaceRef<'cx, 'tcx>, field: Field) -> String {
|
||||
fn describe_field(&self, place: PlaceRef<'tcx>, field: Field) -> String {
|
||||
// FIXME Place2 Make this work iteratively
|
||||
match place {
|
||||
PlaceRef { local, projection: [] } => {
|
||||
@ -399,7 +399,7 @@ pub(super) fn note_type_does_not_implement_copy(
|
||||
|
||||
pub(super) fn borrowed_content_source(
|
||||
&self,
|
||||
deref_base: PlaceRef<'cx, 'tcx>,
|
||||
deref_base: PlaceRef<'tcx>,
|
||||
) -> BorrowedContentSource<'tcx> {
|
||||
let tcx = self.infcx.tcx;
|
||||
|
||||
@ -694,7 +694,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||
/// Finds the spans associated to a move or copy of move_place at location.
|
||||
pub(super) fn move_spans(
|
||||
&self,
|
||||
moved_place: PlaceRef<'cx, 'tcx>, // Could also be an upvar.
|
||||
moved_place: PlaceRef<'tcx>, // Could also be an upvar.
|
||||
location: Location,
|
||||
) -> UseSpans {
|
||||
use self::UseSpans::*;
|
||||
@ -782,7 +782,7 @@ pub(super) fn borrow_spans(&self, use_span: Span, location: Location) -> UseSpan
|
||||
fn closure_span(
|
||||
&self,
|
||||
def_id: DefId,
|
||||
target_place: PlaceRef<'cx, 'tcx>,
|
||||
target_place: PlaceRef<'tcx>,
|
||||
places: &Vec<Operand<'tcx>>,
|
||||
) -> Option<(Span, Option<GeneratorKind>, Span)> {
|
||||
debug!(
|
||||
|
@ -23,7 +23,7 @@ pub(crate) fn report_mutability_error(
|
||||
&mut self,
|
||||
access_place: &Place<'tcx>,
|
||||
span: Span,
|
||||
the_place_err: PlaceRef<'cx, 'tcx>,
|
||||
the_place_err: PlaceRef<'tcx>,
|
||||
error_access: AccessKind,
|
||||
location: Location,
|
||||
) {
|
||||
|
@ -86,6 +86,8 @@
|
||||
mutability: Mutability,
|
||||
}
|
||||
|
||||
const DEREF_PROJECTION: &[PlaceElem<'_>; 1] = &[ProjectionElem::Deref];
|
||||
|
||||
pub fn provide(providers: &mut Providers<'_>) {
|
||||
*providers = Providers { mir_borrowck, ..*providers };
|
||||
}
|
||||
@ -466,10 +468,10 @@ fn do_mir_borrowck<'a, 'tcx>(
|
||||
/// `BTreeMap` is used to preserve the order of insertions when iterating. This is necessary
|
||||
/// when errors in the map are being re-added to the error buffer so that errors with the
|
||||
/// same primary span come out in a consistent order.
|
||||
move_error_reported: BTreeMap<Vec<MoveOutIndex>, (PlaceRef<'cx, 'tcx>, DiagnosticBuilder<'cx>)>,
|
||||
move_error_reported: BTreeMap<Vec<MoveOutIndex>, (PlaceRef<'tcx>, DiagnosticBuilder<'cx>)>,
|
||||
/// This field keeps track of errors reported in the checking of uninitialized variables,
|
||||
/// so that we don't report seemingly duplicate errors.
|
||||
uninitialized_error_reported: FxHashSet<PlaceRef<'cx, 'tcx>>,
|
||||
uninitialized_error_reported: FxHashSet<PlaceRef<'tcx>>,
|
||||
/// Errors to be reported buffer
|
||||
errors_buffer: Vec<Diagnostic>,
|
||||
/// This field keeps track of all the local variables that are declared mut and are mutated.
|
||||
@ -841,9 +843,9 @@ enum InitializationRequiringAction {
|
||||
PartialAssignment,
|
||||
}
|
||||
|
||||
struct RootPlace<'d, 'tcx> {
|
||||
struct RootPlace<'tcx> {
|
||||
place_local: Local,
|
||||
place_projection: &'d [PlaceElem<'tcx>],
|
||||
place_projection: &'tcx [PlaceElem<'tcx>],
|
||||
is_local_mutation_allowed: LocalMutationIsAllowed,
|
||||
}
|
||||
|
||||
@ -1413,7 +1415,6 @@ fn check_for_invalidation_at_exit(
|
||||
) {
|
||||
debug!("check_for_invalidation_at_exit({:?})", borrow);
|
||||
let place = &borrow.borrowed_place;
|
||||
let deref = [ProjectionElem::Deref];
|
||||
let mut root_place = PlaceRef { local: place.local, projection: &[] };
|
||||
|
||||
// FIXME(nll-rfc#40): do more precise destructor tracking here. For now
|
||||
@ -1427,7 +1428,7 @@ fn check_for_invalidation_at_exit(
|
||||
// Thread-locals might be dropped after the function exits
|
||||
// We have to dereference the outer reference because
|
||||
// borrows don't conflict behind shared references.
|
||||
root_place.projection = &deref;
|
||||
root_place.projection = DEREF_PROJECTION;
|
||||
(true, true)
|
||||
} else {
|
||||
(false, self.locals_are_invalidated_at_exit)
|
||||
@ -1526,7 +1527,7 @@ fn check_if_full_path_is_moved(
|
||||
&mut self,
|
||||
location: Location,
|
||||
desired_action: InitializationRequiringAction,
|
||||
place_span: (PlaceRef<'cx, 'tcx>, Span),
|
||||
place_span: (PlaceRef<'tcx>, Span),
|
||||
flow_state: &Flows<'cx, 'tcx>,
|
||||
) {
|
||||
let maybe_uninits = &flow_state.uninits;
|
||||
@ -1592,7 +1593,7 @@ fn check_if_subslice_element_is_moved(
|
||||
&mut self,
|
||||
location: Location,
|
||||
desired_action: InitializationRequiringAction,
|
||||
place_span: (PlaceRef<'cx, 'tcx>, Span),
|
||||
place_span: (PlaceRef<'tcx>, Span),
|
||||
maybe_uninits: &BitSet<MovePathIndex>,
|
||||
from: u32,
|
||||
to: u32,
|
||||
@ -1631,7 +1632,7 @@ fn check_if_path_or_subpath_is_moved(
|
||||
&mut self,
|
||||
location: Location,
|
||||
desired_action: InitializationRequiringAction,
|
||||
place_span: (PlaceRef<'cx, 'tcx>, Span),
|
||||
place_span: (PlaceRef<'tcx>, Span),
|
||||
flow_state: &Flows<'cx, 'tcx>,
|
||||
) {
|
||||
let maybe_uninits = &flow_state.uninits;
|
||||
@ -1709,10 +1710,7 @@ fn check_if_path_or_subpath_is_moved(
|
||||
/// An Err result includes a tag indicated why the search failed.
|
||||
/// Currently this can only occur if the place is built off of a
|
||||
/// static variable, as we do not track those in the MoveData.
|
||||
fn move_path_closest_to(
|
||||
&mut self,
|
||||
place: PlaceRef<'_, 'tcx>,
|
||||
) -> (PlaceRef<'cx, 'tcx>, MovePathIndex) {
|
||||
fn move_path_closest_to(&mut self, place: PlaceRef<'tcx>) -> (PlaceRef<'tcx>, MovePathIndex) {
|
||||
match self.move_data.rev_lookup.find(place) {
|
||||
LookupResult::Parent(Some(mpi)) | LookupResult::Exact(mpi) => {
|
||||
(self.move_data.move_paths[mpi].place.as_ref(), mpi)
|
||||
@ -1721,7 +1719,7 @@ fn move_path_closest_to(
|
||||
}
|
||||
}
|
||||
|
||||
fn move_path_for_place(&mut self, place: PlaceRef<'_, 'tcx>) -> Option<MovePathIndex> {
|
||||
fn move_path_for_place(&mut self, place: PlaceRef<'tcx>) -> Option<MovePathIndex> {
|
||||
// If returns None, then there is no move path corresponding
|
||||
// to a direct owner of `place` (which means there is nothing
|
||||
// that borrowck tracks for its analysis).
|
||||
@ -1816,7 +1814,7 @@ fn check_if_assigned_path_is_moved(
|
||||
fn check_parent_of_field<'cx, 'tcx>(
|
||||
this: &mut MirBorrowckCtxt<'cx, 'tcx>,
|
||||
location: Location,
|
||||
base: PlaceRef<'cx, 'tcx>,
|
||||
base: PlaceRef<'tcx>,
|
||||
span: Span,
|
||||
flow_state: &Flows<'cx, 'tcx>,
|
||||
) {
|
||||
@ -2029,7 +2027,7 @@ fn is_local_ever_initialized(
|
||||
}
|
||||
|
||||
/// Adds the place into the used mutable variables set
|
||||
fn add_used_mut<'d>(&mut self, root_place: RootPlace<'d, 'tcx>, flow_state: &Flows<'cx, 'tcx>) {
|
||||
fn add_used_mut(&mut self, root_place: RootPlace<'tcx>, flow_state: &Flows<'cx, 'tcx>) {
|
||||
match root_place {
|
||||
RootPlace { place_local: local, place_projection: [], is_local_mutation_allowed } => {
|
||||
// If the local may have been initialized, and it is now currently being
|
||||
@ -2063,11 +2061,11 @@ fn add_used_mut<'d>(&mut self, root_place: RootPlace<'d, 'tcx>, flow_state: &Flo
|
||||
|
||||
/// Whether this value can be written or borrowed mutably.
|
||||
/// Returns the root place if the place passed in is a projection.
|
||||
fn is_mutable<'d>(
|
||||
fn is_mutable(
|
||||
&self,
|
||||
place: PlaceRef<'d, 'tcx>,
|
||||
place: PlaceRef<'tcx>,
|
||||
is_local_mutation_allowed: LocalMutationIsAllowed,
|
||||
) -> Result<RootPlace<'d, 'tcx>, PlaceRef<'d, 'tcx>> {
|
||||
) -> Result<RootPlace<'tcx>, PlaceRef<'tcx>> {
|
||||
match place {
|
||||
PlaceRef { local, projection: [] } => {
|
||||
let local = &self.body.local_decls[local];
|
||||
@ -2218,7 +2216,7 @@ fn is_mutable<'d>(
|
||||
/// then returns the index of the field being projected. Note that this closure will always
|
||||
/// be `self` in the current MIR, because that is the only time we directly access the fields
|
||||
/// of a closure type.
|
||||
pub fn is_upvar_field_projection(&self, place_ref: PlaceRef<'cx, 'tcx>) -> Option<Field> {
|
||||
pub fn is_upvar_field_projection(&self, place_ref: PlaceRef<'tcx>) -> Option<Field> {
|
||||
let mut place_projection = place_ref.projection;
|
||||
let mut by_ref = false;
|
||||
|
||||
|
@ -48,7 +48,7 @@ pub(super) fn borrow_conflicts_with_place<'tcx>(
|
||||
body: &Body<'tcx>,
|
||||
borrow_place: &Place<'tcx>,
|
||||
borrow_kind: BorrowKind,
|
||||
access_place: PlaceRef<'_, 'tcx>,
|
||||
access_place: PlaceRef<'tcx>,
|
||||
access: AccessDepth,
|
||||
bias: PlaceConflictBias,
|
||||
) -> bool {
|
||||
@ -73,7 +73,7 @@ fn place_components_conflict<'tcx>(
|
||||
body: &Body<'tcx>,
|
||||
borrow_place: &Place<'tcx>,
|
||||
borrow_kind: BorrowKind,
|
||||
access_place: PlaceRef<'_, 'tcx>,
|
||||
access_place: PlaceRef<'tcx>,
|
||||
access: AccessDepth,
|
||||
bias: PlaceConflictBias,
|
||||
) -> bool {
|
||||
|
@ -13,12 +13,12 @@
|
||||
use rustc::ty::{self, TyCtxt};
|
||||
use rustc_hir as hir;
|
||||
|
||||
pub trait IsPrefixOf<'cx, 'tcx> {
|
||||
fn is_prefix_of(&self, other: PlaceRef<'cx, 'tcx>) -> bool;
|
||||
pub trait IsPrefixOf<'tcx> {
|
||||
fn is_prefix_of(&self, other: PlaceRef<'tcx>) -> bool;
|
||||
}
|
||||
|
||||
impl<'cx, 'tcx> IsPrefixOf<'cx, 'tcx> for PlaceRef<'cx, 'tcx> {
|
||||
fn is_prefix_of(&self, other: PlaceRef<'cx, 'tcx>) -> bool {
|
||||
impl<'tcx> IsPrefixOf<'tcx> for PlaceRef<'tcx> {
|
||||
fn is_prefix_of(&self, other: PlaceRef<'tcx>) -> bool {
|
||||
self.local == other.local
|
||||
&& self.projection.len() <= other.projection.len()
|
||||
&& self.projection == &other.projection[..self.projection.len()]
|
||||
@ -29,7 +29,7 @@ pub(super) struct Prefixes<'cx, 'tcx> {
|
||||
body: ReadOnlyBodyAndCache<'cx, 'tcx>,
|
||||
tcx: TyCtxt<'tcx>,
|
||||
kind: PrefixSet,
|
||||
next: Option<PlaceRef<'cx, 'tcx>>,
|
||||
next: Option<PlaceRef<'tcx>>,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
||||
@ -50,7 +50,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||
/// terminating the iteration early based on `kind`.
|
||||
pub(super) fn prefixes(
|
||||
&self,
|
||||
place_ref: PlaceRef<'cx, 'tcx>,
|
||||
place_ref: PlaceRef<'tcx>,
|
||||
kind: PrefixSet,
|
||||
) -> Prefixes<'cx, 'tcx> {
|
||||
Prefixes { next: Some(place_ref), kind, body: self.body, tcx: self.infcx.tcx }
|
||||
@ -58,7 +58,7 @@ pub(super) fn prefixes(
|
||||
}
|
||||
|
||||
impl<'cx, 'tcx> Iterator for Prefixes<'cx, 'tcx> {
|
||||
type Item = PlaceRef<'cx, 'tcx>;
|
||||
type Item = PlaceRef<'tcx>;
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
let mut cursor = self.next?;
|
||||
|
||||
|
@ -483,7 +483,7 @@ fn record_move(&mut self, place: &Place<'tcx>, path: MovePathIndex) {
|
||||
self.builder.data.loc_map[self.loc].push(move_out);
|
||||
}
|
||||
|
||||
fn gather_init(&mut self, place: PlaceRef<'cx, 'tcx>, kind: InitKind) {
|
||||
fn gather_init(&mut self, place: PlaceRef<'tcx>, kind: InitKind) {
|
||||
debug!("gather_init({:?}, {:?})", self.loc, place);
|
||||
|
||||
let mut place = place;
|
||||
|
@ -312,7 +312,7 @@ impl MovePathLookup {
|
||||
// alternative will *not* create a MovePath on the fly for an
|
||||
// unknown place, but will rather return the nearest available
|
||||
// parent.
|
||||
pub fn find(&self, place: PlaceRef<'_, '_>) -> LookupResult {
|
||||
pub fn find(&self, place: PlaceRef<'_>) -> LookupResult {
|
||||
let mut result = self.locals[place.local];
|
||||
|
||||
for elem in place.projection.iter() {
|
||||
|
@ -14,7 +14,7 @@
|
||||
/// after the assignment, we can be sure to obtain the same place value.
|
||||
/// (Concurrent accesses by other threads are no problem as these are anyway non-atomic
|
||||
/// copies. Data races are UB.)
|
||||
fn is_stable(place: PlaceRef<'_, '_>) -> bool {
|
||||
fn is_stable(place: PlaceRef<'_>) -> bool {
|
||||
place.projection.iter().all(|elem| {
|
||||
match elem {
|
||||
// Which place this evaluates to can change with any memory write,
|
||||
|
@ -35,7 +35,7 @@ pub trait Qualif {
|
||||
fn in_projection_structurally(
|
||||
cx: &ConstCx<'_, 'tcx>,
|
||||
per_local: &mut impl FnMut(Local) -> bool,
|
||||
place: PlaceRef<'_, 'tcx>,
|
||||
place: PlaceRef<'tcx>,
|
||||
) -> bool {
|
||||
if let [proj_base @ .., elem] = place.projection {
|
||||
let base_qualif = Self::in_place(
|
||||
@ -67,7 +67,7 @@ fn in_projection_structurally(
|
||||
fn in_projection(
|
||||
cx: &ConstCx<'_, 'tcx>,
|
||||
per_local: &mut impl FnMut(Local) -> bool,
|
||||
place: PlaceRef<'_, 'tcx>,
|
||||
place: PlaceRef<'tcx>,
|
||||
) -> bool {
|
||||
Self::in_projection_structurally(cx, per_local, place)
|
||||
}
|
||||
@ -75,7 +75,7 @@ fn in_projection(
|
||||
fn in_place(
|
||||
cx: &ConstCx<'_, 'tcx>,
|
||||
per_local: &mut impl FnMut(Local) -> bool,
|
||||
place: PlaceRef<'_, 'tcx>,
|
||||
place: PlaceRef<'tcx>,
|
||||
) -> bool {
|
||||
match place {
|
||||
PlaceRef { local, projection: [] } => per_local(local),
|
||||
|
@ -474,7 +474,7 @@ fn validate_local(&self, local: Local) -> Result<(), Unpromotable> {
|
||||
}
|
||||
}
|
||||
|
||||
fn validate_place(&self, place: PlaceRef<'_, 'tcx>) -> Result<(), Unpromotable> {
|
||||
fn validate_place(&self, place: PlaceRef<'tcx>) -> Result<(), Unpromotable> {
|
||||
match place {
|
||||
PlaceRef { local, projection: [] } => self.validate_local(local),
|
||||
PlaceRef { local: _, projection: [proj_base @ .., elem] } => {
|
||||
|
Loading…
Reference in New Issue
Block a user