Skip to content

Instantly share code, notes, and snippets.

@luqmana
Created May 6, 2022 20:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luqmana/a5d5ae26e09c733f5c3bbe9811510cfb to your computer and use it in GitHub Desktop.
Save luqmana/a5d5ae26e09c733f5c3bbe9811510cfb to your computer and use it in GitHub Desktop.
[package]
name = "foo"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
/// My `foo` macro!
///
/// ```compile_fail
/// # #[macro_use] extern crate foo;
/// # fn main() {
/// foo!();
/// # }
/// ```
#[macro_export]
macro_rules! foo {
() => {
// invalid syntax
if {}
}
}
@luqmana
Copy link
Author

luqmana commented May 6, 2022

$ cargo test --doc
    Finished test [unoptimized + debuginfo] target(s) in 0.00s
   Doc-tests foo

running 1 test
test src/lib.rs - foo (line 4) - compile fail ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment