Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
brson opened this issue Dec 5, 2012 · 3 comments
Closed
Assignees
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Milestone

Comments

@brson
Copy link
Contributor

brson commented Dec 5, 2012

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.

@ghost ghost assigned brson Dec 5, 2012
@graydon
Copy link
Contributor

graydon commented Dec 11, 2012

Agree. Also ideally one should be able to influence the associated dirname by sticking #[path = "foo_dir"] on mod foo { ... }, as one can with the leaf filenames.

@graydon
Copy link
Contributor

graydon commented Dec 18, 2012

Done enough. Minor cleanups remain.

@graydon graydon closed this as completed Dec 18, 2012
@brson
Copy link
Contributor Author

brson commented Dec 19, 2012

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

2 participants