mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-03 21:25:25 +00:00
Variants::Single: do not use invalid VariantIdx for uninhabited enums
This commit is contained in:
parent
9321f7efa9
commit
d7d08ae95c
3 changed files with 7 additions and 6 deletions
|
|
@ -335,7 +335,7 @@ pub(crate) fn detect_variant_from_bytes<'a>(
|
|||
) -> Option<(EnumVariantId, &'a Layout)> {
|
||||
let (var_id, var_layout) = match &layout.variants {
|
||||
hir_def::layout::Variants::Single { index } => {
|
||||
(db.enum_data(e).variants[index.0].0, layout)
|
||||
(db.enum_data(e).variants[index.unwrap().0].0, layout)
|
||||
}
|
||||
hir_def::layout::Variants::Multiple { tag, tag_encoding, variants, .. } => {
|
||||
let size = tag.size(target_data_layout).bytes_usize();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue