diff --git a/0001-ignore-broken-non-exported-macro_rules-macros-doctes.patch b/0001-ignore-broken-non-exported-macro_rules-macros-doctes.patch new file mode 100644 index 0000000..9ddaa9e --- /dev/null +++ b/0001-ignore-broken-non-exported-macro_rules-macros-doctes.patch @@ -0,0 +1,106 @@ +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 + diff --git a/rust-memoffset0.5.spec b/rust-memoffset0.5.spec index be4a0ea..be05509 100644 --- a/rust-memoffset0.5.spec +++ b/rust-memoffset0.5.spec @@ -6,7 +6,7 @@ Name: rust-%{crate}0.5 Version: 0.5.6 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Offset_of functionality for Rust structs # Upstream license specification: MIT @@ -14,6 +14,9 @@ License: MIT URL: https://crates.io/crates/memoffset Source: %{crates_source} +# * patch to fix doctests with Rust 1.62+ +Patch1: 0001-ignore-broken-non-exported-macro_rules-macros-doctes.patch + ExclusiveArch: %{rust_arches} %if %{__cargo_skip_build} BuildArch: noarch @@ -95,6 +98,9 @@ which use "unstable_raw" feature of "%{crate}" crate. %endif %changelog +* Thu Jul 14 2022 Fabio Valentini - 0.5.6-5 +- Include patch to fix doctests with Rust 1.62+. + * Fri Jan 21 2022 Fedora Release Engineering - 0.5.6-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild