Conversation
This was referenced Dec 14, 2025
There was a problem hiding this comment.
Pull request overview
This PR adds support for closures and simple trait usage to the Thrust refinement type system. The changes enable the system to handle closure types, trait method dispatch, and the RustCall ABI used by closures.
- Added support for closure types by treating them as tuples of captured variables
- Implemented RustCall ABI handling with parameter expansion for closure calls
- Enhanced function type resolution to properly handle trait method dispatch through
Instance::resolve
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/ui/pass/trait_param.rs | Test for trait-based generic function with correct assertion |
| tests/ui/pass/trait.rs | Test for direct trait method calls |
| tests/ui/pass/closure_param.rs | Test for closure passed as function parameter |
| tests/ui/pass/closure_no_capture.rs | Test for closure without captures |
| tests/ui/pass/closure_mut_0.rs | Test for closure with mutable captures (no parameters) |
| tests/ui/pass/closure_mut.rs | Test for closure with mutable captures and parameters |
| tests/ui/fail/trait_param.rs | Negative test for trait-based generic function |
| tests/ui/fail/trait.rs | Negative test for trait method calls |
| tests/ui/fail/closure_param.rs | Negative test for closure parameter handling |
| tests/ui/fail/closure_no_capture.rs | Negative test for closure without captures |
| tests/ui/fail/closure_mut_0.rs | Negative test for mutable closure (checks x == 2 when x == 3) |
| tests/ui/fail/closure_mut.rs | Negative test for mutable closure with parameters |
| src/rty.rs | Added FunctionAbi enum, abi field to FunctionType, and deref method for RefinedType |
| src/refine/template.rs | Added closure type handling and ABI tracking in type builders |
| src/chc.rs | Added boxed helper method for Term construction |
| src/analyze/crate_.rs | Refactored to use new local_fn_sig method for better closure support |
| src/analyze/basic_block.rs | Implemented RustCall ABI parameter expansion and closure type handling |
| src/analyze.rs | Added local_fn_sig methods to extract signatures from MIR for closures |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
coeff-aij
pushed a commit
to coeff-aij/thrust
that referenced
this pull request
Jan 12, 2026
Support closures (with simple usage of traits)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.