Skip to content

Allow items at the crate top level and in 'directory' modules #1072

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

Closed
brson opened this issue Oct 25, 2011 · 1 comment
Closed

Allow items at the crate top level and in 'directory' modules #1072

brson opened this issue Oct 25, 2011 · 1 comment
Assignees
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR)

Comments

@brson
Copy link
Contributor

brson commented Oct 25, 2011

Currently, nothing lives in the top level of std, and directory modules like rustc::syntax can't contain code. We want especially for the standard library to define things like std::option::t as std::option.

This is one way to achieve that goal.

We add a convention that a .rs file with the same name as a directory module provides that module's implementation, and a .rs file with the same name as a crate (or the .rc file) provides the crate-level module's implementation.

So for standard we might have a directory layout like:

lib/
  coll.rs - the std::coll module's implementation
  coll/
    list.rs - the std::coll::list module
  std.rc
  std.rs the std module's implementation

We would probably want a way to explicitly override this as well.

@ghost ghost assigned brson Oct 27, 2011
@brson
Copy link
Contributor Author

brson commented Oct 29, 2011

Implemented in e0f4473

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR)
Projects
None yet
Development

No branches or pull requests

1 participant