Skip to content

Commit

Permalink
multi-variant enums are tricky
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Aug 17, 2019
1 parent 0d242b3 commit 9ab1d5c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/librustc_lint/builtin.rs
Expand Up @@ -1971,14 +1971,16 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidValue {
})
})
}
// Multi-variant enums are tricky: if all but one variant are
// uninhabited, we might actually do layout like for a single-variant
// enum, and then even leaving them uninitialized could be okay.
_ => None, // Conservative fallback for multi-variant enum.
}
}
Tuple(..) => {
// Proceed recursively, check all fields.
ty.tuple_fields().find_map(|field| ty_find_init_error(tcx, field, init))
}
// FIXME: *Only for `mem::uninitialized`*, we could also warn for multivariant enum.
// Conservative fallback.
_ => None,
}
Expand Down

0 comments on commit 9ab1d5c

Please sign in to comment.