-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed as duplicate of#13156
Closed as duplicate of#13156
Copy link
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Code
#[path = "bar.rs"]
pub mod foo {}
Current output
no output
Desired output
warning: `#[path]` only has an effect on modules without bodies
--> src/lib.rs:1:1
|
1 | #[path = "bar.rs"]
| ^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_attributes)]` on by default
Rationale and extra context
A similar warning exists for other misuses of the attribute, like
#[path = "bar.rs"]
pub struct Foo;
(IMO, this misuse should eventually become a hard error, but that's not the point of this issue.)
Other cases
Rust Version
rustc 1.85.0-nightly (d49be02cf 2024-12-02)
binary: rustc
commit-hash: d49be02cf6d2e2a01264fcdef1e20c826710c0f5
commit-date: 2024-12-02
host: x86_64-unknown-linux-gnu
release: 1.85.0-nightly
LLVM version: 19.1.4
Anything else?
No response
Metadata
Metadata
Assignees
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.