Skip to content

Commit

Permalink
ignore packed types not just unions
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyb committed Feb 2, 2018
1 parent f88212c commit 401ced3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/librustc_mir/analysis/local_paths/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ impl<'tcx> PathTree<'tcx> {
match *elem {
ProjectionElem::Field(f, ty) => {
if let Some(adt) = self.ty.ty_adt_def() {
if adt.is_union() {
// Unions and packed types have additional (safety-related)
// restrictions and it's easier to just not look into them.
if adt.is_union() || adt.repr.packed() {
return None;
}
}
Expand Down

0 comments on commit 401ced3

Please sign in to comment.