Skip to content

Commit f5b8cb4

Browse files
authored
lite: fix doctests on 32-bit
Returning early on non-64-bit architectures is not enough, since the doctest failed to compile due to two numeric literals being too large for usize on 32-bit architectures. PR #1101
1 parent dd04a57 commit f5b8cb4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

regex-lite/src/string.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2063,7 +2063,6 @@ impl<'h, 'n> core::ops::Index<&'n str> for Captures<'h> {
20632063
/// This example shows how to create and use `CaptureLocations` in a search.
20642064
///
20652065
/// ```
2066-
/// # if !cfg!(target_pointer_width = "64") { return; } // see #1041
20672066
/// use regex_lite::Regex;
20682067
///
20692068
/// let re = Regex::new(r"(?<first>\w+)\s+(?<last>\w+)").unwrap();
@@ -2076,7 +2075,10 @@ impl<'h, 'n> core::ops::Index<&'n str> for Captures<'h> {
20762075
///
20772076
/// // Asking for an invalid capture group always returns None.
20782077
/// assert_eq!(None, locs.get(3));
2078+
/// # // literals are too big for 32-bit usize: #1041
2079+
/// # #[cfg(target_pointer_width = "64")]
20792080
/// assert_eq!(None, locs.get(34973498648));
2081+
/// # #[cfg(target_pointer_width = "64")]
20802082
/// assert_eq!(None, locs.get(9944060567225171988));
20812083
/// ```
20822084
#[derive(Clone, Debug)]

0 commit comments

Comments
 (0)