Skip to content

fix: ignore implicit unbound named generic when searching trait impls#9350

Closed
asterite wants to merge 1 commit intomasterfrom
ab/trait-parent-check-9168
Closed

fix: ignore implicit unbound named generic when searching trait impls#9350
asterite wants to merge 1 commit intomasterfrom
ab/trait-parent-check-9168

Conversation

@asterite
Copy link
Collaborator

Description

Problem

Resolves #9168

Summary

I'm unsure about this change but in the small code snippet for the test the only thing that was failing was the trait impl lookup. This is the code:

pub trait Other {
    let N: u32;
}
pub trait Trait<T>
where
    T: Other,
{}
impl Other for Field {
    let N: u32 = 1;
}
impl Trait<Field> for i32 {}

When analyzing impl Trait<Field> for i32 we check if Field: Other we try to find an impl for Field that matches Other<N = implicitly_added_named_generic>. It will then try to unify that implicitly added named generic with 1 and fail.

Maybe an alternative is to replace those implicitly added named generics here with fresh type variables? In any case these bindings aren't committed in this lookup....

Additional Context

Documentation

Check one:

  • No documentation needed.
  • Documentation included in this PR.
  • [For Experimental Features] Documentation to be submitted in a separate PR.

PR Checklist

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt on default settings.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Test Suite Duration'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.

Benchmark suite Current: 8f48b3f Previous: 38997a8 Ratio
test_report_AztecProtocol_aztec-packages_noir-projects_noir-protocol-circuits_crates_reset-kernel-lib 2 s 1 s 2
test_report_AztecProtocol_aztec-packages_noir-projects_noir-protocol-circuits_crates_rollup-lib 4 s 3 s 1.33
test_report_zkpassport_noir-ecdsa_ 3 s 1 s 3

This comment was automatically generated by workflow using github-action-benchmark.

CC: @TomAFrench

@asterite
Copy link
Collaborator Author

Closed in favor of #9352

@asterite asterite closed this Jul 29, 2025
@asterite asterite deleted the ab/trait-parent-check-9168 branch July 29, 2025 14:44
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.

Trait bound not satisified when it has associated constants

1 participant