Skip to content

regex v1.9.1 / regex-lite v0.1.0: test failures on 32-bit architectures #1041

Closed
@decathorpe

Description

@decathorpe

This is a followup from issue #1039 - it appears that similar problems are also present in regex.

Failed doctests are:

    src/builders.rs - builders::bytes::RegexBuilder::size_limit (line 1848)
    src/builders.rs - builders::bytes::RegexSetBuilder::size_limit (line 2420)
    src/builders.rs - builders::string::RegexBuilder::size_limit (line 671)
    src/builders.rs - builders::string::RegexSetBuilder::size_limit (line 1238)
    src/regex/bytes.rs - regex::bytes::CaptureLocations (line 2027)
    src/regex/string.rs - regex::string::CaptureLocations (line 2030)

The first four due to the same size limit being too high for 32-bit architectures, and the last two are again usize literals that are too big for their data type.

Full output for the failures:

failures:
---- src/builders.rs - builders::bytes::RegexBuilder::size_limit (line 1848) stdout ----
Test executable failed (exit status: 101).
stderr:
thread 'main' panicked at 'assertion failed: RegexBuilder::new(r\"\\w\").size_limit(45_000).build().is_err()', src/builders.rs:9:1
stack backtrace:
   0: 0x566abcfe - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h5e3f417bcf02dcd3
   1: 0x566c7030 - core::fmt::write::hffb0d28c8178d868
   2: 0x566a9d41 - std::io::Write::write_fmt::hd9c1e94d8083a97a
   3: 0x566abacf - std::sys_common::backtrace::print::hb33e9d6b17b3830e
   4: 0x566ad065 - std::panicking::default_hook::{{closure}}::hf736b577d9673442
   5: 0x566ace0e - std::panicking::default_hook::h9d3c62164da10493
   6: 0x566ad63f - std::panicking::rust_panic_with_hook::he6cb4c574f9b74cc
   7: 0x566ad4d2 - std::panicking::begin_panic_handler::{{closure}}::h3fc1035efef798c2
   8: 0x566ac185 - std::sys_common::backtrace::__rust_end_short_backtrace::h581f3c2cbdbe7ea7
   9: 0x566ad242 - rust_begin_unwind
  10: 0x565edb65 - core::panicking::panic_fmt::ha43a609b26c80be9
  11: 0x565edc1c - core::panicking::panic::h70e891db19a9baae
  12: 0x565f4c99 - rust_out::main::_doctest_main_src_builders_rs_1848_0::hf31ead4db7a91307
  13: 0x565f4b35 - rust_out::main::h9d36f4e323f71253
  14: 0x565ee666 - core::ops::function::FnOnce::call_once::hf4cccc4427ce6158
  15: 0x565ee2dc - std::sys_common::backtrace::__rust_begin_short_backtrace::h089b476c5bb5b3a0
  16: 0x565ee372 - std::rt::lang_start::{{closure}}::hb608a0b24121b256
  17: 0x566a7eef - std::rt::lang_start_internal::hba2f6c9bd49860d0
  18: 0x565ee337 - std::rt::lang_start::h7704b4ab844b068a
  19: 0x565f4cd9 - main
  20: 0xf7dcb969 - __libc_start_call_main
  21: 0xf7dcba2c - __libc_start_main@GLIBC_2.0
  22: 0x565ee1bb - _start
  23:        0x0 - <unknown>
---- src/builders.rs - builders::bytes::RegexSetBuilder::size_limit (line 2420) stdout ----
Test executable failed (exit status: 101).
stderr:
thread 'main' panicked at 'assertion failed: RegexSetBuilder::new([r\"\\w\"]).size_limit(45_000).build().is_err()', src/builders.rs:9:1
stack backtrace:
   0: 0x566db69e - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h5e3f417bcf02dcd3
   1: 0x566f69d0 - core::fmt::write::hffb0d28c8178d868
   2: 0x566d96e1 - std::io::Write::write_fmt::hd9c1e94d8083a97a
   3: 0x566db46f - std::sys_common::backtrace::print::hb33e9d6b17b3830e
   4: 0x566dca05 - std::panicking::default_hook::{{closure}}::hf736b577d9673442
   5: 0x566dc7ae - std::panicking::default_hook::h9d3c62164da10493
   6: 0x566dcfdf - std::panicking::rust_panic_with_hook::he6cb4c574f9b74cc
   7: 0x566dce72 - std::panicking::begin_panic_handler::{{closure}}::h3fc1035efef798c2
   8: 0x566dbb25 - std::sys_common::backtrace::__rust_end_short_backtrace::h581f3c2cbdbe7ea7
   9: 0x566dcbe2 - rust_begin_unwind
  10: 0x56619a25 - core::panicking::panic_fmt::ha43a609b26c80be9
  11: 0x56619adc - core::panicking::panic::h70e891db19a9baae
  12: 0x5662340b - rust_out::main::_doctest_main_src_builders_rs_2420_0::hea679552552023ec
  13: 0x56623295 - rust_out::main::h9d36f4e323f71253
  14: 0x5661a7e6 - core::ops::function::FnOnce::call_once::hf4cccc4427ce6158
  15: 0x5661a37c - std::sys_common::backtrace::__rust_begin_short_backtrace::h089b476c5bb5b3a0
  16: 0x5661a412 - std::rt::lang_start::{{closure}}::hb608a0b24121b256
  17: 0x566d788f - std::rt::lang_start_internal::hba2f6c9bd49860d0
  18: 0x5661a3d7 - std::rt::lang_start::h7704b4ab844b068a
  19: 0x56623449 - main
  20: 0xf7ce3969 - __libc_start_call_main
  21: 0xf7ce3a2c - __libc_start_main@GLIBC_2.0
  22: 0x5661a07b - _start
  23:        0x0 - <unknown>
---- src/builders.rs - builders::string::RegexBuilder::size_limit (line 671) stdout ----
Test executable failed (exit status: 101).
stderr:
thread 'main' panicked at 'assertion failed: RegexBuilder::new(r\"\\w\").size_limit(45_000).build().is_err()', src/builders.rs:9:1
stack backtrace:
   0: 0x566e9cfe - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h5e3f417bcf02dcd3
   1: 0x56705030 - core::fmt::write::hffb0d28c8178d868
   2: 0x566e7d41 - std::io::Write::write_fmt::hd9c1e94d8083a97a
   3: 0x566e9acf - std::sys_common::backtrace::print::hb33e9d6b17b3830e
   4: 0x566eb065 - std::panicking::default_hook::{{closure}}::hf736b577d9673442
   5: 0x566eae0e - std::panicking::default_hook::h9d3c62164da10493
   6: 0x566eb63f - std::panicking::rust_panic_with_hook::he6cb4c574f9b74cc
   7: 0x566eb4d2 - std::panicking::begin_panic_handler::{{closure}}::h3fc1035efef798c2
   8: 0x566ea185 - std::sys_common::backtrace::__rust_end_short_backtrace::h581f3c2cbdbe7ea7
   9: 0x566eb242 - rust_begin_unwind
  10: 0x5662bb65 - core::panicking::panic_fmt::ha43a609b26c80be9
  11: 0x5662bc1c - core::panicking::panic::h70e891db19a9baae
  12: 0x56632c99 - rust_out::main::_doctest_main_src_builders_rs_671_0::h111b55522a3a221f
  13: 0x56632b35 - rust_out::main::h9d36f4e323f71253
  14: 0x5662c666 - core::ops::function::FnOnce::call_once::hf4cccc4427ce6158
  15: 0x5662c2dc - std::sys_common::backtrace::__rust_begin_short_backtrace::h089b476c5bb5b3a0
  16: 0x5662c372 - std::rt::lang_start::{{closure}}::hb608a0b24121b256
  17: 0x566e5eef - std::rt::lang_start_internal::hba2f6c9bd49860d0
  18: 0x5662c337 - std::rt::lang_start::h7704b4ab844b068a
  19: 0x56632cd9 - main
  20: 0xf7cfb969 - __libc_start_call_main
  21: 0xf7cfba2c - __libc_start_main@GLIBC_2.0
  22: 0x5662c1bb - _start
  23:        0x0 - <unknown>
---- src/builders.rs - builders::string::RegexSetBuilder::size_limit (line 1238) stdout ----
Test executable failed (exit status: 101).
stderr:
thread 'main' panicked at 'assertion failed: RegexSetBuilder::new([r\"\\w\"]).size_limit(45_000).build().is_err()', src/builders.rs:9:1
stack backtrace:
   0: 0x5667769e - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h5e3f417bcf02dcd3
   1: 0x566929d0 - core::fmt::write::hffb0d28c8178d868
   2: 0x566756e1 - std::io::Write::write_fmt::hd9c1e94d8083a97a
   3: 0x5667746f - std::sys_common::backtrace::print::hb33e9d6b17b3830e
   4: 0x56678a05 - std::panicking::default_hook::{{closure}}::hf736b577d9673442
   5: 0x566787ae - std::panicking::default_hook::h9d3c62164da10493
   6: 0x56678fdf - std::panicking::rust_panic_with_hook::he6cb4c574f9b74cc
   7: 0x56678e72 - std::panicking::begin_panic_handler::{{closure}}::h3fc1035efef798c2
   8: 0x56677b25 - std::sys_common::backtrace::__rust_end_short_backtrace::h581f3c2cbdbe7ea7
   9: 0x56678be2 - rust_begin_unwind
  10: 0x565b5a25 - core::panicking::panic_fmt::ha43a609b26c80be9
  11: 0x565b5adc - core::panicking::panic::h70e891db19a9baae
  12: 0x565bf40b - rust_out::main::_doctest_main_src_builders_rs_1238_0::h4fd3d4ec58f2cebb
  13: 0x565bf295 - rust_out::main::h9d36f4e323f71253
  14: 0x565b67e6 - core::ops::function::FnOnce::call_once::hf4cccc4427ce6158
  15: 0x565b637c - std::sys_common::backtrace::__rust_begin_short_backtrace::h089b476c5bb5b3a0
  16: 0x565b6412 - std::rt::lang_start::{{closure}}::hb608a0b24121b256
  17: 0x5667388f - std::rt::lang_start_internal::hba2f6c9bd49860d0
  18: 0x565b63d7 - std::rt::lang_start::h7704b4ab844b068a
  19: 0x565bf449 - main
  20: 0xf7d72969 - __libc_start_call_main
  21: 0xf7d72a2c - __libc_start_main@GLIBC_2.0
  22: 0x565b607b - _start
  23:        0x0 - <unknown>
---- src/regex/bytes.rs - regex::bytes::CaptureLocations (line 2027) stdout ----
error: literal out of range for `usize`
  --> src/regex/bytes.rs:2040:27
   |
16 | assert_eq!(None, locs.get(34973498648));
   |                           ^^^^^^^^^^^
   |
   = note: the literal `34973498648` does not fit into the type `usize` whose range is `0..=4294967295`
   = note: `#[deny(overflowing_literals)]` on by default
error: literal out of range for `usize`
  --> src/regex/bytes.rs:2041:27
   |
17 | assert_eq!(None, locs.get(9944060567225171988));
   |                           ^^^^^^^^^^^^^^^^^^^
   |
   = note: the literal `9944060567225171988` does not fit into the type `usize` whose range is `0..=4294967295`
error: aborting due to 2 previous errors
Couldn't compile the test.
---- src/regex/string.rs - regex::string::CaptureLocations (line 2030) stdout ----
error: literal out of range for `usize`
  --> src/regex/string.rs:2043:27
   |
16 | assert_eq!(None, locs.get(34973498648));
   |                           ^^^^^^^^^^^
   |
   = note: the literal `34973498648` does not fit into the type `usize` whose range is `0..=4294967295`
   = note: `#[deny(overflowing_literals)]` on by default
error: literal out of range for `usize`
  --> src/regex/string.rs:2044:27
   |
17 | assert_eq!(None, locs.get(9944060567225171988));
   |                           ^^^^^^^^^^^^^^^^^^^
   |
   = note: the literal `9944060567225171988` does not fit into the type `usize` whose range is `0..=4294967295`
error: aborting due to 2 previous errors
Couldn't compile the test.
failures:
    src/builders.rs - builders::bytes::RegexBuilder::size_limit (line 1848)
    src/builders.rs - builders::bytes::RegexSetBuilder::size_limit (line 2420)
    src/builders.rs - builders::string::RegexBuilder::size_limit (line 671)
    src/builders.rs - builders::string::RegexSetBuilder::size_limit (line 1238)
    src/regex/bytes.rs - regex::bytes::CaptureLocations (line 2027)
    src/regex/string.rs - regex::string::CaptureLocations (line 2030)
test result: FAILED. 231 passed; 6 failed; 1 ignored; 0 measured; 0 filtered out; finished in 33.09s
error: doctest failed, to rerun pass `--doc`
error: 1 target failed:
    `--doc`

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions