-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
expand: Resolve and expand inner attributes on out-of-line modules
- Loading branch information
1 parent
84c08f8
commit a4cc3ca
Showing
12 changed files
with
230 additions
and
32 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1111,6 +1111,7 @@ symbols! { | |
size_of, | ||
size_of_val, | ||
sized, | ||
skip, | ||
slice, | ||
slice_alloc, | ||
slice_patterns, | ||
|
7 changes: 7 additions & 0 deletions
7
src/test/ui/conditional-compilation/inner-cfg-non-inline-mod.rs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// check-pass | ||
|
||
mod module_with_cfg; | ||
|
||
mod module_with_cfg {} // Ok, the module above is configured away by an inner attribute. | ||
|
||
fn main() {} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// ignore-test | ||
|
||
#![cfg_attr(all(), cfg(FALSE))] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// compile-flags: -Z span-debug | ||
// error-pattern:custom inner attributes are unstable | ||
// error-pattern:inner macro attributes are unstable | ||
// error-pattern:this was previously accepted | ||
// aux-build:test-macros.rs | ||
|
||
#![no_std] // Don't load unnecessary hygiene information from std | ||
extern crate std; | ||
|
||
#[macro_use] | ||
extern crate test_macros; | ||
|
||
#[deny(unused_attributes)] | ||
mod module_with_attrs; | ||
//~^ ERROR non-inline modules in proc macro input are unstable | ||
//~| ERROR custom inner attributes are unstable | ||
|
||
fn main() {} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
error[E0658]: inner macro attributes are unstable | ||
--> $DIR/module_with_attrs.rs:4:4 | ||
| | ||
LL | #![print_attr] | ||
| ^^^^^^^^^^ | ||
| | ||
= note: see issue #54726 <https://github.com/rust-lang/rust/issues/54726> for more information | ||
= help: add `#![feature(custom_inner_attributes)]` to the crate attributes to enable | ||
|
||
error[E0658]: non-inline modules in proc macro input are unstable | ||
--> $DIR/inner-attr-non-inline-mod.rs:14:1 | ||
| | ||
LL | mod module_with_attrs; | ||
| ^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #54727 <https://github.com/rust-lang/rust/issues/54727> for more information | ||
= help: add `#![feature(proc_macro_hygiene)]` to the crate attributes to enable | ||
|
||
error[E0658]: custom inner attributes are unstable | ||
--> $DIR/inner-attr-non-inline-mod.rs:14:1 | ||
| | ||
LL | mod module_with_attrs; | ||
| ^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #54726 <https://github.com/rust-lang/rust/issues/54726> for more information | ||
= help: add `#![feature(custom_inner_attributes)]` to the crate attributes to enable | ||
|
||
error: custom inner attributes are unstable | ||
--> $DIR/module_with_attrs.rs:3:4 | ||
| | ||
LL | #![rustfmt::skip] | ||
| ^^^^^^^^^^^^^ | ||
| | ||
= note: `#[deny(soft_unstable)]` on by default | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #64266 <https://github.com/rust-lang/rust/issues/64266> | ||
|
||
error: aborting due to 4 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0658`. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
PRINT-ATTR INPUT (DISPLAY): #[deny(unused_attributes)] mod module_with_attrs { # ! [rustfmt :: skip] } | ||
PRINT-ATTR INPUT (DEBUG): TokenStream [ | ||
Punct { | ||
ch: '#', | ||
spacing: Alone, | ||
span: $DIR/inner-attr-non-inline-mod.rs:14:1: 14:23 (#0), | ||
}, | ||
Group { | ||
delimiter: Bracket, | ||
stream: TokenStream [ | ||
Ident { | ||
ident: "deny", | ||
span: $DIR/inner-attr-non-inline-mod.rs:14:1: 14:23 (#0), | ||
}, | ||
Group { | ||
delimiter: Parenthesis, | ||
stream: TokenStream [ | ||
Ident { | ||
ident: "unused_attributes", | ||
span: $DIR/inner-attr-non-inline-mod.rs:14:1: 14:23 (#0), | ||
}, | ||
], | ||
span: $DIR/inner-attr-non-inline-mod.rs:14:1: 14:23 (#0), | ||
}, | ||
], | ||
span: $DIR/inner-attr-non-inline-mod.rs:14:1: 14:23 (#0), | ||
}, | ||
Ident { | ||
ident: "mod", | ||
span: $DIR/inner-attr-non-inline-mod.rs:14:1: 14:23 (#0), | ||
}, | ||
Ident { | ||
ident: "module_with_attrs", | ||
span: $DIR/inner-attr-non-inline-mod.rs:14:1: 14:23 (#0), | ||
}, | ||
Group { | ||
delimiter: Brace, | ||
stream: TokenStream [ | ||
Punct { | ||
ch: '#', | ||
spacing: Joint, | ||
span: $DIR/inner-attr-non-inline-mod.rs:14:1: 14:23 (#0), | ||
}, | ||
Punct { | ||
ch: '!', | ||
spacing: Alone, | ||
span: $DIR/inner-attr-non-inline-mod.rs:14:1: 14:23 (#0), | ||
}, | ||
Group { | ||
delimiter: Bracket, | ||
stream: TokenStream [ | ||
Ident { | ||
ident: "rustfmt", | ||
span: $DIR/inner-attr-non-inline-mod.rs:14:1: 14:23 (#0), | ||
}, | ||
Punct { | ||
ch: ':', | ||
spacing: Joint, | ||
span: $DIR/inner-attr-non-inline-mod.rs:14:1: 14:23 (#0), | ||
}, | ||
Punct { | ||
ch: ':', | ||
spacing: Alone, | ||
span: $DIR/inner-attr-non-inline-mod.rs:14:1: 14:23 (#0), | ||
}, | ||
Ident { | ||
ident: "skip", | ||
span: $DIR/inner-attr-non-inline-mod.rs:14:1: 14:23 (#0), | ||
}, | ||
], | ||
span: $DIR/inner-attr-non-inline-mod.rs:14:1: 14:23 (#0), | ||
}, | ||
], | ||
span: $DIR/inner-attr-non-inline-mod.rs:14:1: 14:23 (#0), | ||
}, | ||
] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// ignore-test | ||
|
||
#![rustfmt::skip] | ||
#![print_attr] |