rust-analyzer icon indicating copy to clipboard operation
rust-analyzer copied to clipboard

incorrect-ident-case triggers on traits inside functions even when #[allow()]ed

Open lf- opened this issue 3 years ago • 3 comments

As I understand it, this is an issue where our AST doesn't properly resolve parent items of functions inside traits inside functions.

This is a known but currently (as far as i know) untracked bug, and I wrote a test for it here last time I was working on this diagnostic: https://github.com/rust-analyzer/rust-analyzer/blob/1f1a1ce4f57076be38d18f0a6defddb9c690bb1c/crates/hir_ty/src/diagnostics/decl_check.rs#L959

There's some discussion of this in #8432 also.

The practical effect of this bug is that there are spurious diagnostics thrown by RA from the bitflags crate that emits these constructs from its macro that should actually be disabled.

lf- avatar May 06 '21 23:05 lf-

~cause is #8911 possibly

lf- avatar May 25 '21 07:05 lf-

#8911 is now fixed.

Before that, the test was moved and behavior changed:

https://github.com/rust-analyzer/rust-analyzer/blob/393cbd0982707a20b0ef40277385737f8de1833e/crates/ide_diagnostics/src/handlers/incorrect_case.rs#L343-L366

jonas-schievink avatar Nov 29 '21 16:11 jonas-schievink

It seems like incorrect case warnings are also triggered inside #[automatically_derived]. See https://github.com/madonoharu/tsify/issues/42

Pistonight avatar Feb 14 '24 04:02 Pistonight