Skip to content

#![allow(non_upper_case_globals)] not working correctly in proc macros #15344

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

Open
sunmy2019 opened this issue Jul 27, 2023 · 9 comments · Fixed by #15601
Open

#![allow(non_upper_case_globals)] not working correctly in proc macros #15344

sunmy2019 opened this issue Jul 27, 2023 · 9 comments · Fixed by #15601
Labels
A-diagnostics diagnostics / error reporting A-macro macro expansion C-bug Category: bug

Comments

@sunmy2019
Copy link

rust-analyzer version: rust-analyzer version: 0.3.1599-standalone

rustc version: rustc 1.68.2 (9eb3afe9e 2023-03-27)

relevant settings: num_enum == 0.6.1

It is erroneously diagnosing it as nonupper case globals. cargo build and cargo check works without any warnings.

image

image

I tried the built-in macro expand. That line does exist.

image

If I copied that expansion to the source code directly, everything works fine.

image

It looks like the allow implementation is wrong.

@sunmy2019 sunmy2019 added the C-bug Category: bug label Jul 27, 2023
@sunmy2019
Copy link
Author

I suspect changes in #15320 exposed this bug.

@lowr
Copy link
Contributor

lowr commented Jul 27, 2023

I'd say this is a duplicate of #6541, but we may want to suppress the warning that originates in macro expansions.

@lowr lowr added A-macro macro expansion A-diagnostics diagnostics / error reporting labels Jul 27, 2023
@HKalbasi
Copy link
Member

I tried to ignore diagnostics from proc macros in #14990 since rustc ignores them (rustc doesn't ignore all of them, but I didn't find out what rustc exactly does). @sunmy2019 Can you try to see if it happens in that commit as well?

@sunmy2019
Copy link
Author

@sunmy2019 Can you try to see if it happens in that commit as well?

I don't get it. v0.3.1599 contains that commit 45272ef already.

@HKalbasi
Copy link
Member

I want to see if it worked then originally and regressed later, or it didn't work even then.

@sunmy2019
Copy link
Author

I can confirm that rust-analyzer 0.3.1591-standalone is working as expected.

@huntc
Copy link
Contributor

huntc commented Aug 25, 2023

Howdy. Is there a known work-around to this issue? Thanks.

@sunmy2019
Copy link
Author

Howdy. Is there a known work-around to this issue? Thanks.

I added a global #![allow(...)] for it.

@tgross35
Copy link
Contributor

tgross35 commented Oct 2, 2023

@Veykril it seems like your fix may have only corrected derive macros, I am still hitting this error with functionlike macros. Should this issue remain open, or does that seem incorrect?

Using v0.3.1673

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics diagnostics / error reporting A-macro macro expansion C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants