diff options
| author | Ralf Jung <post@ralfj.de> | 2019-08-17 10:20:18 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2019-08-17 11:57:01 +0200 |
| commit | 9ab1d5c73a67e0936f71abe6eaccef8d0b4bd25e (patch) | |
| tree | 0b5b6f3359c894b0f69195ecbd176753fb2a5b86 /src | |
| parent | 0d242b3f9098fe13518da4442692f29915cf2da4 (diff) | |
| download | rust-9ab1d5c73a67e0936f71abe6eaccef8d0b4bd25e.tar.gz rust-9ab1d5c73a67e0936f71abe6eaccef8d0b4bd25e.zip | |
multi-variant enums are tricky
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_lint/builtin.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index f4f6bd37774..74cff1bab0f 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -1971,6 +1971,9 @@ 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. } } @@ -1978,7 +1981,6 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidValue { // 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, } |
