File tree 7 files changed +9
-30
lines changed
compile-fail/directory_ownership
run-pass/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod
some_crazy_attr_mod_dir/inner_modrs_mod
7 files changed +9
-30
lines changed Original file line number Diff line number Diff line change @@ -5876,10 +5876,14 @@ impl<'a> Parser<'a> {
5876
5876
if let Some ( path) = Parser :: submod_path_from_attr ( outer_attrs, & self . directory . path ) {
5877
5877
return Ok ( ModulePathSuccess {
5878
5878
directory_ownership : match path. file_name ( ) . and_then ( |s| s. to_str ( ) ) {
5879
- Some ( "mod.rs" ) => DirectoryOwnership :: Owned { relative : None } ,
5880
- Some ( _) => {
5881
- DirectoryOwnership :: Owned { relative : Some ( id) }
5882
- }
5879
+ // All `#[path]` files are treated as though they are a `mod.rs` file.
5880
+ // This means that `mod foo;` declarations inside `#[path]`-included
5881
+ // files are siblings,
5882
+ //
5883
+ // Note that this will produce weirdness when a file named `foo.rs` is
5884
+ // `#[path]` included and contains a `mod foo;` declaration.
5885
+ // If you encounter this, it's your own darn fault :P
5886
+ Some ( _) => DirectoryOwnership :: Owned { relative : None } ,
5883
5887
_ => DirectoryOwnership :: UnownedViaMod ( true ) ,
5884
5888
} ,
5885
5889
path,
Load Diff This file was deleted.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change @@ -34,14 +34,5 @@ error: mod statements in non-mod.rs files are unstable (see issue #44660)
34
34
= help: add #![feature(non_modrs_mods)] to the crate attributes to enable
35
35
= help: on stable builds, rename this file to inner_foors_mod/mod.rs
36
36
37
- error: mod statements in non-mod.rs files are unstable (see issue #44660)
38
- --> $DIR/some_crazy_attr_mod_dir/arbitrary_name.rs:11:9
39
- |
40
- 11 | pub mod inner_modrs_mod;
41
- | ^^^^^^^^^^^^^^^
42
- |
43
- = help: add #![feature(non_modrs_mods)] to the crate attributes to enable
44
- = help: on stable builds, rename this file to attr_mod/mod.rs
45
-
46
- error: aborting due to 5 previous errors
37
+ error: aborting due to 4 previous errors
47
38
File renamed without changes.
File renamed without changes.
You can’t perform that action at this time.
0 commit comments