We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 43d3470 commit aef682aCopy full SHA for aef682a
compiler/rustc_macros/src/lib.rs
@@ -41,6 +41,19 @@ pub fn symbols(input: TokenStream) -> TokenStream {
41
symbols::symbols(input.into()).into()
42
}
43
44
+/// Derive an extension trait for a given impl block. The trait name
45
+/// goes into the parenthesized args of the macro, for greppability.
46
+/// For example:
47
+/// ```
48
+/// #[extension(pub trait Foo)]
49
+/// impl i32 { fn hello() {} }
50
51
+///
52
+/// expands to:
53
54
+/// pub trait Foo { fn hello(); }
55
+/// impl Foo for i32 { fn hello() {} }
56
57
#[proc_macro_attribute]
58
pub fn extension(attr: TokenStream, input: TokenStream) -> TokenStream {
59
extension::extension(attr, input)
0 commit comments