MCPcopy Create free account
hub / github.com/hashintel/hash / lower_thunk

Method lower_thunk

libs/@local/hashql/mir/src/reify/mod.rs:330–344  ·  view source on GitHub ↗

Lowers a thunk (lazy computation) to a MIR body. Thunks have no parameters or captures, making them the simplest construct to lower.

(self, hir: HirPtr, binder: Binder<'heap>, thunk: Thunk<'heap>)

Source from the content-addressed store, hash-verified

328 /// Thunks have no parameters or captures, making them the simplest
329 /// construct to lower.
330 fn lower_thunk(self, hir: HirPtr, binder: Binder<'heap>, thunk: Thunk<'heap>) -> DefId {
331 let r#type = unwrap_closure_type(
332 self.context.hir.map.monomorphized_type_id(hir.id),
333 self.context.mir.env,
334 );
335
336 self.lower_impl(
337 Source::Thunk(hir.id, Some(binder)),
338 hir.span,
339 [] as [_; 0],
340 r#type.returns,
341 None,
342 |this, block| this.transform_body(block, thunk.body),
343 )
344 }
345
346 /// Lowers a type constructor to a MIR body.
347 ///

Callers 2

from_hirFunction · 0.80
rvalue_thunkMethod · 0.80

Calls 5

unwrap_closure_typeFunction · 0.85
ThunkClass · 0.85
monomorphized_type_idMethod · 0.80
lower_implMethod · 0.80
transform_bodyMethod · 0.80

Tested by

no test coverage detected