Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions compiler/rustc_expand/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ expand_feature_removed =
.note = removed in {$removed_rustc_version}{$pull_note}
.reason = {$reason}
expand_file_modules_in_proc_macro_input_are_unstable =
file modules in proc macro input are unstable
expand_glob_delegation_outside_impls =
glob delegation is only supported in impls
Expand Down Expand Up @@ -157,9 +160,6 @@ expand_mve_unrecognized_expr =
expand_mve_unrecognized_var =
variable `{$key}` is not recognized in meta-variable expression
expand_non_inline_modules_in_proc_macro_input_are_unstable =
non-inline modules in proc macro input are unstable
expand_or_patterns_back_compat = the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
.suggestion = use pat_param to preserve semantics
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_expand/src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
self.sess,
sym::proc_macro_hygiene,
item.span,
fluent_generated::expand_non_inline_modules_in_proc_macro_input_are_unstable,
fluent_generated::expand_file_modules_in_proc_macro_input_are_unstable,
)
.emit();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ Tests for miscellaneous suggestions.

## `tests/ui/directory_ownership/`: Declaring `mod` inside a block

Exercises diagnostics for when a code block attempts to gain ownership of a non-inline module with a `mod` keyword placed inside of it.
Exercises diagnostics for when a code block attempts to gain ownership of a file module with a `mod` keyword placed inside of it.

## `tests/ui/disallowed-deconstructing/`: Incorrect struct deconstruction

Expand Down
10 changes: 5 additions & 5 deletions tests/ui/proc-macro/attributes-on-modules-fail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ type A = X; //~ ERROR cannot find type `X` in this scope
mod n {}

#[empty_attr]
mod module; //~ ERROR non-inline modules in proc macro input are unstable
mod module; //~ ERROR file modules in proc macro input are unstable

#[empty_attr]
mod outer {
mod inner; //~ ERROR non-inline modules in proc macro input are unstable
mod inner; //~ ERROR file modules in proc macro input are unstable

mod inner_inline {} // OK
}
Expand All @@ -30,16 +30,16 @@ mod outer {
struct S {
field: [u8; {
#[path = "outer/inner.rs"]
mod inner; //~ ERROR non-inline modules in proc macro input are unstable
mod inner; //~ ERROR file modules in proc macro input are unstable
mod inner_inline {} // OK
0
}]
}],
}

#[identity_attr]
fn f() {
#[path = "outer/inner.rs"]
mod inner; //~ ERROR non-inline modules in proc macro input are unstable
mod inner; //~ ERROR file modules in proc macro input are unstable
mod inner_inline {} // OK
}

Expand Down
8 changes: 4 additions & 4 deletions tests/ui/proc-macro/attributes-on-modules-fail.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LL | #[derive(Copy)]
LL | mod n {}
| -------- not a `struct`, `enum` or `union`

error[E0658]: non-inline modules in proc macro input are unstable
error[E0658]: file modules in proc macro input are unstable
--> $DIR/attributes-on-modules-fail.rs:20:1
|
LL | mod module;
Expand All @@ -16,7 +16,7 @@ LL | mod module;
= help: add `#![feature(proc_macro_hygiene)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: non-inline modules in proc macro input are unstable
error[E0658]: file modules in proc macro input are unstable
--> $DIR/attributes-on-modules-fail.rs:24:5
|
LL | mod inner;
Expand All @@ -26,7 +26,7 @@ LL | mod inner;
= help: add `#![feature(proc_macro_hygiene)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: non-inline modules in proc macro input are unstable
error[E0658]: file modules in proc macro input are unstable
--> $DIR/attributes-on-modules-fail.rs:33:9
|
LL | mod inner;
Expand All @@ -36,7 +36,7 @@ LL | mod inner;
= help: add `#![feature(proc_macro_hygiene)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: non-inline modules in proc macro input are unstable
error[E0658]: file modules in proc macro input are unstable
--> $DIR/attributes-on-modules-fail.rs:42:5
|
LL | mod inner;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ extern crate test_macros;

#[deny(unused_attributes)]
mod module_with_attrs;
//~^ ERROR non-inline modules in proc macro input are unstable
//~^ ERROR file modules in proc macro input are unstable
//~| ERROR custom inner attributes are unstable

fn main() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ LL | #![print_attr]
= help: add `#![feature(custom_inner_attributes)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: non-inline modules in proc macro input are unstable
--> $DIR/inner-attr-non-inline-mod.rs:11:1
error[E0658]: file modules in proc macro input are unstable
--> $DIR/inner-attr-file-mod.rs:11:1
|
LL | mod module_with_attrs;
| ^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -29,7 +29,7 @@ LL | mod module_with_attrs;
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: custom inner attributes are unstable
--> $DIR/inner-attr-non-inline-mod.rs:11:1
--> $DIR/inner-attr-file-mod.rs:11:1
|
LL | mod module_with_attrs;
| ^^^^^^^^^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,74 +4,74 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [
Punct {
ch: '#',
spacing: Alone,
span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
span: $DIR/inner-attr-file-mod.rs:11:1: 11:23 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "deny",
span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
span: $DIR/inner-attr-file-mod.rs:11:1: 11:23 (#0),
},
Group {
delimiter: Parenthesis,
stream: TokenStream [
Ident {
ident: "unused_attributes",
span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
span: $DIR/inner-attr-file-mod.rs:11:1: 11:23 (#0),
},
],
span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
span: $DIR/inner-attr-file-mod.rs:11:1: 11:23 (#0),
},
],
span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
span: $DIR/inner-attr-file-mod.rs:11:1: 11:23 (#0),
},
Ident {
ident: "mod",
span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
span: $DIR/inner-attr-file-mod.rs:11:1: 11:23 (#0),
},
Ident {
ident: "module_with_attrs",
span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
span: $DIR/inner-attr-file-mod.rs:11:1: 11:23 (#0),
},
Group {
delimiter: Brace,
stream: TokenStream [
Punct {
ch: '#',
spacing: Joint,
span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
span: $DIR/inner-attr-file-mod.rs:11:1: 11:23 (#0),
},
Punct {
ch: '!',
spacing: Alone,
span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
span: $DIR/inner-attr-file-mod.rs:11:1: 11:23 (#0),
},
Group {
delimiter: Bracket,
stream: TokenStream [
Ident {
ident: "rustfmt",
span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
span: $DIR/inner-attr-file-mod.rs:11:1: 11:23 (#0),
},
Punct {
ch: ':',
spacing: Joint,
span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
span: $DIR/inner-attr-file-mod.rs:11:1: 11:23 (#0),
},
Punct {
ch: ':',
spacing: Alone,
span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
span: $DIR/inner-attr-file-mod.rs:11:1: 11:23 (#0),
},
Ident {
ident: "skip",
span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
span: $DIR/inner-attr-file-mod.rs:11:1: 11:23 (#0),
},
],
span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
span: $DIR/inner-attr-file-mod.rs:11:1: 11:23 (#0),
},
],
span: $DIR/inner-attr-non-inline-mod.rs:11:1: 11:23 (#0),
span: $DIR/inner-attr-file-mod.rs:11:1: 11:23 (#0),
},
]
Loading