Skip to content

Commit 7f0d43a

Browse files
committed
test: add test for inner attribute followed by outer attribute causing ICE
1 parent 7402eb0 commit 7f0d43a

3 files changed

+46
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// force-host
2+
// no-prefer-dynamic
3+
4+
#![crate_type = "proc-macro"]
5+
6+
extern crate proc_macro;
7+
8+
use proc_macro::TokenStream;
9+
10+
#[proc_macro_derive(ICE)]
11+
pub fn derive(_: TokenStream) -> TokenStream {
12+
r#"#[allow(missing_docs)] struct X { }"#.parse().unwrap()
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// aux-build:issue-89971-outer-attr-following-inner-attr-ice.rs
2+
3+
#[macro_use]
4+
extern crate issue_89971_outer_attr_following_inner_attr_ice;
5+
6+
fn main() {
7+
Mew();
8+
X {};
9+
}
10+
11+
#![deny(missing_docs)]
12+
//~^ ERROR an inner attribute is not permitted in this context
13+
#[derive(ICE)]
14+
#[deny(missing_docs)]
15+
struct Mew();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
error: an inner attribute is not permitted in this context
2+
--> $DIR/issue-89971-outer-attr-following-inner-attr-ice.rs:11:1
3+
|
4+
LL | #![deny(missing_docs)]
5+
| ^^^^^^^^^^^^^^^^^^^^^^
6+
...
7+
LL | struct Mew();
8+
| ------------- the inner attribute doesn't annotate this struct
9+
|
10+
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
11+
help: to annotate the struct, change the attribute from inner to outer style
12+
|
13+
LL - #![deny(missing_docs)]
14+
LL + #[deny(missing_docs)]
15+
|
16+
17+
error: aborting due to previous error
18+

0 commit comments

Comments
 (0)