Skip to content

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

Closed
@brson

Description

@brson

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.

Metadata

Metadata

Assignees

Labels

A-frontendArea: Compiler frontend (errors, parsing and HIR)

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions