Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions regex-automata/src/nfa/thompson/pikevm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,7 @@ impl PikeVM {
// length that fits into isize, and so this assert should always pass.
// But we put it here to make our assumption explicit.
assert!(
input.haystack().len() < core::usize::MAX,
input.haystack().len() < usize::MAX,
"byte slice lengths must be less than usize MAX",
);
instrument!(|c| c.reset(&self.nfa));
Expand Down Expand Up @@ -1413,7 +1413,7 @@ impl PikeVM {
return;
}
assert!(
input.haystack().len() < core::usize::MAX,
input.haystack().len() < usize::MAX,
"byte slice lengths must be less than usize MAX",
);
instrument!(|c| c.reset(&self.nfa));
Expand Down
5 changes: 2 additions & 3 deletions regex-automata/src/util/primitives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,11 @@ impl SmallIndex {
#[cfg(any(target_pointer_width = "32", target_pointer_width = "64"))]
pub const MAX: SmallIndex =
// FIXME: Use as_usize() once const functions in traits are stable.
SmallIndex::new_unchecked(core::i32::MAX as usize - 1);
SmallIndex::new_unchecked(i32::MAX as usize - 1);

/// The maximum index value.
#[cfg(target_pointer_width = "16")]
pub const MAX: SmallIndex =
SmallIndex::new_unchecked(core::isize::MAX - 1);
pub const MAX: SmallIndex = SmallIndex::new_unchecked(isize::MAX - 1);

/// The total number of values that can be represented as a small index.
pub const LIMIT: usize = SmallIndex::MAX.as_usize() + 1;
Expand Down