Include patch to fix doctests with Rust 1.62+

epel9
Fabio Valentini 3 years ago
parent d4b3fa61f1
commit 444a459a93
No known key found for this signature in database
GPG Key ID: 5AC5F572E5D410AF

@ -0,0 +1,106 @@
From 7c78a4f62814c261bc81eadf3600523bf35579c3 Mon Sep 17 00:00:00 2001
From: Fabio Valentini <decathorpe@gmail.com>
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

@ -6,7 +6,7 @@
Name: rust-%{crate}0.5 Name: rust-%{crate}0.5
Version: 0.5.6 Version: 0.5.6
Release: 4%{?dist} Release: 5%{?dist}
Summary: Offset_of functionality for Rust structs Summary: Offset_of functionality for Rust structs
# Upstream license specification: MIT # Upstream license specification: MIT
@ -14,6 +14,9 @@ License: MIT
URL: https://crates.io/crates/memoffset URL: https://crates.io/crates/memoffset
Source: %{crates_source} 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} ExclusiveArch: %{rust_arches}
%if %{__cargo_skip_build} %if %{__cargo_skip_build}
BuildArch: noarch BuildArch: noarch
@ -95,6 +98,9 @@ which use "unstable_raw" feature of "%{crate}" crate.
%endif %endif
%changelog %changelog
* Thu Jul 14 2022 Fabio Valentini <decathorpe@gmail.com> - 0.5.6-5
- Include patch to fix doctests with Rust 1.62+.
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.6-4 * Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.6-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

Loading…
Cancel
Save