Skip to content

Conversation

@coord-e
Copy link
Owner

@coord-e coord-e commented Nov 23, 2025

  • TypeBuilder can't affect mir_ty::Instance::resolve

@coord-e coord-e marked this pull request as ready for review December 14, 2025 09:34
@coord-e coord-e requested a review from Copilot December 14, 2025 09:35
Copy link

Copilot AI left a 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.

@coord-e coord-e merged commit d11565d into main Dec 28, 2025
3 checks passed
@coord-e coord-e deleted the closures branch December 28, 2025 03:28
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