We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 4840785 + 62e7414 commit 94e459fCopy full SHA for 94e459f
compiler/rustc_macros/src/lib.rs
@@ -41,6 +41,20 @@ 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
+/// use rustc_macros::extension;
49
+/// #[extension(pub trait Foo)]
50
+/// impl i32 { fn hello() {} }
51
52
+///
53
+/// expands to:
54
55
+/// pub trait Foo { fn hello(); }
56
+/// impl Foo for i32 { fn hello() {} }
57
58
#[proc_macro_attribute]
59
pub fn extension(attr: TokenStream, input: TokenStream) -> TokenStream {
60
extension::extension(attr, input)
0 commit comments