diff --git a/crates/hir-expand/src/inert_attr_macro.rs b/crates/hir-expand/src/inert_attr_macro.rs index 9a7a1a01a0..2bba410de0 100644 --- a/crates/hir-expand/src/inert_attr_macro.rs +++ b/crates/hir-expand/src/inert_attr_macro.rs @@ -237,7 +237,7 @@ pub const INERT_ATTRIBUTES: &[BuiltinAttribute] = &[ template!(List: "address, kcfi, memory, thread"), DuplicatesOk, experimental!(no_sanitize) ), - gated!(coverage, Normal, template!(Word, List: "on|off"), WarnFollowing, coverage_attribute, experimental!(coverage)), + ungated!(coverage, Normal, template!(Word, List: "on|off"), WarnFollowing), ungated!( doc, Normal, template!(List: "hidden|inline|...", NameValueStr: "string"), DuplicatesOk diff --git a/crates/hir-ty/src/mir/eval.rs b/crates/hir-ty/src/mir/eval.rs index d7029651fc..e3072d6ee7 100644 --- a/crates/hir-ty/src/mir/eval.rs +++ b/crates/hir-ty/src/mir/eval.rs @@ -813,7 +813,7 @@ impl Evaluator<'_> { ProjectionElem::Field(Either::Left(f)) => { let layout = self.layout(&prev_ty)?; let variant_layout = match &layout.variants { - Variants::Single { .. } => &layout, + Variants::Single { .. } | Variants::Empty => &layout, Variants::Multiple { variants, .. } => { &variants[match f.parent { hir_def::VariantId::EnumVariantId(it) => { @@ -1638,6 +1638,7 @@ impl Evaluator<'_> { return Ok(0); }; match &layout.variants { + Variants::Empty => unreachable!(), Variants::Single { index } => { let r = self.const_eval_discriminant(self.db.enum_data(e).variants[index.0].0)?; Ok(r) @@ -1800,7 +1801,7 @@ impl Evaluator<'_> { } let layout = self.layout_adt(adt, subst)?; Ok(match &layout.variants { - Variants::Single { .. } => (layout.size.bytes_usize(), layout, None), + Variants::Single { .. } | Variants::Empty => (layout.size.bytes_usize(), layout, None), Variants::Multiple { variants, tag, tag_encoding, .. } => { let enum_variant_id = match it { VariantId::EnumVariantId(it) => it, diff --git a/crates/hir-ty/src/utils.rs b/crates/hir-ty/src/utils.rs index 06719b09f7..42e7edaf0f 100644 --- a/crates/hir-ty/src/utils.rs +++ b/crates/hir-ty/src/utils.rs @@ -334,6 +334,7 @@ pub(crate) fn detect_variant_from_bytes<'a>( e: EnumId, ) -> Option<(EnumVariantId, &'a Layout)> { let (var_id, var_layout) = match &layout.variants { + hir_def::layout::Variants::Empty => unreachable!(), hir_def::layout::Variants::Single { index } => { (db.enum_data(e).variants[index.0].0, layout) }