Skip to content

Commit

Permalink
More comments for lower_inline_const
Browse files Browse the repository at this point in the history
  • Loading branch information
Zalathar committed Feb 14, 2025
1 parent c3eea53 commit 92fc085
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion compiler/rustc_mir_build/src/thir/pattern/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
pattern
}

/// Converts inline const patterns.
/// Lowers an inline const block (e.g. `const { 1 + 1 }`) to a pattern.
fn lower_inline_const(
&mut self,
block: &'tcx hir::ConstBlock,
Expand All @@ -708,6 +708,9 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {

let ct = ty::UnevaluatedConst { def: def_id.to_def_id(), args };
let subpattern = self.const_to_pat(ty::Const::new_unevaluated(self.tcx, ct), ty, id, span);

// Wrap the pattern in a marker node to indicate that it is the result
// of lowering an inline const block.
PatKind::ExpandedConstant { subpattern, def_id: def_id.to_def_id(), is_inline: true }
}

Expand Down

0 comments on commit 92fc085

Please sign in to comment.