Skip to content

Commit 027395d

Browse files
committed
Replace 'non-inline module' with 'external module'
1 parent 3b35f51 commit 027395d

File tree

7 files changed

+20
-20
lines changed

7 files changed

+20
-20
lines changed

compiler/rustc_expand/messages.ftl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ expand_module_file_not_found =
118118
.note = if there is a `mod {$name}` elsewhere in the crate already, import it with `use crate::...` instead
119119
120120
expand_module_in_block =
121-
cannot declare a non-inline module inside a block unless it has a path attribute
121+
cannot declare an external module inside a block unless it has a path attribute
122122
.help = maybe `use` the module `{$name}` instead of redeclaring it
123-
.note = modules are usually placed outside of blocks, at the top level of the file
123+
.note = external modules are usually placed outside of blocks, at the top level of the file
124124
125125
expand_module_multiple_candidates =
126126
file for module `{$name}` found at both "{$default_path}" and "{$secondary_path}"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Test that external modules are not allowed inside blocks.
2+
3+
fn main() {
4+
mod foo; //~ ERROR cannot declare an external module inside a block unless it has a path attribute
5+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: cannot declare an external module inside a block unless it has a path attribute
2+
--> $DIR/external-mod-restriction.rs:4:5
3+
|
4+
LL | mod foo;
5+
| ^^^^^^^^
6+
|
7+
= note: external modules are usually placed outside of blocks, at the top level of the file
8+
9+
error: aborting due to 1 previous error
10+

tests/ui/directory_ownership/macro-expanded-mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
macro_rules! mod_decl {
44
($i:ident) => {
5-
mod $i; //~ ERROR cannot declare a non-inline module inside a block unless it has a path attribute
5+
mod $i; //~ ERROR cannot declare an external module inside a block unless it has a path attribute
66
};
77
}
88

tests/ui/directory_ownership/macro-expanded-mod.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: cannot declare a non-inline module inside a block unless it has a path attribute
1+
error: cannot declare an external module inside a block unless it has a path attribute
22
--> $DIR/macro-expanded-mod.rs:5:9
33
|
44
LL | mod $i;
@@ -7,7 +7,7 @@ LL | mod $i;
77
LL | mod_decl!(foo);
88
| -------------- in this macro invocation
99
|
10-
= note: modules are usually placed outside of blocks, at the top level of the file
10+
= note: external modules are usually placed outside of blocks, at the top level of the file
1111
= note: this error originates in the macro `mod_decl` (in Nightly builds, run with -Z macro-backtrace for more info)
1212

1313
error: aborting due to 1 previous error

tests/ui/directory_ownership/non-inline-mod-restriction.rs

Lines changed: 0 additions & 5 deletions
This file was deleted.

tests/ui/directory_ownership/non-inline-mod-restriction.stderr

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)