Skip to content

Commit cf23cbf

Browse files
committed
clippy: resolve projections during internal mutability analysis
1 parent db4a587 commit cf23cbf

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/tools/clippy/clippy_lints/src/non_copy_const.rs

+6
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,12 @@ impl<'tcx> NonCopyConst<'tcx> {
215215
.iter()
216216
.zip(tys)
217217
.any(|(field, ty)| Self::is_value_unfrozen_raw_inner(cx, *field, ty)),
218+
ty::Alias(ty::Projection, _) => match cx.tcx.try_normalize_erasing_regions(cx.typing_env(), ty) {
219+
Ok(normalized_ty) if ty != normalized_ty => {
220+
Self::is_value_unfrozen_raw_inner(cx, ty::ValTree::Branch(val), normalized_ty)
221+
},
222+
_ => false,
223+
},
218224
_ => false,
219225
}
220226
}

src/tools/clippy/clippy_utils/src/ty/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1227,6 +1227,10 @@ impl<'tcx> InteriorMut<'tcx> {
12271227
.find_map(|f| self.interior_mut_ty_chain(cx, f.ty(cx.tcx, args)))
12281228
}
12291229
},
1230+
ty::Alias(ty::Projection, _) => match cx.tcx.try_normalize_erasing_regions(cx.typing_env(), ty) {
1231+
Ok(normalized_ty) if ty != normalized_ty => self.interior_mut_ty_chain(cx, normalized_ty),
1232+
_ => None,
1233+
},
12301234
_ => None,
12311235
};
12321236

0 commit comments

Comments
 (0)