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

Attributes like #![allow(non_camel_case_types)] not recognized in files included using `include!()` macro

Open NessajCN opened this issue 6 months ago • 0 comments

rust-analyzer version: 0.4.2071-standalone [/home/nessaj/.vscode/extensions/rust-lang.rust-analyzer-0.4.2071-linux-x64/server/rust-analyzer]

rustc version: rustc 1.80.1 (3f5fd8dd4 2024-08-06)

editor or extension: VSCode 1.92.1, rust-analyzer v0.4.2071 (pre-release)

relevant settings:

repository link (if public, optional):

code snippet to reproduce:

// src/lib.rs
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
include!("./xx.rs");
// src/xx.rs
pub type __u_char = ::std::os::raw::c_uchar;

After #17863 has been applied it seemed r-a did not recognize the following attributes correctly in lib.rs that using include!() macro:

// src/lib.rs
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
include!("./xx.rs");

Warnings like Type alias __u_char should have CamelCase name, e.g. UChar still popped up in included files like xx.rs ablove.

NessajCN avatar Aug 13 '24 06:08 NessajCN