Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Rust: add more macro expansion tests #19600

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 1 commit into from
May 28, 2025

Conversation

redsun82
Copy link
Contributor

@redsun82 redsun82 commented May 27, 2025

This highlights 4 classes of macro calls that don't get any expansion from rust-analyzer 0.0.274 onwards (they do on current main).

@Copilot Copilot AI review requested due to automatic review settings May 27, 2025 15:05
@redsun82 redsun82 requested a review from a team as a code owner May 27, 2025 15:05
@github-actions github-actions bot added the Rust Pull requests that update Rust code label May 27, 2025
@redsun82 redsun82 requested a review from aibaars May 27, 2025 15:05
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 expands the macro-expansion integration tests in QL by adding new predicates and updating expected outputs to catch previously untested macro cases.

  • Added three new QL predicates for attribute macro expansions, resolved macro calls, and unexpanded macro calls.
  • Updated expected results to include attribute/crate-specific paths and counts.
  • Restructured the workspace (renamed the macros crate, added attributes, calls, proc_macros) and updated source archive and diagnostics expectations.

Reviewed Changes

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

Show a summary per file
File Description
rust/ql/integration-tests/macro-expansion/test.ql Added predicates attribute_macros, macro_calls, and unexpanded_macro_calls.
rust/ql/integration-tests/macro-expansion/test.expected Updated expected test sections and paths.
rust/ql/integration-tests/macro-expansion/summary.qlref Removed obsolete summary reference.
rust/ql/integration-tests/macro-expansion/summary.expected Cleared old summary expectations.
rust/ql/integration-tests/macro-expansion/source_archive.expected Added new source files under attributes and calls.
rust/ql/integration-tests/macro-expansion/proc_macros/Cargo.toml Renamed crate from macros to proc_macros.
rust/ql/integration-tests/macro-expansion/calls/src/lib.rs Added several macro calls to test expansion.
rust/ql/integration-tests/macro-expansion/attributes/src/lib.rs Switched to proc_macros::repeat and inline concat! test.
rust/ql/integration-tests/macro-expansion/Cargo.toml Updated workspace members.
rust/ql/integration-tests/.gitignore Added Cargo.lock to ignore.
Comments suppressed due to low confidence (1)

rust/ql/integration-tests/macro-expansion/test.ql:7

  • [nitpick] The predicate name macro_calls is very generic. Consider renaming it to resolved_macro_calls to clearly distinguish it from unexpanded_macro_calls.
query predicate macro_calls(MacroCall c, AstNode expansion) {

@redsun82
Copy link
Contributor Author

I've used this to raise an issue to rust-analyzer: rust-lang/rust-analyzer#19873

Copy link
Contributor

@geoffw0 geoffw0 left a comment

Choose a reason for hiding this comment

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

LGTM

@redsun82 redsun82 merged commit 7d1a38f into main May 28, 2025
16 checks passed
@redsun82 redsun82 deleted the redsun82/rust-new-macro-expansion-integration-test branch May 28, 2025 15:19
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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.