1
Fork 0

Add test for repr(transparent) with scalar

This commit is contained in:
Jannis Christopher Köhl 2022-11-11 11:24:31 +01:00
parent 8ecb276735
commit 3c6d1a723d
3 changed files with 61 additions and 2 deletions

View file

@ -614,7 +614,7 @@ impl Map {
}
}
/// Register fields of the given (local, projection) place.
/// Potentially register the (local, projection) place and its fields, recursively.
///
/// Invariant: The projection must only contain fields.
fn register_with_filter_rec<'tcx>(
@ -626,13 +626,16 @@ impl Map {
filter: &mut impl FnMut(Ty<'tcx>) -> bool,
exclude: &FxHashSet<Place<'tcx>>,
) {
if exclude.contains(&Place { local, projection: tcx.intern_place_elems(projection) }) {
let place = Place { local, projection: tcx.intern_place_elems(projection) };
if exclude.contains(&place) {
// This will also exclude all projections of the excluded place.
return;
}
// Note: The framework supports only scalars for now.
if filter(ty) && ty.is_scalar() {
trace!("registering place: {:?}", place);
// We know that the projection only contains trackable elements.
let place = self.make_place(local, projection).unwrap();