Skip to content

Rust: More conservative resolution of <Foo as Bar<...>> paths - #21420

Merged
hvitved merged 2 commits into
github:mainfrom
hvitved:rust/type-inference-qualified-trait-arg-path
Mar 6, 2026
Merged

Rust: More conservative resolution of <Foo as Bar<...>> paths#21420
hvitved merged 2 commits into
github:mainfrom
hvitved:rust/type-inference-qualified-trait-arg-path

Conversation

@hvitved

@hvitvedhvitved commented Mar 5, 2026

Copy link
Copy Markdown
Contributor

#21188 follow-up. Fixes a performance regression seen on the project mycroft/challenges.

@github-actionsgithub-actionsBot added the Rust Pull requests that update Rust code label Mar 5, 2026
@hvitved
hvitvedforce-pushed the rust/type-inference-qualified-trait-arg-path branch from d83ebf0 to ff41917CompareMarch 5, 2026 20:42
@hvitved
hvitved requested a review from paldepindMarch 6, 2026 05:10
@hvitvedhvitved added the no-change-note-required This PR does not need a change note label Mar 6, 2026
@hvitved
hvitved marked this pull request as ready for review March 6, 2026 05:10
@hvitved
hvitved requested a review from a team as a code ownerMarch 6, 2026 05:10
CopilotAI review requested due to automatic review settings March 6, 2026 05:10

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Follow-up to #21188 that tightens resolution for Rust <Foo as Bar<...>> associated-type paths to address a performance regression observed on mycroft/challenges.

Changes:

  • Refines associated-type path handling in the Rust type-inference libraries to be more conservative when resolving <Type as Trait<...>>::Assoc.
  • Adds a new regression test (regression2) exercising Sub impl selection and associated-type projection through <S1 as Sub<S2>>::Output.
  • Updates type-inference test expectations to reflect the new (more conservative) resolution behavior and removes a previous consistency expectation.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
FileDescription
rust/ql/lib/codeql/rust/internal/typeinference/TypeMention.qllAdjusts internal type-mention logic for concrete-type associated-type resolution.
rust/ql/lib/codeql/rust/internal/typeinference/AssociatedType.qllRefines identification/resolution of <type as trait>::name paths.
rust/ql/test/library-tests/type-inference/regressions.rsAdds a new regression covering <S1 as Sub<S2>>::Output and dispatch behavior.
rust/ql/test/library-tests/type-inference/associated_types.rsUpdates inline expectations for a generic-trait associated-type test to reflect conservative resolution.
rust/ql/test/library-tests/type-inference/type-inference.expectedUpdates generated expected results for type inference tests.
rust/ql/test/library-tests/type-inference/CONSISTENCY/TypeInferenceConsistency.expectedUpdates generated consistency expectations (removes a previously-recorded case).

@paldepindpaldepind left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Makes sense given that this fixes timeouts. Thanks!

@hvitved
hvitved merged commit 84bef5d into github:mainMar 6, 2026
30 checks passed
@hvitved
hvitved deleted the rust/type-inference-qualified-trait-arg-path branch March 6, 2026 14:14
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-change-note-requiredThis PR does not need a change noteRustPull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@hvitved@paldepind@github-advanced-security