Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rust: Take where clauses into account in path resolution #19193

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

hvitved
Copy link
Contributor

@hvitved hvitved commented Apr 2, 2025

I used Copilot Agent to generate the test case, which mostly worked fine, except it inserted a stray whitespace in one of the comment markers, which took my quite a while to identify. To prevent this from happening again, I've inserted appropriate trimming of the markers.

@github-actions github-actions bot added the Rust Pull requests that update Rust code label Apr 2, 2025
@hvitved hvitved force-pushed the rust/path-resolution-where-clause branch from 6fc9369 to 9117247 Compare April 9, 2025 08:40
@hvitved hvitved force-pushed the rust/path-resolution-where-clause branch from 9117247 to f17ffe3 Compare April 9, 2025 09:02
@hvitved hvitved marked this pull request as ready for review April 9, 2025 12:02
@hvitved hvitved requested review from Copilot and paldepind April 9, 2025 12:02
Copy link
Contributor

@Copilot 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 fixes a stray whitespace issue in a comment marker in the type inference tests and adds a new test module to verify that Rust’s path resolution correctly takes into account where clauses.

  • Fixed whitespace in a comment marker in the type inference test case
  • Added a new module (m24) in path resolution tests to exercise trait bounds in where clauses

Reviewed Changes

Copilot reviewed 2 out of 6 changed files in this pull request and generated 1 comment.

File Description
rust/ql/test/library-tests/type-inference/main.rs Trimmed stray whitespace in the comment marker for a method call to ensure test annotations are correctly formatted.
rust/ql/test/library-tests/path-resolution/main.rs Introduced module m24 with trait definitions and implementations to test path resolution logic involving where clauses.
Files not reviewed (4)
  • rust/ql/lib/codeql/rust/internal/PathResolution.qll: Language not supported
  • rust/ql/lib/utils/test/PathResolutionInlineExpectationsTest.qll: Language not supported
  • rust/ql/test/library-tests/path-resolution/path-resolution.expected: Language not supported
  • rust/ql/test/library-tests/variables/variables.ql: Language not supported

let impl_obj = Implementor; // $ item=I118
let generic = GenericStruct { data: impl_obj }; // $ item=I115

generic.call_trait_a(); // $ MISSING: item=I116
Copy link
Preview

Copilot AI Apr 9, 2025

Choose a reason for hiding this comment

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

The annotation '$ MISSING: item=I116' on this line is inconsistent with other markers in the file. If it is not intended, please remove or correct it to match the expected format.

Suggested change
generic.call_trait_a(); // $ MISSING: item=I116
generic.call_trait_a(); // $ item=I116

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant