From 3d286e99556b5fca26a0fea5cf5df2bbbbb14f9f Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Tue, 27 Feb 2024 20:48:37 +0100 Subject: [PATCH] docs: fix uint! docs --- Cargo.toml | 2 +- src/lib.rs | 6 ++++++ src/macros.rs | 5 +++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6820bb4..d2a20fd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ description = "Unsigned integer type with const-generic bit length" version = "1.12.0" keywords = ["uint"] categories = ["mathematics"] -include = ["src/**/*.rs", "README.md", "ruint-macro/README.md"] +include = ["src/**/*.rs", "README.md"] readme = "README.md" edition.workspace = true diff --git a/src/lib.rs b/src/lib.rs index a10a313..384997d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -73,6 +73,12 @@ pub use self::{ string::ParseError, }; +// For documentation purposes we expose the macro directly, otherwise it is +// wrapped in ./macros.rs. +#[cfg(doc)] +#[doc(inline)] +pub use ruint_macro::uint; + #[cfg(feature = "generic_const_exprs")] pub mod nightly { //! Extra features that are nightly only. diff --git a/src/macros.rs b/src/macros.rs index 31a8447..5d042ef 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -1,6 +1,7 @@ -#[allow(rustdoc::broken_intra_doc_links)] -#[doc = include_str!("../ruint-macro/README.md")] +/// Wrapper for [`ruint_macro::uint!`]. See its documentation for details. #[macro_export] +#[cfg(not(doc))] // Show the actual macro in docs. +#[doc(hidden)] macro_rules! uint { ($($t:tt)*) => { $crate::__private::ruint_macro::uint_with_path!([$crate] $($t)*)