Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
r? @graydon, @nikomatsakis
Working towards #2176
This series completely removes the special language for .rc files. It uses several hacks required until the next snapshot.
After this is completed .rc files will be parsed exactly the same as .rs files and companion mods will no longer exist, either at the crate level or directory level.
There's not a whole lot to review here, as it's just rewriting the crate files to use features compatible with the new model, but it is a big change.
There are two notable side-effects of this change:
The int-template and iter-trait hacks used a latent property of our directory companion mods to 'merge' the contents of two different files into a single module. In lieu of item macros this will be supported by a new parser hack that uses a
#[merge = "path/to/file.rs"]
attribute.There will no longer be any in-language notion of directory structure. Through ongoing discussions it's not obvious what the right solution to this is. In the meantime, crates can use
#[path = "path/to/file.rs"]
to impose any directory structure they want. I think this itself is a decent compromise, gives us room to experiment with the correct patterns here.In the medium-term, the rust repo itself will prefer the following pattern to create directory structure:
rustc.rc:
front/mod.rs:
Modules that are stored in directories will use a
mod.rs
file inside the directory (vs. today's code where the mod file is outside the directory).Transitional ugliness:
// DIVERT
are automatically parsed from a different file calledalternate_crate.rc
. This allows stage0 to continue using it's directory modules while stage1+ use the above described strategy.#[merge]
attribute, but these are transitional except for the ones in core that implement iter-trait, etc.