1 //! Code for type-checking closure expressions.
3 use super::{check_fn, Expectation, FnCtxt, GeneratorTypes};
5 use crate::astconv::AstConv;
7 use rustc_hir::def_id::DefId;
8 use rustc_hir::lang_items::{FutureTraitLangItem, GeneratorTraitLangItem};
9 use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
10 use rustc_infer::infer::LateBoundRegionConversionTime;
11 use rustc_infer::infer::{InferOk, InferResult};
12 use rustc_middle::ty::fold::TypeFoldable;
13 use rustc_middle::ty::subst::InternalSubsts;
14 use rustc_middle::ty::{self, Ty};
15 use rustc_span::source_map::Span;
16 use rustc_target::spec::abi::Abi;
17 use rustc_trait_selection::traits::error_reporting::ArgKind;
18 use rustc_trait_selection::traits::error_reporting::InferCtxtExt as _;
22 /// What signature do we *expect* the closure to have from context?
24 struct ExpectedSig<'tcx> {
25 /// Span that gave us this expectation, if we know that.
26 cause_span: Option<Span>,
30 struct ClosureSignatures<'tcx> {
31 bound_sig: ty::PolyFnSig<'tcx>,
32 liberated_sig: ty::FnSig<'tcx>,
35 impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
36 pub fn check_expr_closure(
39 _capture: hir::CaptureBy,
40 decl: &'tcx hir::FnDecl<'tcx>,
42 gen: Option<hir::Movability>,
43 expected: Expectation<'tcx>,
45 debug!("check_expr_closure(expr={:?},expected={:?})", expr, expected);
47 // It's always helpful for inference if we know the kind of
48 // closure sooner rather than later, so first examine the expected
49 // type, and see if can glean a closure kind from there.
50 let (expected_sig, expected_kind) = match expected.to_option(self) {
51 Some(ty) => self.deduce_expectations_from_expected_type(ty),
54 let body = self.tcx.hir().body(body_id);
55 self.check_closure(expr, expected_kind, decl, body, gen, expected_sig)
61 opt_kind: Option<ty::ClosureKind>,
62 decl: &'tcx hir::FnDecl<'tcx>,
63 body: &'tcx hir::Body<'tcx>,
64 gen: Option<hir::Movability>,
65 expected_sig: Option<ExpectedSig<'tcx>>,
67 debug!("check_closure(opt_kind={:?}, expected_sig={:?})", opt_kind, expected_sig);
69 let expr_def_id = self.tcx.hir().local_def_id(expr.hir_id);
71 let ClosureSignatures { bound_sig, liberated_sig } =
72 self.sig_of_closure(expr_def_id.to_def_id(), decl, body, expected_sig);
74 debug!("check_closure: ty_of_closure returns {:?}", liberated_sig);
77 check_fn(self, self.param_env, liberated_sig, decl, expr.hir_id, body, gen).1;
79 let parent_substs = InternalSubsts::identity_for_item(
81 self.tcx.closure_base_def_id(expr_def_id.to_def_id()),
84 let tupled_upvars_ty =
85 self.tcx.mk_tup(self.tcx.upvars_mentioned(expr_def_id).iter().flat_map(|upvars| {
86 upvars.iter().map(|(&var_hir_id, _)| {
87 // Create type variables (for now) to represent the transformed
88 // types of upvars. These will be unified during the upvar
89 // inference phase (`upvar.rs`).
90 self.infcx.next_ty_var(TypeVariableOrigin {
91 // FIXME(eddyb) distinguish upvar inference variables from the rest.
92 kind: TypeVariableOriginKind::ClosureSynthetic,
93 span: self.tcx.hir().span(var_hir_id),
98 if let Some(GeneratorTypes { resume_ty, yield_ty, interior, movability }) = generator_types
100 let generator_substs = ty::GeneratorSubsts::new(
102 ty::GeneratorSubstsParts {
106 return_ty: liberated_sig.output(),
112 return self.tcx.mk_generator(
113 expr_def_id.to_def_id(),
114 generator_substs.substs,
119 // Tuple up the arguments and insert the resulting function type into
120 // the `closures` table.
121 let sig = bound_sig.map_bound(|sig| {
123 iter::once(self.tcx.intern_tup(sig.inputs())),
132 "check_closure: expr_def_id={:?}, sig={:?}, opt_kind={:?}",
133 expr_def_id, sig, opt_kind
136 let closure_kind_ty = match opt_kind {
137 Some(kind) => kind.to_ty(self.tcx),
139 // Create a type variable (for now) to represent the closure kind.
140 // It will be unified during the upvar inference phase (`upvar.rs`)
141 None => self.infcx.next_ty_var(TypeVariableOrigin {
142 // FIXME(eddyb) distinguish closure kind inference variables from the rest.
143 kind: TypeVariableOriginKind::ClosureSynthetic,
148 let closure_substs = ty::ClosureSubsts::new(
150 ty::ClosureSubstsParts {
153 closure_sig_as_fn_ptr_ty: self.tcx.mk_fn_ptr(sig),
158 let closure_type = self.tcx.mk_closure(expr_def_id.to_def_id(), closure_substs.substs);
160 debug!("check_closure: expr.hir_id={:?} closure_type={:?}", expr.hir_id, closure_type);
165 /// Given the expected type, figures out what it can about this closure we
166 /// are about to type check:
167 fn deduce_expectations_from_expected_type(
169 expected_ty: Ty<'tcx>,
170 ) -> (Option<ExpectedSig<'tcx>>, Option<ty::ClosureKind>) {
171 debug!("deduce_expectations_from_expected_type(expected_ty={:?})", expected_ty);
173 match expected_ty.kind {
174 ty::Dynamic(ref object_type, ..) => {
175 let sig = object_type.projection_bounds().find_map(|pb| {
176 let pb = pb.with_self_ty(self.tcx, self.tcx.types.trait_object_dummy_self);
177 self.deduce_sig_from_projection(None, pb)
179 let kind = object_type
181 .and_then(|did| self.tcx.fn_trait_kind_from_lang_item(did));
184 ty::Infer(ty::TyVar(vid)) => self.deduce_expectations_from_obligations(vid),
186 let expected_sig = ExpectedSig { cause_span: None, sig: sig.skip_binder() };
187 (Some(expected_sig), Some(ty::ClosureKind::Fn))
193 fn deduce_expectations_from_obligations(
195 expected_vid: ty::TyVid,
196 ) -> (Option<ExpectedSig<'tcx>>, Option<ty::ClosureKind>) {
198 self.obligations_for_self_ty(expected_vid).find_map(|(_, obligation)| {
200 "deduce_expectations_from_obligations: obligation.predicate={:?}",
204 if let ty::PredicateAtom::Projection(proj_predicate) =
205 obligation.predicate.skip_binders()
207 // Given a Projection predicate, we can potentially infer
208 // the complete signature.
209 self.deduce_sig_from_projection(
210 Some(obligation.cause.span),
211 ty::Binder::bind(proj_predicate),
218 // Even if we can't infer the full signature, we may be able to
219 // infer the kind. This can occur if there is a trait-reference
220 // like `F : Fn<A>`. Note that due to subtyping we could encounter
221 // many viable options, so pick the most restrictive.
222 let expected_kind = self
223 .obligations_for_self_ty(expected_vid)
224 .filter_map(|(tr, _)| self.tcx.fn_trait_kind_from_lang_item(tr.def_id()))
225 .fold(None, |best, cur| Some(best.map_or(cur, |best| cmp::min(best, cur))));
227 (expected_sig, expected_kind)
230 /// Given a projection like "<F as Fn(X)>::Result == Y", we can deduce
231 /// everything we need to know about a closure or generator.
233 /// The `cause_span` should be the span that caused us to
234 /// have this expected signature, or `None` if we can't readily
236 fn deduce_sig_from_projection(
238 cause_span: Option<Span>,
239 projection: ty::PolyProjectionPredicate<'tcx>,
240 ) -> Option<ExpectedSig<'tcx>> {
243 debug!("deduce_sig_from_projection({:?})", projection);
245 let trait_ref = projection.to_poly_trait_ref(tcx);
247 let is_fn = tcx.fn_trait_kind_from_lang_item(trait_ref.def_id()).is_some();
248 let gen_trait = tcx.require_lang_item(GeneratorTraitLangItem, cause_span);
249 let is_gen = gen_trait == trait_ref.def_id();
250 if !is_fn && !is_gen {
251 debug!("deduce_sig_from_projection: not fn or generator");
256 // Check that we deduce the signature from the `<_ as std::ops::Generator>::Return`
257 // associated item and not yield.
258 let return_assoc_item =
259 self.tcx.associated_items(gen_trait).in_definition_order().nth(1).unwrap().def_id;
260 if return_assoc_item != projection.projection_def_id() {
261 debug!("deduce_sig_from_projection: not return assoc item of generator");
266 let input_tys = if is_fn {
267 let arg_param_ty = trait_ref.skip_binder().substs.type_at(1);
268 let arg_param_ty = self.resolve_vars_if_possible(&arg_param_ty);
269 debug!("deduce_sig_from_projection: arg_param_ty={:?}", arg_param_ty);
271 match arg_param_ty.kind {
272 ty::Tuple(tys) => tys.into_iter().map(|k| k.expect_ty()).collect::<Vec<_>>(),
276 // Generators with a `()` resume type may be defined with 0 or 1 explicit arguments,
277 // else they must have exactly 1 argument. For now though, just give up in this case.
281 let ret_param_ty = projection.skip_binder().ty;
282 let ret_param_ty = self.resolve_vars_if_possible(&ret_param_ty);
283 debug!("deduce_sig_from_projection: ret_param_ty={:?}", ret_param_ty);
285 let sig = self.tcx.mk_fn_sig(
289 hir::Unsafety::Normal,
292 debug!("deduce_sig_from_projection: sig={:?}", sig);
294 Some(ExpectedSig { cause_span, sig })
300 decl: &hir::FnDecl<'_>,
301 body: &hir::Body<'_>,
302 expected_sig: Option<ExpectedSig<'tcx>>,
303 ) -> ClosureSignatures<'tcx> {
304 if let Some(e) = expected_sig {
305 self.sig_of_closure_with_expectation(expr_def_id, decl, body, e)
307 self.sig_of_closure_no_expectation(expr_def_id, decl, body)
311 /// If there is no expected signature, then we will convert the
312 /// types that the user gave into a signature.
313 fn sig_of_closure_no_expectation(
316 decl: &hir::FnDecl<'_>,
317 body: &hir::Body<'_>,
318 ) -> ClosureSignatures<'tcx> {
319 debug!("sig_of_closure_no_expectation()");
321 let bound_sig = self.supplied_sig_of_closure(expr_def_id, decl, body);
323 self.closure_sigs(expr_def_id, body, bound_sig)
326 /// Invoked to compute the signature of a closure expression. This
327 /// combines any user-provided type annotations (e.g., `|x: u32|
328 /// -> u32 { .. }`) with the expected signature.
330 /// The approach is as follows:
332 /// - Let `S` be the (higher-ranked) signature that we derive from the user's annotations.
333 /// - Let `E` be the (higher-ranked) signature that we derive from the expectations, if any.
334 /// - If we have no expectation `E`, then the signature of the closure is `S`.
335 /// - Otherwise, the signature of the closure is E. Moreover:
336 /// - Skolemize the late-bound regions in `E`, yielding `E'`.
337 /// - Instantiate all the late-bound regions bound in the closure within `S`
338 /// with fresh (existential) variables, yielding `S'`
339 /// - Require that `E' = S'`
340 /// - We could use some kind of subtyping relationship here,
341 /// I imagine, but equality is easier and works fine for
344 /// The key intuition here is that the user's types must be valid
345 /// from "the inside" of the closure, but the expectation
346 /// ultimately drives the overall signature.
351 /// fn with_closure<F>(_: F)
352 /// where F: Fn(&u32) -> &u32 { .. }
354 /// with_closure(|x: &u32| { ... })
358 /// - E would be `fn(&u32) -> &u32`.
359 /// - S would be `fn(&u32) ->
360 /// - E' is `&'!0 u32 -> &'!0 u32`
361 /// - S' is `&'?0 u32 -> ?T`
363 /// S' can be unified with E' with `['?0 = '!0, ?T = &'!10 u32]`.
367 /// - `expr_def_id`: the `DefId` of the closure expression
368 /// - `decl`: the HIR declaration of the closure
369 /// - `body`: the body of the closure
370 /// - `expected_sig`: the expected signature (if any). Note that
371 /// this is missing a binder: that is, there may be late-bound
372 /// regions with depth 1, which are bound then by the closure.
373 fn sig_of_closure_with_expectation(
376 decl: &hir::FnDecl<'_>,
377 body: &hir::Body<'_>,
378 expected_sig: ExpectedSig<'tcx>,
379 ) -> ClosureSignatures<'tcx> {
380 debug!("sig_of_closure_with_expectation(expected_sig={:?})", expected_sig);
382 // Watch out for some surprises and just ignore the
383 // expectation if things don't see to match up with what we
385 if expected_sig.sig.c_variadic != decl.c_variadic {
386 return self.sig_of_closure_no_expectation(expr_def_id, decl, body);
387 } else if expected_sig.sig.inputs_and_output.len() != decl.inputs.len() + 1 {
388 return self.sig_of_closure_with_mismatched_number_of_arguments(
396 // Create a `PolyFnSig`. Note the oddity that late bound
397 // regions appearing free in `expected_sig` are now bound up
398 // in this binder we are creating.
399 assert!(!expected_sig.sig.has_vars_bound_above(ty::INNERMOST));
400 let bound_sig = ty::Binder::bind(self.tcx.mk_fn_sig(
401 expected_sig.sig.inputs().iter().cloned(),
402 expected_sig.sig.output(),
404 hir::Unsafety::Normal,
408 // `deduce_expectations_from_expected_type` introduces
409 // late-bound lifetimes defined elsewhere, which we now
410 // anonymize away, so as not to confuse the user.
411 let bound_sig = self.tcx.anonymize_late_bound_regions(&bound_sig);
413 let closure_sigs = self.closure_sigs(expr_def_id, body, bound_sig);
415 // Up till this point, we have ignored the annotations that the user
416 // gave. This function will check that they unify successfully.
417 // Along the way, it also writes out entries for types that the user
418 // wrote into our typeck results, which are then later used by the privacy
420 match self.check_supplied_sig_against_expectation(expr_def_id, decl, body, &closure_sigs) {
421 Ok(infer_ok) => self.register_infer_ok_obligations(infer_ok),
422 Err(_) => return self.sig_of_closure_no_expectation(expr_def_id, decl, body),
428 fn sig_of_closure_with_mismatched_number_of_arguments(
431 decl: &hir::FnDecl<'_>,
432 body: &hir::Body<'_>,
433 expected_sig: ExpectedSig<'tcx>,
434 ) -> ClosureSignatures<'tcx> {
435 let hir = self.tcx.hir();
436 let expr_map_node = hir.get_if_local(expr_def_id).unwrap();
437 let expected_args: Vec<_> = expected_sig
441 .map(|ty| ArgKind::from_expected_ty(ty, None))
443 let (closure_span, found_args) = match self.get_fn_like_arguments(expr_map_node) {
444 Some((sp, args)) => (Some(sp), args),
445 None => (None, Vec::new()),
448 expected_sig.cause_span.unwrap_or_else(|| hir.span_if_local(expr_def_id).unwrap());
449 self.report_arg_count_mismatch(
458 let error_sig = self.error_sig_of_closure(decl);
460 self.closure_sigs(expr_def_id, body, error_sig)
463 /// Enforce the user's types against the expectation. See
464 /// `sig_of_closure_with_expectation` for details on the overall
466 fn check_supplied_sig_against_expectation(
469 decl: &hir::FnDecl<'_>,
470 body: &hir::Body<'_>,
471 expected_sigs: &ClosureSignatures<'tcx>,
472 ) -> InferResult<'tcx, ()> {
473 // Get the signature S that the user gave.
475 // (See comment on `sig_of_closure_with_expectation` for the
476 // meaning of these letters.)
477 let supplied_sig = self.supplied_sig_of_closure(expr_def_id, decl, body);
479 debug!("check_supplied_sig_against_expectation: supplied_sig={:?}", supplied_sig);
481 // FIXME(#45727): As discussed in [this comment][c1], naively
482 // forcing equality here actually results in suboptimal error
483 // messages in some cases. For now, if there would have been
484 // an obvious error, we fallback to declaring the type of the
485 // closure to be the one the user gave, which allows other
486 // error message code to trigger.
488 // However, I think [there is potential to do even better
489 // here][c2], since in *this* code we have the precise span of
490 // the type parameter in question in hand when we report the
493 // [c1]: https://github.com/rust-lang/rust/pull/45072#issuecomment-341089706
494 // [c2]: https://github.com/rust-lang/rust/pull/45072#issuecomment-341096796
495 self.infcx.commit_if_ok(|_| {
496 let mut all_obligations = vec![];
498 // The liberated version of this signature should be a subtype
499 // of the liberated form of the expectation.
500 for ((hir_ty, &supplied_ty), expected_ty) in decl
503 .zip(supplied_sig.inputs().skip_binder()) // binder moved to (*) below
504 .zip(expected_sigs.liberated_sig.inputs())
505 // `liberated_sig` is E'.
507 // Instantiate (this part of..) S to S', i.e., with fresh variables.
508 let (supplied_ty, _) = self.infcx.replace_bound_vars_with_fresh_vars(
510 LateBoundRegionConversionTime::FnCall,
511 &ty::Binder::bind(supplied_ty),
512 ); // recreated from (*) above
514 // Check that E' = S'.
515 let cause = self.misc(hir_ty.span);
516 let InferOk { value: (), obligations } =
517 self.at(&cause, self.param_env).eq(*expected_ty, supplied_ty)?;
518 all_obligations.extend(obligations);
521 let (supplied_output_ty, _) = self.infcx.replace_bound_vars_with_fresh_vars(
523 LateBoundRegionConversionTime::FnCall,
524 &supplied_sig.output(),
526 let cause = &self.misc(decl.output.span());
527 let InferOk { value: (), obligations } = self
528 .at(cause, self.param_env)
529 .eq(expected_sigs.liberated_sig.output(), supplied_output_ty)?;
530 all_obligations.extend(obligations);
532 Ok(InferOk { value: (), obligations: all_obligations })
536 /// If there is no expected signature, then we will convert the
537 /// types that the user gave into a signature.
539 /// Also, record this closure signature for later.
540 fn supplied_sig_of_closure(
543 decl: &hir::FnDecl<'_>,
544 body: &hir::Body<'_>,
545 ) -> ty::PolyFnSig<'tcx> {
546 let astconv: &dyn AstConv<'_> = self;
549 "supplied_sig_of_closure(decl={:?}, body.generator_kind={:?})",
550 decl, body.generator_kind,
553 // First, convert the types that the user supplied (if any).
554 let supplied_arguments = decl.inputs.iter().map(|a| astconv.ast_ty_to_ty(a));
555 let supplied_return = match decl.output {
556 hir::FnRetTy::Return(ref output) => astconv.ast_ty_to_ty(&output),
557 hir::FnRetTy::DefaultReturn(_) => match body.generator_kind {
558 // In the case of the async block that we create for a function body,
559 // we expect the return type of the block to match that of the enclosing
561 Some(hir::GeneratorKind::Async(hir::AsyncGeneratorKind::Fn)) => {
562 debug!("supplied_sig_of_closure: closure is async fn body");
563 self.deduce_future_output_from_obligations(expr_def_id).unwrap_or_else(|| {
564 // AFAIK, deducing the future output
565 // always succeeds *except* in error cases
566 // like #65159. I'd like to return Error
567 // here, but I can't because I can't
568 // easily (and locally) prove that we
569 // *have* reported an
570 // error. --nikomatsakis
571 astconv.ty_infer(None, decl.output.span())
575 _ => astconv.ty_infer(None, decl.output.span()),
579 let result = ty::Binder::bind(self.tcx.mk_fn_sig(
583 hir::Unsafety::Normal,
587 debug!("supplied_sig_of_closure: result={:?}", result);
589 let c_result = self.inh.infcx.canonicalize_response(&result);
590 self.typeck_results.borrow_mut().user_provided_sigs.insert(expr_def_id, c_result);
595 /// Invoked when we are translating the generator that results
596 /// from desugaring an `async fn`. Returns the "sugared" return
597 /// type of the `async fn` -- that is, the return type that the
598 /// user specified. The "desugared" return type is a `impl
599 /// Future<Output = T>`, so we do this by searching through the
600 /// obligations to extract the `T`.
601 fn deduce_future_output_from_obligations(&self, expr_def_id: DefId) -> Option<Ty<'tcx>> {
602 debug!("deduce_future_output_from_obligations(expr_def_id={:?})", expr_def_id);
604 let ret_coercion = self.ret_coercion.as_ref().unwrap_or_else(|| {
605 span_bug!(self.tcx.def_span(expr_def_id), "async fn generator outside of a fn")
608 // In practice, the return type of the surrounding function is
609 // always a (not yet resolved) inference variable, because it
610 // is the hidden type for an `impl Trait` that we are going to
612 let ret_ty = ret_coercion.borrow().expected_ty();
613 let ret_ty = self.inh.infcx.shallow_resolve(ret_ty);
614 let ret_vid = match ret_ty.kind {
615 ty::Infer(ty::TyVar(ret_vid)) => ret_vid,
617 self.tcx.def_span(expr_def_id),
618 "async fn generator return type not an inference variable"
622 // Search for a pending obligation like
624 // `<R as Future>::Output = T`
626 // where R is the return type we are expecting. This type `T`
627 // will be our output.
628 let output_ty = self.obligations_for_self_ty(ret_vid).find_map(|(_, obligation)| {
629 if let ty::PredicateAtom::Projection(proj_predicate) =
630 obligation.predicate.skip_binders()
632 self.deduce_future_output_from_projection(
633 obligation.cause.span,
634 ty::Binder::bind(proj_predicate),
641 debug!("deduce_future_output_from_obligations: output_ty={:?}", output_ty);
645 /// Given a projection like
647 /// `<X as Future>::Output = T`
649 /// where `X` is some type that has no late-bound regions, returns
650 /// `Some(T)`. If the projection is for some other trait, returns
652 fn deduce_future_output_from_projection(
655 predicate: ty::PolyProjectionPredicate<'tcx>,
656 ) -> Option<Ty<'tcx>> {
657 debug!("deduce_future_output_from_projection(predicate={:?})", predicate);
659 // We do not expect any bound regions in our predicate, so
660 // skip past the bound vars.
661 let predicate = match predicate.no_bound_vars() {
664 debug!("deduce_future_output_from_projection: has late-bound regions");
669 // Check that this is a projection from the `Future` trait.
670 let trait_ref = predicate.projection_ty.trait_ref(self.tcx);
671 let future_trait = self.tcx.require_lang_item(FutureTraitLangItem, Some(cause_span));
672 if trait_ref.def_id != future_trait {
673 debug!("deduce_future_output_from_projection: not a future");
677 // The `Future` trait has only one associted item, `Output`,
678 // so check that this is what we see.
679 let output_assoc_item =
680 self.tcx.associated_items(future_trait).in_definition_order().next().unwrap().def_id;
681 if output_assoc_item != predicate.projection_ty.item_def_id {
684 "projecting associated item `{:?}` from future, which is not Output `{:?}`",
685 predicate.projection_ty.item_def_id,
690 // Extract the type from the projection. Note that there can
691 // be no bound variables in this type because the "self type"
692 // does not have any regions in it.
693 let output_ty = self.resolve_vars_if_possible(&predicate.ty);
694 debug!("deduce_future_output_from_projection: output_ty={:?}", output_ty);
698 /// Converts the types that the user supplied, in case that doing
699 /// so should yield an error, but returns back a signature where
700 /// all parameters are of type `TyErr`.
701 fn error_sig_of_closure(&self, decl: &hir::FnDecl<'_>) -> ty::PolyFnSig<'tcx> {
702 let astconv: &dyn AstConv<'_> = self;
704 let supplied_arguments = decl.inputs.iter().map(|a| {
705 // Convert the types that the user supplied (if any), but ignore them.
706 astconv.ast_ty_to_ty(a);
710 if let hir::FnRetTy::Return(ref output) = decl.output {
711 astconv.ast_ty_to_ty(&output);
714 let result = ty::Binder::bind(self.tcx.mk_fn_sig(
718 hir::Unsafety::Normal,
722 debug!("supplied_sig_of_closure: result={:?}", result);
730 body: &hir::Body<'_>,
731 bound_sig: ty::PolyFnSig<'tcx>,
732 ) -> ClosureSignatures<'tcx> {
733 let liberated_sig = self.tcx().liberate_late_bound_regions(expr_def_id, &bound_sig);
734 let liberated_sig = self.inh.normalize_associated_types_in(
740 ClosureSignatures { bound_sig, liberated_sig }