Ignore lifetime parameters properly when numbering type params#9
Merged
Ignore lifetime parameters properly when numbering type params#9
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the type generation architecture to properly handle lifetime parameters when numbering type parameters. The key change is replacing the TemplateTypeGenerator/UnrefinedTypeGenerator traits with a new TypeBuilder struct that maps MIR type parameter indices to Thrust type parameter indices, skipping lifetime parameters in the process.
Key changes:
- Introduced
TypeBuilderto translate MIR types to Thrust types with proper parameter index mapping - Renamed
TypeParamstoTypeArgsfor better clarity - Consolidated template-based type generation into
TemplateTypeBuilder
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/ui/pass/adt_poly_ref.rs | Added passing test case for enum with lifetime and type parameters |
| tests/ui/fail/adt_poly_ref.rs | Added failing test case for enum with lifetime and type parameters |
| src/rty/params.rs | Added documentation explaining parameter indexing differences; renamed TypeParams to TypeArgs; added into_args method |
| src/rty.rs | Updated exports to use renamed TypeArgs type |
| src/refine/template.rs | Major refactor: introduced TypeBuilder with parameter index mapping; consolidated type generation logic |
| src/refine/env.rs | Updated TemplateScope implementation to use associated type |
| src/refine.rs | Updated exports to reflect new type builder API |
| src/analyze/local_def.rs | Updated to use new TypeBuilder API |
| src/analyze/crate_.rs | Updated to use new TypeBuilder API; fixed type parameter counting to use generics metadata |
| src/analyze/basic_block.rs | Updated to use new TypeBuilder API throughout |
| src/analyze.rs | Simplified analyzer to only implement TemplateRegistry |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b2c699f to
18bbbee
Compare
coeff-aij
pushed a commit
to coeff-aij/thrust
that referenced
this pull request
Jan 12, 2026
Ignore lifetime parameters properly when numbering type params
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.
extracted from #8
generics_of(def_id)