Skip to content

Commit aa39d9c

Browse files
committed
feat: apply suggestions from code review
1 parent b155f46 commit aa39d9c

File tree

1 file changed

+4
-2
lines changed
  • libs/@local/hashql/mir/src/builder

1 file changed

+4
-2
lines changed

libs/@local/hashql/mir/src/builder/body.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,16 @@ impl<'env, 'heap> BodyBuilder<'env, 'heap> {
111111
///
112112
/// # Panics
113113
///
114-
/// Panics if any block still has a placeholder terminator (wasn't built).
114+
/// Panics if any block still has a placeholder terminator (wasn't built) or there are more
115+
/// arguments declared than local declarations.
115116
#[must_use]
116117
pub fn finish(self, args: usize, return_ty: TypeId) -> Body<'heap> {
117118
// Validate all blocks have been built
118119
assert!(
119120
self.finished.iter().all(|&finished| finished),
120121
"unfinished blocks"
121122
);
123+
assert!(args <= self.local_decls.len());
122124

123125
Body {
124126
id: DefId::MAX,
@@ -218,7 +220,7 @@ impl<'env, 'heap> Deref for BodyBuilder<'env, 'heap> {
218220
/// - Literals: `42` (i64), `3.14` (f64), `true`/`false` (bool)
219221
/// - Unit: `()`
220222
/// - Null: `null`
221-
/// - Function pointers: `fn() @ def_id`
223+
/// - Function pointers: simply reference the variable that defines it, for example `def_id`
222224
///
223225
/// # Example
224226
///

0 commit comments

Comments
 (0)