Skip to content

Commit

Permalink
Add new no proc macro attribute as a no-op stub
Browse files Browse the repository at this point in the history
  • Loading branch information
speelbarrow committed Oct 25, 2023
1 parent 330c042 commit 64d0a0b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
12 changes: 12 additions & 0 deletions proc-macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,15 @@ fn main() { // Signature must be `fn main() -> !`
pub fn entry(attr: TokenStream, input: TokenStream) -> TokenStream {
entry::entry(attr, input)
}

mod no;
/// A stand-in for:
/// ``` no_run
/// #![cfg_attr(not(test), no_std)]
/// #![cfg_attr(not(test), no_main)]
/// ```
/// Should be used at the top of your `main.rs` file.
#[proc_macro_attribute]
pub fn no(attr: TokenStream, input: TokenStream) -> TokenStream {
no::no(attr, input)
}
5 changes: 5 additions & 0 deletions proc-macro/src/no.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
use proc_macro::TokenStream;

pub fn no(_attr: TokenStream, input: TokenStream) -> TokenStream {
input
}

0 comments on commit 64d0a0b

Please sign in to comment.