forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
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 rust-lang#132651 - PonasKovas:master, r=fmease Remove attributes from generics in built-in derive macros Related issue rust-lang#132561 Removes all attributes from generics in the expanded implementations of built-in derive macros.
- Loading branch information
Showing
3 changed files
with
37 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
//@ force-host | ||
//@ no-prefer-dynamic | ||
|
||
#![crate_type = "proc-macro"] | ||
|
||
extern crate proc_macro; | ||
|
||
// Doesn't do anything, but has a helper attribute. | ||
#[proc_macro_derive(WithHelperAttr, attributes(x))] | ||
pub fn derive(_input: proc_macro::TokenStream) -> proc_macro::TokenStream { | ||
proc_macro::TokenStream::new() | ||
} |
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,19 @@ | ||
// This test checks that helper attributes of a derive proc macro can be used together with | ||
// other built-in derive macros. | ||
// issue: rust-lang/rust#132561 | ||
//@ check-pass | ||
//@ aux-build:helper-attr.rs | ||
//@ edition:2021 | ||
|
||
#[macro_use] | ||
extern crate helper_attr; | ||
|
||
use helper_attr::WithHelperAttr; | ||
|
||
#[derive(WithHelperAttr, Debug, Clone, PartialEq)] | ||
struct MyStruct<#[x] 'a, #[x] const A: usize, #[x] B> { | ||
#[x] | ||
field: &'a [B; A], | ||
} | ||
|
||
fn main() {} |