Skip to content

Should modules with path attribute become directory owners automatically? #32401

Closed
@matklad

Description

@matklad

Consider this layout

// main.rs
mod foo;
fn main() {}

// foo.rs
mod bar;

// bar.rs
// empty

It generates cannot declare a new module at this location error for mod bar;, which is good.

However, If I explicitly specify #[path = ] for mod foo; it compiles:

// main.rs
#[path = "foo.rs"]
mod foo;
fn main() {}

// foo.rs
mod bar;

// bar.rs
// empty

I don't know if this is expected behavior or not, but it looks suspicious to me .

Metadata

Metadata

Assignees

Labels

A-parserArea: The lexing & parsing of Rust source code to an ASTE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-help-wantedCall for participation: Help is requested to fix this issue.P-mediumMedium priorityT-langRelevant to the language team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions