Skip to content

Fix ICE with generic associated type lifetime substitution - #1721

Closed
nilehmann with Copilot wants to merge 3 commits into
mainfrom
copilot/1716-investigate-ice-issue
Closed

Fix ICE with generic associated type lifetime substitution#1721
nilehmann with Copilot wants to merge 3 commits into
mainfrom
copilot/1716-investigate-ice-issue

Conversation

Copilot AI commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Closes #1716

Summary

Flux ICEs with region parameter out of range when resolving a generic associated type (GAT) with a lifetime parameter, e.g.:

pub trait D { type Tok<'a>; }
pub struct L;
impl D for L { type Tok<'a> = &'a L; }
pub fn f(x: &L) -> <L as D>::Tok<'_> { x }

…eters (issue #1718)

Co-authored-by: nilehmann <2400776+nilehmann@users.noreply.github.com>
Copilot AI changed the title Fix ICE: assertion left == right failed for FnPtr with lifetime parameters (#1718) Fix ICE: assertion left == right failed for FnPtr with lifetime parameters Aug 13, 2026
Copilot AI requested a review from nilehmann August 13, 2026 22:55
When normalizing a projection with a GAT that has its own generic
parameters (e.g., `type Tok<'a> = &'a L`), the confirm_candidate
function was only passing the impl-level generic args to instantiate
the associated type definition. The GAT's own generic args from the
obligation (e.g., the lifetime `'a`) were not included, causing a
"region parameter out of range" ICE.

Fix by appending the GAT's own generic args from the obligation to
the impl-level substitution args before instantiation.

Co-authored-by: nilehmann <2400776+nilehmann@users.noreply.github.com>
Co-authored-by: nilehmann <2400776+nilehmann@users.noreply.github.com>
@nilehmann nilehmann changed the title Fix ICE: assertion left == right failed for FnPtr with lifetime parameters Fix ICE with generic associated type lifetime substitution Aug 14, 2026
@nilehmann nilehmann closed this Aug 14, 2026
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.

ICE with substituting a generic associate type's lifetime parameter

2 participants