Skip to content

Conversation

@coord-e
Copy link
Owner

@coord-e coord-e commented Oct 25, 2025

extracted from #8

  • TemplateTypeGenerator/UnrefinedTypeGenerator -> TypeBuilder
  • Shift type parameters according to generics_of(def_id)

@coord-e coord-e requested a review from Copilot October 25, 2025 02:27
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 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 TypeBuilder to translate MIR types to Thrust types with proper parameter index mapping
  • Renamed TypeParams to TypeArgs for 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.

@coord-e coord-e merged commit 896c25c into main Oct 25, 2025
3 checks passed
@coord-e coord-e deleted the type-param-shift branch October 25, 2025 02:41
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