mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 23:34:48 +00:00
multi-variant enums are tricky
This commit is contained in:
parent
0d242b3f90
commit
9ab1d5c73a
@ -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,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user