From e1ebf4e3800b939e35e1c167626ba5a9d82d7e5e Mon Sep 17 00:00:00 2001 From: John-John Tedro Date: Sat, 6 May 2023 11:21:39 +0200 Subject: [PATCH] Macro doesn't play well with doc comments --- crates/rune/src/ast.rs | 4 +++- crates/rune/src/compile/module.rs | 1 + crates/rune/src/macros.rs | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/rune/src/ast.rs b/crates/rune/src/ast.rs index 4a0d96d38..96b9d6912 100644 --- a/crates/rune/src/ast.rs +++ b/crates/rune/src/ast.rs @@ -23,6 +23,7 @@ //! Ok(quote!(#string).into_token_stream(ctx)) //! } //! +//! # fn main() -> rune::Result<()> { //! let mut m = Module::new(); //! m.macro_meta(ident_to_string)?; //! @@ -50,7 +51,8 @@ //! let value: String = rune::from_value(value)?; //! //! assert_eq!(value, "hello"); -//! # Ok::<_, rune::Error>(()) +//! # Ok(()) +//! # } //! ``` use crate::macros::{MacroContext, ToTokens, TokenStream}; diff --git a/crates/rune/src/compile/module.rs b/crates/rune/src/compile/module.rs index 6d084bb7e..dd3d6b90f 100644 --- a/crates/rune/src/compile/module.rs +++ b/crates/rune/src/compile/module.rs @@ -737,6 +737,7 @@ impl Module { /// /// let mut m = Module::new(); /// m.macro_meta(ident_to_string)?; + /// Ok::<_, rune::Error>(()) /// ``` #[inline] pub fn macro_meta(&mut self, meta: MacroMeta) -> Result<(), ContextError> { diff --git a/crates/rune/src/macros.rs b/crates/rune/src/macros.rs index c57032b47..07859b9ae 100644 --- a/crates/rune/src/macros.rs +++ b/crates/rune/src/macros.rs @@ -39,6 +39,7 @@ //! Ok(quote!(#output).into_token_stream(ctx)) //! } //! +//! # fn main() -> rune::Result<()> { //! let mut m = Module::new(); //! m.macro_meta(concat_idents)?; //! @@ -67,7 +68,8 @@ //! let value: u32 = rune::from_value(value)?; //! //! assert_eq!(value, 42); -//! # Ok::<_, rune::Error>(()) +//! # Ok(()) +//! # } //! ``` mod format_args;