Conversation
Contributor
There was a problem hiding this comment.
When does the self.module_name branch get taken? I.e. shouldn't mod_path_stack always have the current module at the end?
Contributor
There was a problem hiding this comment.
Oh, I see, it's just used for the recursive parse thing. Shouldn't the recursive parser just push to mod_path_stack? (If not, could module_name be changed to be called something slightly less general?)
Member
Author
There was a problem hiding this comment.
Added some comments to the field and renamed to root_module_name. The recursive parser doesn't share the parent's mod_path_stack, and pushing onto the stack would mess with further mod foo; declarations (appending an extra component on the path).
This is an implementation of RFC 16. A module can now only be loaded if the
module declaring `mod name;` "owns" the current directory. A module is
considered as owning its directory if it meets one of the following criteria:
* It is the top-level crate file
* It is a `mod.rs` file
* It was loaded via `#[path]`
* It was loaded via `include!`
* The module was declared via an inline `mod foo { ... }` statement
For example, this directory structure is now invalid
// lib.rs
mod foo;
// foo.rs
mod bar;
// bar.rs;
fn bar() {}
With this change `foo.rs` must be renamed to `foo/mod.rs`, and `bar.rs` must be
renamed to `foo/bar.rs`. This makes it clear that `bar` is a submodule of `foo`,
and can only be accessed through `foo`.
RFC: 0016-module-file-system-hierarchy
Closes rust-lang#14180
[breaking-change]
bors
added a commit
that referenced
this pull request
May 19, 2014
This is an implementation of RFC 16. A module can now only be loaded if the
module declaring `mod name;` "owns" the current directory. A module is
considered as owning its directory if it meets one of the following criteria:
* It is the top-level crate file
* It is a `mod.rs` file
* It was loaded via `#[path]`
* It was loaded via `include!`
* The module was declared via an inline `mod foo { ... }` statement
For example, this directory structure is now invalid
// lib.rs
mod foo;
// foo.rs
mod bar;
// bar.rs;
fn bar() {}
With this change `foo.rs` must be renamed to `foo/mod.rs`, and `bar.rs` must be
renamed to `foo/bar.rs`. This makes it clear that `bar` is a submodule of `foo`,
and can only be accessed through `foo`.
RFC: 0016-module-file-system-hierarchy
Closes #14180
[breaking-change]
lnicola
pushed a commit
to lnicola/rust
that referenced
this pull request
Mar 13, 2023
internal: Set expectation for no-semi expression statements to unit
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jun 5, 2023
…ykril fix: unify types in `infer_expr_coerce_never()` Fixes rust-lang#14506 rust-lang#14506 turned out to be a regression in type inference. `infer_expr_coerce_never()` added in rust-lang#14251 allows never-to-any coercion but should also perform ordinary type unification in other cases.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is an implementation of RFC 16. A module can now only be loaded if the
module declaring
mod name;"owns" the current directory. A module isconsidered as owning its directory if it meets one of the following criteria:
mod.rsfile#[path]include!mod foo { ... }statementFor example, this directory structure is now invalid
With this change
foo.rsmust be renamed tofoo/mod.rs, andbar.rsmust berenamed to
foo/bar.rs. This makes it clear thatbaris a submodule offoo,and can only be accessed through
foo.RFC: 0016-module-file-system-hierarchy
Closes #14180
[breaking-change]