forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
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
fe1bf8e
commit df78eea
Showing
9 changed files
with
226 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
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,17 @@ | ||
// compile-flags: -Z span-debug | ||
// error-pattern:custom inner attributes are unstable | ||
// error-pattern:inner macro attributes are unstable | ||
// 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,39 @@ | ||
error[E0658]: custom inner attributes are unstable | ||
--> $DIR/module_with_attrs.rs:3:4 | ||
| | ||
LL | #![rustfmt::skip] | ||
| ^^^^^^^^^^^^^ | ||
| | ||
= 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]: 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:13: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:13: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: 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:13:1: 13:23 (#0), | ||
}, | ||
Group { | ||
delimiter: Bracket, | ||
stream: TokenStream [ | ||
Ident { | ||
ident: "deny", | ||
span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0), | ||
}, | ||
Group { | ||
delimiter: Parenthesis, | ||
stream: TokenStream [ | ||
Ident { | ||
ident: "unused_attributes", | ||
span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0), | ||
}, | ||
], | ||
span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0), | ||
}, | ||
], | ||
span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0), | ||
}, | ||
Ident { | ||
ident: "mod", | ||
span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0), | ||
}, | ||
Ident { | ||
ident: "module_with_attrs", | ||
span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0), | ||
}, | ||
Group { | ||
delimiter: Brace, | ||
stream: TokenStream [ | ||
Punct { | ||
ch: '#', | ||
spacing: Joint, | ||
span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0), | ||
}, | ||
Punct { | ||
ch: '!', | ||
spacing: Alone, | ||
span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0), | ||
}, | ||
Group { | ||
delimiter: Bracket, | ||
stream: TokenStream [ | ||
Ident { | ||
ident: "rustfmt", | ||
span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0), | ||
}, | ||
Punct { | ||
ch: ':', | ||
spacing: Joint, | ||
span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0), | ||
}, | ||
Punct { | ||
ch: ':', | ||
spacing: Alone, | ||
span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0), | ||
}, | ||
Ident { | ||
ident: "skip", | ||
span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0), | ||
}, | ||
], | ||
span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13:23 (#0), | ||
}, | ||
], | ||
span: $DIR/inner-attr-non-inline-mod.rs:13:1: 13: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] |