rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
14.19k stars 1.59k forks source link

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

Open lf- opened 3 years ago

lf- commented 3 years ago

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- commented 3 years ago

~cause is #8911 possibly

jonas-schievink commented 2 years ago

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

Pistonight commented 8 months ago

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