Skip to content

Commit 401ced3

Browse files
committed
ignore packed types not just unions
1 parent f88212c commit 401ced3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/librustc_mir/analysis/local_paths/collect.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ impl<'tcx> PathTree<'tcx> {
5858
match *elem {
5959
ProjectionElem::Field(f, ty) => {
6060
if let Some(adt) = self.ty.ty_adt_def() {
61-
if adt.is_union() {
61+
// Unions and packed types have additional (safety-related)
62+
// restrictions and it's easier to just not look into them.
63+
if adt.is_union() || adt.repr.packed() {
6264
return None;
6365
}
6466
}

0 commit comments

Comments
 (0)