From 7c78a4f62814c261bc81eadf3600523bf35579c3 Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Thu, 14 Jul 2022 12:24:27 +0200 Subject: [PATCH] ignore broken / non-exported macro_rules! macros doctests This fixes building doctests with Rust 1.62, which now actually runs doctests for non-exported macros. Additionally, doctests that (intentionally or not) create unaligned access to struct fields are also disabled. This was always a problem, but it started being an error with Rust 1.62. --- src/lib.rs | 10 +--------- src/offset_of.rs | 4 +++- src/span_of.rs | 4 +++- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index c85fb01..5f6816b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -23,7 +23,7 @@ //! This functionality currently can not be used in compile time code such as `const` or `const fn` definitions. //! //! ## Examples -//! ``` +//! ```ignore //! #[macro_use] //! extern crate memoffset; //! @@ -69,14 +69,6 @@ )] #![cfg_attr(feature = "unstable_raw", feature(raw_ref_macros))] -#[macro_use] -#[cfg(doctests)] -#[cfg(doctest)] -extern crate doc_comment; -#[cfg(doctests)] -#[cfg(doctest)] -doctest!("../README.md"); - // This `use` statement enables the macros to use `$crate::mem`. // Doing this enables this crate to function under both std and no-std crates. #[doc(hidden)] diff --git a/src/offset_of.rs b/src/offset_of.rs index bb2bce1..ae187e1 100644 --- a/src/offset_of.rs +++ b/src/offset_of.rs @@ -69,7 +69,7 @@ macro_rules! _memoffset_offset_from { /// Calculates the offset of the specified field from the start of the struct. /// /// ## Examples -/// ``` +/// ```ignore /// #[macro_use] /// extern crate memoffset; /// @@ -113,6 +113,7 @@ mod tests { assert_eq!(offset_of!(Foo, c), 8); } + /* #[test] #[cfg_attr(miri, ignore)] // this creates unaligned references fn offset_simple_packed() { @@ -127,6 +128,7 @@ mod tests { assert_eq!(offset_of!(Foo, b), 4); assert_eq!(offset_of!(Foo, c), 6); } + */ #[test] fn tuple_struct() { diff --git a/src/span_of.rs b/src/span_of.rs index 0592dbd..0646fa8 100644 --- a/src/span_of.rs +++ b/src/span_of.rs @@ -58,7 +58,7 @@ macro_rules! _memoffset__compile_error { /// In order to raise the limit, the compiler's recursion limit should be lifted. /// /// ## Examples -/// ``` +/// ```ignore /// #[macro_use] /// extern crate memoffset; /// @@ -171,6 +171,7 @@ mod tests { assert_eq!(span_of!(Foo, c), 8..8 + 8); } + /* #[test] #[cfg_attr(miri, ignore)] // this creates unaligned references fn span_simple_packed() { @@ -185,6 +186,7 @@ mod tests { assert_eq!(span_of!(Foo, b), 4..6); assert_eq!(span_of!(Foo, c), 6..6 + 8); } + */ #[test] fn span_forms() { -- 2.37.1