Skip to content

Ignore file!() macro in print_literal, write_literal #10573

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
Mar 30, 2023

Conversation

Alexendoo
Copy link
Member

changelog: [print_literal], [write_literal]: Ignore the file!() macro

file!() expands to a string literal with its span set to that of the file!() callsite, but isn't marked as coming from an expansion. To fix this we make sure we actually find a string/char literal instead of assuming it's one and slicing

It would also ignore any other macros that result in the same situation, but that shouldn't be common as proc_macro::Span::call_site() returns a span that is marked as from expansion

Fixes #10544

@rustbot
Copy link
Collaborator

rustbot commented Mar 30, 2023

r? @Jarcho

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Mar 30, 2023
@Jarcho
Copy link
Contributor

Jarcho commented Mar 30, 2023

Looks good. @bors r+

@bors
Copy link
Contributor

bors commented Mar 30, 2023

📌 Commit 17f8045 has been approved by Jarcho

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Mar 30, 2023

⌛ Testing commit 17f8045 with merge d43714a...

@bors
Copy link
Contributor

bors commented Mar 30, 2023

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: Jarcho
Pushing d43714a to master...

@bors bors merged commit d43714a into rust-lang:master Mar 30, 2023
@Alexendoo Alexendoo deleted the print-literal-file-macro branch March 30, 2023 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

False positive for file!() macro in println
4 participants