From 8531cfcaf8baf9ac54c3faf2e5746ced7dcac0af Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Sun, 15 Oct 2023 01:52:14 +0200 Subject: [PATCH] regex: fix compilation of doctests on 32-bit architectures --- src/regex/bytes.rs | 4 +++- src/regex/string.rs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/regex/bytes.rs b/src/regex/bytes.rs index c742b09..19f5701 100644 --- a/src/regex/bytes.rs +++ b/src/regex/bytes.rs @@ -2025,7 +2025,6 @@ impl<'h, 'n> core::ops::Index<&'n str> for Captures<'h> { /// This example shows how to create and use `CaptureLocations` in a search. /// /// ``` -/// # if !cfg!(target_pointer_width = "64") { return; } // see #1041 /// use regex::bytes::Regex; /// /// let re = Regex::new(r"(?\w+)\s+(?\w+)").unwrap(); @@ -2038,7 +2037,10 @@ impl<'h, 'n> core::ops::Index<&'n str> for Captures<'h> { /// /// // Asking for an invalid capture group always returns None. /// assert_eq!(None, locs.get(3)); +/// # // literals are too big for 32-bit usize: #1041 +/// # #[cfg(target_pointer_width = "64")] /// assert_eq!(None, locs.get(34973498648)); +/// # #[cfg(target_pointer_width = "64")] /// assert_eq!(None, locs.get(9944060567225171988)); /// ``` #[derive(Clone, Debug)] diff --git a/src/regex/string.rs b/src/regex/string.rs index 177a2af..880d608 100644 --- a/src/regex/string.rs +++ b/src/regex/string.rs @@ -2028,7 +2028,6 @@ impl<'h, 'n> core::ops::Index<&'n str> for Captures<'h> { /// This example shows how to create and use `CaptureLocations` in a search. /// /// ``` -/// # if !cfg!(target_pointer_width = "64") { return; } // see #1041 /// use regex::Regex; /// /// let re = Regex::new(r"(?\w+)\s+(?\w+)").unwrap(); @@ -2041,7 +2040,10 @@ impl<'h, 'n> core::ops::Index<&'n str> for Captures<'h> { /// /// // Asking for an invalid capture group always returns None. /// assert_eq!(None, locs.get(3)); +/// # // literals are too big for 32-bit usize: #1041 +/// # #[cfg(target_pointer_width = "64")] /// assert_eq!(None, locs.get(34973498648)); +/// # #[cfg(target_pointer_width = "64")] /// assert_eq!(None, locs.get(9944060567225171988)); /// ``` #[derive(Clone, Debug)] -- 2.41.0