Skip to content

Rust: allow shadowing of prelude items #19292

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

Merged
merged 2 commits into from
Apr 15, 2025
Merged

Conversation

aibaars
Copy link
Contributor

@aibaars aibaars commented Apr 11, 2025

@Copilot Copilot bot review requested due to automatic review settings April 11, 2025 13:57
@aibaars aibaars changed the title Rust: allow shadowing of prelude items @aibaars Rust: allow shadowing of prelude items Apr 11, 2025
@github-actions github-actions bot added the Rust Pull requests that update Rust code label Apr 11, 2025
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 updates the Rust test file to explicitly allow shadowing of prelude items by introducing a new type alias Result along with an int_div function for demonstrating the behavior.

  • Introduces a new type alias Result that aliases std::result::Result<T, String>.
  • Adds a function int_div that leverages the new type alias to handle division, returning an error on division by zero.
Files not reviewed (3)
  • rust/ql/lib/codeql/rust/internal/PathResolution.qll: Language not supported
  • rust/ql/test/library-tests/path-resolution/path-resolution.expected: Language not supported
  • rust/ql/test/library-tests/path-resolution/path-resolution.ql: Language not supported
Comments suppressed due to low confidence (1)

rust/ql/test/library-tests/path-resolution/my.rs:20

  • [nitpick] While the PR's intent is to allow shadowing of prelude items, consider whether a more descriptive alias (e.g., MyResult) might improve code clarity for future readers.
type Result<

Copy link
Contributor

@hvitved hvitved left a comment

Choose a reason for hiding this comment

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

LGTM, assuming DCA is happy (I have started a run).

@aibaars aibaars merged commit 1c79c5e into main Apr 15, 2025
17 checks passed
@aibaars aibaars deleted the aibaars/rust-shadow-prelude branch April 15, 2025 07:54
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.

2 participants