-
Notifications
You must be signed in to change notification settings - Fork 1
Support closures (with simple usage of traits) #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Uh oh!
There was an error while loading. Please reload this page.