diff options
| author | bors <bors@rust-lang.org> | 2024-12-19 11:25:43 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-12-19 11:25:43 +0000 |
| commit | 3bf62ccc1055a94dfa6a72650b10a71dcf232429 (patch) | |
| tree | 8f590d8d4e8b1fc9e7933b646bb9ad86ac46b4f2 /src/tools | |
| parent | a4079b29bb097be91b5c57d1ef7820628798e0d7 (diff) | |
| parent | e2bc71866ecc24f3221a11417102b2dec9648125 (diff) | |
Auto merge of #134499 - jieyouxu:rollup-zmaveur, r=jieyouxu
Rollup of 7 pull requests Successful merges: - #133702 (Variants::Single: do not use invalid VariantIdx for uninhabited enums) - #134427 (ci: remove duplicate task definition) - #134432 (Fix intra doc links not generated inside footnote definitions) - #134437 (reduce compiler `Assemble` complexity) - #134474 (Forbid overwriting types in typeck) - #134477 (move lint_unused_mut into sub-fn) - #134491 (Some destructor/drop related tweaks) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/miri/src/helpers.rs | 2 | ||||
| -rw-r--r-- | src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs | 5 | ||||
| -rw-r--r-- | src/tools/rust-analyzer/crates/hir-ty/src/utils.rs | 1 |
3 files changed, 5 insertions, 3 deletions
diff --git a/src/tools/miri/src/helpers.rs b/src/tools/miri/src/helpers.rs index 1f7c60ad1bd..ef4543dcee8 100644 --- a/src/tools/miri/src/helpers.rs +++ b/src/tools/miri/src/helpers.rs @@ -605,7 +605,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // `UnsafeCell` action. (self.unsafe_cell_action)(v) } - Variants::Single { .. } => { + Variants::Single { .. } | Variants::Empty => { // Proceed further, try to find where exactly that `UnsafeCell` // is hiding. self.walk_value(v) diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs b/src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs index d7029651fc1..e3072d6ee79 100644 --- a/src/tools/rust-analyzer/crates/hir-ty/src/mir/eval.rs +++ b/src/tools/rust-analyzer/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/src/tools/rust-analyzer/crates/hir-ty/src/utils.rs b/src/tools/rust-analyzer/crates/hir-ty/src/utils.rs index 06719b09f73..42e7edaf0f4 100644 --- a/src/tools/rust-analyzer/crates/hir-ty/src/utils.rs +++ b/src/tools/rust-analyzer/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) } |
