-
Notifications
You must be signed in to change notification settings - Fork 12.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #90267 - EliseZeroTwo:elisezerotwo/fix_invalid_attrs_…
…ice, r=Aaron1011 fix: inner attribute followed by outer attribute causing ICE Fixes #87936, #88938, and #89971. This removes the assertion that validates that there are no outer attributes following inner attributes. Where the inner attribute is invalid you get an actual error.
- Loading branch information
Showing
4 changed files
with
46 additions
and
6 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
13 changes: 13 additions & 0 deletions
13
src/test/ui/parser/auxiliary/issue-89971-outer-attr-following-inner-attr-ice.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,13 @@ | ||
// force-host | ||
// no-prefer-dynamic | ||
|
||
#![crate_type = "proc-macro"] | ||
|
||
extern crate proc_macro; | ||
|
||
use proc_macro::TokenStream; | ||
|
||
#[proc_macro_derive(ICE)] | ||
pub fn derive(_: TokenStream) -> TokenStream { | ||
r#"#[allow(missing_docs)] struct X { }"#.parse().unwrap() | ||
} |
15 changes: 15 additions & 0 deletions
15
src/test/ui/parser/issue-89971-outer-attr-following-inner-attr-ice.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,15 @@ | ||
// aux-build:issue-89971-outer-attr-following-inner-attr-ice.rs | ||
|
||
#[macro_use] | ||
extern crate issue_89971_outer_attr_following_inner_attr_ice; | ||
|
||
fn main() { | ||
Mew(); | ||
X {}; | ||
} | ||
|
||
#![deny(missing_docs)] | ||
//~^ ERROR an inner attribute is not permitted in this context | ||
#[derive(ICE)] | ||
#[deny(missing_docs)] | ||
struct Mew(); |
18 changes: 18 additions & 0 deletions
18
src/test/ui/parser/issue-89971-outer-attr-following-inner-attr-ice.stderr
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 @@ | ||
error: an inner attribute is not permitted in this context | ||
--> $DIR/issue-89971-outer-attr-following-inner-attr-ice.rs:11:1 | ||
| | ||
LL | #![deny(missing_docs)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^ | ||
... | ||
LL | struct Mew(); | ||
| ------------- the inner attribute doesn't annotate this struct | ||
| | ||
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files | ||
help: to annotate the struct, change the attribute from inner to outer style | ||
| | ||
LL - #![deny(missing_docs)] | ||
LL + #[deny(missing_docs)] | ||
| | ||
|
||
error: aborting due to previous error | ||
|