graydon/rust — Issue #1072: Allow items at the crate top level and in 'directory' modules
Author: brson
Created: 2011-10-25 23:08:07+00:00
State: open
Labels: feature, front

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.