Skip to content

Nonsensical #[path] attributes are allowed. #157260

Description

@theemathas

The following code compiles without errors:

#[path = "foo.rs"]
mod sub {}

The following code also compiles without errors, when the code is put into a submodule file:

#![path = "foo.rs"]

In both cases, the attribute seems to do nothing. They probably shouldn't compile.

cc @JonathanBrouwer @jdonszelmann

Meta

rustc version 1.96.0

Metadata

Metadata

Assignees

Labels

A-attributesArea: Attributes (`#[…]`, `#![…]`)C-bugCategory: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions