Skip to content

Commit 4ae1472

Browse files
authored
tests: fix compilation of doctests on 32-bit architectures
PR #1107
1 parent cd79881 commit 4ae1472

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

regex-automata/src/util/captures.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,6 @@ impl Captures {
433433
///
434434
/// ```
435435
/// # if cfg!(miri) { return Ok(()); } // miri takes too long
436-
/// # if !cfg!(target_pointer_width = "64") { return Ok(()); } // see #1039
437436
/// use regex_automata::{nfa::thompson::pikevm::PikeVM, Span, Match};
438437
///
439438
/// let re = PikeVM::new(r"^(?P<first>\pL+)\s+(?P<last>\pL+)$")?;
@@ -445,6 +444,8 @@ impl Captures {
445444
/// assert_eq!(Some(Span::from(6..17)), caps.get_group(2));
446445
/// // Looking for a non-existent capturing group will return None:
447446
/// assert_eq!(None, caps.get_group(3));
447+
/// # // literals are too big for 32-bit usize: #1039
448+
/// # #[cfg(target_pointer_width = "64")]
448449
/// assert_eq!(None, caps.get_group(9944060567225171988));
449450
///
450451
/// # Ok::<(), Box<dyn std::error::Error>>(())

src/regex/bytes.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -2025,7 +2025,6 @@ impl<'h, 'n> core::ops::Index<&'n str> for Captures<'h> {
20252025
/// This example shows how to create and use `CaptureLocations` in a search.
20262026
///
20272027
/// ```
2028-
/// # if !cfg!(target_pointer_width = "64") { return; } // see #1041
20292028
/// use regex::bytes::Regex;
20302029
///
20312030
/// let re = Regex::new(r"(?<first>\w+)\s+(?<last>\w+)").unwrap();
@@ -2038,7 +2037,10 @@ impl<'h, 'n> core::ops::Index<&'n str> for Captures<'h> {
20382037
///
20392038
/// // Asking for an invalid capture group always returns None.
20402039
/// assert_eq!(None, locs.get(3));
2040+
/// # // literals are too big for 32-bit usize: #1041
2041+
/// # #[cfg(target_pointer_width = "64")]
20412042
/// assert_eq!(None, locs.get(34973498648));
2043+
/// # #[cfg(target_pointer_width = "64")]
20422044
/// assert_eq!(None, locs.get(9944060567225171988));
20432045
/// ```
20442046
#[derive(Clone, Debug)]

src/regex/string.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -2028,7 +2028,6 @@ impl<'h, 'n> core::ops::Index<&'n str> for Captures<'h> {
20282028
/// This example shows how to create and use `CaptureLocations` in a search.
20292029
///
20302030
/// ```
2031-
/// # if !cfg!(target_pointer_width = "64") { return; } // see #1041
20322031
/// use regex::Regex;
20332032
///
20342033
/// let re = Regex::new(r"(?<first>\w+)\s+(?<last>\w+)").unwrap();
@@ -2041,7 +2040,10 @@ impl<'h, 'n> core::ops::Index<&'n str> for Captures<'h> {
20412040
///
20422041
/// // Asking for an invalid capture group always returns None.
20432042
/// assert_eq!(None, locs.get(3));
2043+
/// # // literals are too big for 32-bit usize: #1041
2044+
/// # #[cfg(target_pointer_width = "64")]
20442045
/// assert_eq!(None, locs.get(34973498648));
2046+
/// # #[cfg(target_pointer_width = "64")]
20452047
/// assert_eq!(None, locs.get(9944060567225171988));
20462048
/// ```
20472049
#[derive(Clone, Debug)]

0 commit comments

Comments
 (0)