Skip to content

Commit

Permalink
lite: fix doctests on 32-bit
Browse files Browse the repository at this point in the history
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
  • Loading branch information
decathorpe authored Oct 10, 2023
1 parent dd04a57 commit f5b8cb4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion regex-lite/src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2063,7 +2063,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_lite::Regex;
///
/// let re = Regex::new(r"(?<first>\w+)\s+(?<last>\w+)").unwrap();
Expand All @@ -2076,7 +2075,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)]
Expand Down

0 comments on commit f5b8cb4

Please sign in to comment.