Skip to content

Newly emitting non_snake_case warnings on output of derive macro #15394

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

Closed
spencerwilson opened this issue Aug 5, 2023 · 2 comments
Closed
Labels
C-bug Category: bug

Comments

@spencerwilson
Copy link

spencerwilson commented Aug 5, 2023

rust-analyzer version: rust-analyzer 0.3.1599-standalone (99718d0 2023-07-22)

rustc version: rustc 1.69.0 (84c898d65 2023-04-16)

Expected behavior

For a given rustc lint (e.g., non_snake_case), cargo check and rust-analyzer report the same set of warnings/errors for that lint. If one of them reports a violation, the other does, too.

Actual behavior

In my project,

  • cargo check reports no issues ✅
  • rust-analyzer 0.3.1591-standalone (d82451103 2023-07-16) reports no issues ✅
  • rust-analyzer 0.3.1599-standalone (99718d0c8 2023-07-22) reports warning instances of the rustc lint non_snake_case

Details

In my scenario I have a build.rs that generates a source file, which elsewhere I inline via tonic::include_proto!. For each instance in the generated code of #[derive(::prost::Message)], the newer rust-analyzer gives the following warning:

Function `ScalarWrapper` should have snake_case name, e.g. `scalar_wrapper`

The only occurrence of that identifier in the prost-derive source tree is here: https://github.com/tokio-rs/prost/blob/468c80cd343321d5d4b361febbeec832ab5228b6/prost-derive/src/field/mod.rs#L145-L153

Sorry, I won't have time in the next couple weeks to make a minimal repro. Hopefully this is enough info to give some ideas. Please let me know if there are any simple steps I can perform to help debug. Oh and if this is actually expected behavior, that's fine too, I can look into getting it resolved in prost-derive then.

@spencerwilson
Copy link
Author

Workaround for VS Code users: Set the following type of thing in in VS Code settings:

{
  "rust-analyzer.server.path": "/path/to/rust-analyzer-aarch64-apple-darwin-2023-07-16"
}

@lowr
Copy link
Contributor

lowr commented Aug 5, 2023

I believe this is the same issue as #15344. Closing as a duplicate, but thanks for the report!

For anyone interested, the warning seems to originate in this TokenStream.

@lowr lowr closed this as not planned Won't fix, can't repro, duplicate, stale Aug 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants