about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorZalathar <Zalathar@users.noreply.github.com>2025-02-05 21:51:05 +1100
committerZalathar <Zalathar@users.noreply.github.com>2025-02-14 23:35:54 +1100
commit92fc085080d446ef6fd41f7c916179454bd1c43a (patch)
tree168f6702f85edc7a4003c3d9cf89b31d9c1ec4ab /compiler
parentc3eea531fdf00051b9aeb9a01e4f740d7e111e59 (diff)
downloadrust-92fc085080d446ef6fd41f7c916179454bd1c43a.tar.gz
rust-92fc085080d446ef6fd41f7c916179454bd1c43a.zip
More comments for `lower_inline_const`
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_mir_build/src/thir/pattern/mod.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_mir_build/src/thir/pattern/mod.rs b/compiler/rustc_mir_build/src/thir/pattern/mod.rs
index e0a427d9e44..22b8bfef09d 100644
--- a/compiler/rustc_mir_build/src/thir/pattern/mod.rs
+++ b/compiler/rustc_mir_build/src/thir/pattern/mod.rs
@@ -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,
@@ -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 }
     }