Exclude closures defined in formula_fn from analysis and borrowck#67
Open
Exclude closures defined in formula_fn from analysis and borrowck#67
Conversation
There was a problem hiding this comment.
Pull request overview
Adjusts Thrust’s analysis pipeline to ignore MIR bodies generated for closures that originate inside #[thrust::formula_fn] functions, avoiding unintended analysis/borrowck work on compiler-generated closure items.
Changes:
- Skip local refinement/analysis for MIR items whose
typeck_root_def_idis already marked as skipped. - Skip
mir_borrowcknot only for#[thrust::formula_fn]items themselves, but also for their generated closure bodies (viatypeck_root_def_id).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/analyze/crate_.rs |
Adds a root-def-id based early return to skip analysis of closures/synthetic bodies under already-skipped defs. |
src/analyze.rs |
Extends borrowck skipping to closures whose root def is annotated #[thrust::formula_fn]. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
db0411a to
75d8b48
Compare
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.
follow-up of #64
extracted from #57
formula_fnwith existential quantification would contain closures. They're syntactically contained in theformula_fnf, but are expanded to top-level function in MIR and are processed as usual by Thrust and rustc, which is undesired. This PR makes it skip analysis and borrowck if the function is a closure defined withinformula_fn.This PR also deal with closures defined within
#[thrust::ignored]or some other functions that are skipped by Thrust