Skip to content

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

Merged
hvitved merged 2 commits intogithub: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 intogithub:mainfrom
hvitved:rust/type-inference-qualified-trait-arg-path

Conversation

@hvitved
Copy link
Contributor

@hvitved hvitved commented Mar 5, 2026

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

@github-actions github-actions bot added the Rust Pull requests that update Rust code label Mar 5, 2026
@hvitved hvitved force-pushed the rust/type-inference-qualified-trait-arg-path branch from d83ebf0 to ff41917 Compare March 5, 2026 20:42
@hvitved hvitved requested a review from paldepind March 6, 2026 05:10
@hvitved hvitved 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 owner March 6, 2026 05:10
Copilot AI review requested due to automatic review settings March 6, 2026 05:10
Copy link
Contributor

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

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
File Description
rust/ql/lib/codeql/rust/internal/typeinference/TypeMention.qll Adjusts internal type-mention logic for concrete-type associated-type resolution.
rust/ql/lib/codeql/rust/internal/typeinference/AssociatedType.qll Refines identification/resolution of <type as trait>::name paths.
rust/ql/test/library-tests/type-inference/regressions.rs Adds a new regression covering <S1 as Sub<S2>>::Output and dispatch behavior.
rust/ql/test/library-tests/type-inference/associated_types.rs Updates inline expectations for a generic-trait associated-type test to reflect conservative resolution.
rust/ql/test/library-tests/type-inference/type-inference.expected Updates generated expected results for type inference tests.
rust/ql/test/library-tests/type-inference/CONSISTENCY/TypeInferenceConsistency.expected Updates generated consistency expectations (removes a previously-recorded case).

Copy link
Contributor

@paldepind paldepind left a comment

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:main Mar 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 free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-change-note-required This PR does not need a change note Rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants