Skip to content

Commit

Permalink
tests: fix compilation of doctests on 32-bit architectures
Browse files Browse the repository at this point in the history
  • Loading branch information
decathorpe committed Oct 15, 2023
1 parent cd79881 commit 4ae1472
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion regex-automata/src/util/captures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,6 @@ impl Captures {
///
/// ```
/// # if cfg!(miri) { return Ok(()); } // miri takes too long
/// # if !cfg!(target_pointer_width = "64") { return Ok(()); } // see #1039
/// use regex_automata::{nfa::thompson::pikevm::PikeVM, Span, Match};
///
/// let re = PikeVM::new(r"^(?P<first>\pL+)\s+(?P<last>\pL+)$")?;
Expand All @@ -445,6 +444,8 @@ impl Captures {
/// assert_eq!(Some(Span::from(6..17)), caps.get_group(2));
/// // Looking for a non-existent capturing group will return None:
/// assert_eq!(None, caps.get_group(3));
/// # // literals are too big for 32-bit usize: #1039
/// # #[cfg(target_pointer_width = "64")]
/// assert_eq!(None, caps.get_group(9944060567225171988));
///
/// # Ok::<(), Box<dyn std::error::Error>>(())
Expand Down
4 changes: 3 additions & 1 deletion src/regex/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"(?<first>\w+)\s+(?<last>\w+)").unwrap();
Expand All @@ -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)]
Expand Down
4 changes: 3 additions & 1 deletion src/regex/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"(?<first>\w+)\s+(?<last>\w+)").unwrap();
Expand All @@ -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)]
Expand Down

0 comments on commit 4ae1472

Please sign in to comment.