Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/consteval.rs')
-rw-r--r--crates/hir-ty/src/consteval.rs10
1 files changed, 1 insertions, 9 deletions
diff --git a/crates/hir-ty/src/consteval.rs b/crates/hir-ty/src/consteval.rs
index 2e1525ebe1..dae612e6d2 100644
--- a/crates/hir-ty/src/consteval.rs
+++ b/crates/hir-ty/src/consteval.rs
@@ -257,15 +257,7 @@ pub(crate) fn const_eval_discriminant_variant(
let body = db.body(def);
if body.exprs[body.body_expr] == Expr::Missing {
let loc = variant_id.lookup(db.upcast());
- let parent_id = loc.parent.lookup(db.upcast()).id;
- let index = loc.id.value.index().into_raw().into_u32()
- - parent_id.item_tree(db.upcast())[parent_id.value]
- .variants
- .start
- .index()
- .into_raw()
- .into_u32();
- let prev_idx = index.checked_sub(1);
+ let prev_idx = loc.index.checked_sub(1);
let value = match prev_idx {
Some(prev_idx) => {
1 + db.const_eval_discriminant(