Skip to content

feat: complex return value patterns#2134

Open
mkovaxx wants to merge 17 commits intomainfrom
multiple-named-return-vals
Open

feat: complex return value patterns#2134
mkovaxx wants to merge 17 commits intomainfrom
multiple-named-return-vals

Conversation

@mkovaxx
Copy link
Collaborator

@mkovaxx mkovaxx commented Feb 2, 2026

  • Extend the lowering path of ensures to support complex patterns for binding the return value.
  • Add tests to exercise some complex patterns.
  • Extend identifier collision checks to gather all identifiers from a pattern.
  • Refactor and simplify some related code.

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

@mkovaxx mkovaxx force-pushed the multiple-named-return-vals branch from 11d27fa to 2378916 Compare March 17, 2026 11:36
@mkovaxx mkovaxx marked this pull request as ready for review March 17, 2026 15:24
Copy link
Collaborator

@parno parno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This generally looks reasonable to me, and it's great to see how this already improves the legibility of some of the existing tests. However, I don't know this code super well, so it'd be good to get @Chris-Hawblitzel's input as well.

parse_quote_spanned!(expr_span => { let #final_ret_pat = #ret_pat; #inner });
*expr = wrap_expr_with_attrs(wrapped, attrs);
}
let ret_val_ident: Ident = Ident::new("_VERUS_ret_ident", Span::call_site());
Copy link
Collaborator Author

@mkovaxx mkovaxx Mar 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Chris-Hawblitzel Unconditionally introducing this "internal" identifier allows completely removing identifier collision checks (e.g. against the function's name).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants