Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--crates/hir-ty/src/consteval/tests.rs2
-rw-r--r--crates/hir-ty/src/mir/lower.rs18
2 files changed, 6 insertions, 14 deletions
diff --git a/crates/hir-ty/src/consteval/tests.rs b/crates/hir-ty/src/consteval/tests.rs
index 0e51594a78..546238f9bb 100644
--- a/crates/hir-ty/src/consteval/tests.rs
+++ b/crates/hir-ty/src/consteval/tests.rs
@@ -2563,8 +2563,6 @@ fn const_transfer_memory() {
}
#[test]
-// FIXME
-#[should_panic]
fn anonymous_const_block() {
check_number(
r#"
diff --git a/crates/hir-ty/src/mir/lower.rs b/crates/hir-ty/src/mir/lower.rs
index ab7e6df3f5..a9bb7723d8 100644
--- a/crates/hir-ty/src/mir/lower.rs
+++ b/crates/hir-ty/src/mir/lower.rs
@@ -961,18 +961,12 @@ impl<'a, 'db> MirLowerCtx<'a, 'db> {
}
Expr::Await { .. } => not_supported!("await"),
Expr::Yeet { .. } => not_supported!("yeet"),
- &Expr::Const(_) => {
- // let subst = self.placeholder_subst();
- // self.lower_const(
- // id.into(),
- // current,
- // place,
- // subst,
- // expr_id.into(),
- // self.expr_ty_without_adjust(expr_id),
- // )?;
- // Ok(Some(current))
- not_supported!("const block")
+ &Expr::Const(id) => {
+ // Inline const blocks (`const { .. }`) are stored with their inner expression in
+ // the same body (see inference, which infers the inner expression directly), so we
+ // lower that expression in place. Const-ness is irrelevant here: MIR evaluation
+ // already runs in a const context.
+ self.lower_expr_to_place(id, place, current)
}
Expr::Cast { expr, type_ref: _ } => {
let Some((it, current)) = self.lower_expr_to_some_operand(*expr, current)? else {