Make PlaceRef lifetimes of RootPlace be both 'tcx

This commit is contained in:
Santiago Pastorino 2020-03-03 17:22:54 -03:00
parent 2af5e87b4b
commit a20d54f00c
No known key found for this signature in database
GPG key ID: 8131A24E0C79EFAF

View file

@ -841,9 +841,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,
}
@ -2029,7 +2029,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
}
/// 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 +2063,11 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
/// 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, 'tcx>,
is_local_mutation_allowed: LocalMutationIsAllowed,
) -> Result<RootPlace<'d, 'tcx>, PlaceRef<'d, 'tcx>> {
) -> Result<RootPlace<'tcx>, PlaceRef<'tcx, 'tcx>> {
match place {
PlaceRef { local, projection: [] } => {
let local = &self.body.local_decls[local];