Skip to content

Teach the parser to associate the mod hierarchy in a file with directories #4117

Closed
@brson

Description

@brson

As part of #2176 I removed directory modules from the language. As a result, crates make heavy use of #[path] to create directory structure.

Right now we have this pattern in some crates:

mod foo {
  #[path = "foo/bar.rs"]
  mod bar;
}

foo is a directory and a module containing no external source, but the parser doesn't know that foo is a directory and tries to load bar from bar.rs instead of foo/bar.rs. It probably makes sense to track a stack of module names in the parser and use them to decide the path to external modules. I didn't implement this at the time because it seemed like some odd state for the parser to maintain, but it is probably what people expect.

Metadata

Metadata

Assignees

Labels

E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions