facebookexperimental / MIRAI

Rust mid-level IR Abstract Interpreter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Panicked when analyzing `ripgrep`

TomMD opened this issue · comments

Issue

I installed MIRAI (1bd6f02). In a ubuntu container:

rustup override set nightly-2020-11-07
git clone https://github.com/facebookexperimental/MIRAI
cd MIRAI
./setup.sh
sudo apt update && sudo apt install -y libz3-dev
rustup component add rustc-dev
rustup component add llvm-tools-preview
RUSTFLAGS='-Clink-arg=-L./binaries -Clink-arg=-lstdc++' cargo install  --path ./checker

Then tried it on ripgrep:

git clone https://github.com/BurntSushi/ripgrep
cd ripgrep
LD_LIBRARY_PATH=/opt/rust/toolchains/nightly-2021-11-07-x86_64-unknown-linux-gnu/lib/ RUSTFLAGS="-Z always_encode_mir" RUSTC_WRAPPER=mirai cargo build

And it paniced:

thread 'rustc' panicked at 'internal error: entered unreachable code: 0', checker/src/block_visitor.rs:1970:21
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.58.0-nightly (072799443 2021-11-06) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z always_encode_mir -C embed-bitcode=no -C debuginfo=2 --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `bstr`

Environment

lift@a73eae6021e5:~/MIRAI$ uname -a
Linux a73eae6021e5 5.10.47-linuxkit #1 SMP Sat Jul 3 21:51:47 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
lift@a73eae6021e5:~/MIRAI$ rustc --version
rustc 1.58.0-nightly (072799443 2021-11-06)
lift@a73eae6021e5:~/MIRAI$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.3 LTS"

I'll look into this. Meanwhile, you might try to first build the project just using RUSTFLAGS="-Z always_encode_mir" cargo build. Then touch the lib.rs files in the ripgrep repo: find . -type f -name lib.rs -exec touch {} \; and then compile again, but this time with the addition of RUSTC_WRAPPER=mirai

I tried the above locally and it works, but takes 2 hours to run. To save you the wait and frustration, here is the output:

hermanv@hermanv-mbp ripgrep % find . -type f -name lib.rs -exec touch {} \; 
hermanv@hermanv-mbp ripgrep % RUSTFLAGS="-Z always_encode_mir" RUSTC_WRAPPER=mirai cargo build
   Compiling grep-matcher v0.1.5 (/Users/hermanv/CLionProjects/ripgrep/crates/matcher)
   Compiling globset v0.4.8 (/Users/hermanv/CLionProjects/ripgrep/crates/globset)
warning: BUG for NoError: an impossible error occurred
   --> crates/matcher/src/lib.rs:496:9
    |
496 |         panic!("BUG for NoError: an impossible error occurred")
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: BUG for NoError: an impossible error occurred
   --> crates/matcher/src/lib.rs:502:9
    |
502 |         panic!("BUG for NoError: an impossible error occurred")
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

   Compiling grep-searcher v0.1.8 (/Users/hermanv/CLionProjects/ripgrep/crates/searcher)
   Compiling grep-regex v0.1.9 (/Users/hermanv/CLionProjects/ripgrep/crates/regex)
warning: `grep-matcher` (lib) generated 2 warnings
warning: field is never read: `config`
  --> crates/searcher/src/searcher/glue.rs:91:5
   |
91 |     config: &'s Config,
   |     ^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

warning: field is never read: `line_term`
   --> crates/searcher/src/sink.rs:439:5
    |
439 |     pub(crate) line_term: LineTerminator,
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

   Compiling grep-printer v0.1.6 (/Users/hermanv/CLionProjects/ripgrep/crates/printer)
warning: `grep-searcher` (lib) generated 2 warnings
warning: possible attempt to add with overflow
   --> crates/globset/src/lib.rs:783:18
    |
783 |         for i in self.matcher.matches(candidate.path.as_bytes()) {
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: related location
   --> /Users/hermanv/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-1.5.4/src/re_set.rs:448:1
    |
448 | / define_set! {
449 | |     bytes,
450 | |     set_bytes,
451 | |     &[u8],
...   |
474 | | /// ```
475 | | }
    | |_^
note: related location
   --> /Users/hermanv/.rustup/toolchains/nightly-2021-11-07-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/iter/adapters/enumerate.rs:48:9
    |
48  |         self.count += 1;
    |         ^^^^^^^^^^^^^^^
    = note: this warning originates in the macro `define_set` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: assertion failed: bump == Some(\'!\') || bump == Some(\'^\')
   --> crates/globset/src/glob.rs:929:17
    |
929 |                 assert!(bump == Some('!') || bump == Some('^'));
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

   Compiling grep-cli v0.1.6 (/Users/hermanv/CLionProjects/ripgrep/crates/cli)
   Compiling ignore v0.4.18 (/Users/hermanv/CLionProjects/ripgrep/crates/ignore)
warning: field is never read: `which`
   --> crates/ignore/src/types.rs:126:9
    |
126 |         which: usize,
    |         ^^^^^^^^^^^^
    |
    = note: `#[warn(dead_code)]` on by default

warning: field is never read: `negated`
   --> crates/ignore/src/types.rs:128:9
    |
128 |         negated: bool,
    |         ^^^^^^^^^^^^^

warning: `globset` (lib) generated 2 warnings
warning: the pointer points to memory that has already been deallocated
   --> crates/regex/src/crlf.rs:149:9
    |
149 |         }
    |         ^

warning: the pointer points to memory that has already been deallocated
   --> crates/regex/src/crlf.rs:153:9
    |
153 |         }
    |         ^

warning: possible attempt to add with overflow
  --> crates/regex/src/multi.rs:46:43
   |
46 |             Some(m) => Ok(Some(Match::new(at + m.start(), at + m.end()))),
   |                                           ^^^^^^^^^^^^^^

warning: possible attempt to add with overflow
  --> crates/regex/src/multi.rs:46:59
   |
46 |             Some(m) => Ok(Some(Match::new(at + m.start(), at + m.end()))),
   |                                                           ^^^^^^^^^^^^

warning: incomplete analysis of call because of failure to resolve a nested call
   --> crates/regex/src/word.rs:49:13
    |
49  |             expr.with_pattern(|pat| format!("^(?:{})$", pat))?.regex()?;
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: related location
   --> crates/regex/src/config.rs:202:9
    |
202 |         self.pattern_to_hir(&f(&self.expr.to_string()))
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: possible attempt to add with overflow
   --> crates/regex/src/word.rs:159:9
    |
159 |         self.regex.captures_read_at(&mut caps, haystack, at);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: related location
   --> /Users/hermanv/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-1.5.4/src/re_bytes.rs:631:9
    |
631 | /         self.0
632 | |             .searcher()
633 | |             .captures_read_at(&mut locs.0, text, start)
    | |_______________________________________________________^
note: related location
   --> /Users/hermanv/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-1.5.4/src/exec.rs:602:25
    |
602 |             0 => return self.find_at(text, start),
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^
note: related location
   --> /Users/hermanv/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-1.5.4/src/exec.rs:543:39
    |
543 |             MatchType::Literal(ty) => self.find_literals(ty, text, start),
    |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: related location
   --> /Users/hermanv/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-1.5.4/src/exec.rs:702:17
    |
702 |                 lits.find(&text[start..]).map(|(s, e)| (start + s, start + e))
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: related location
   --> /Users/hermanv/.rustup/toolchains/nightly-2021-11-07-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/option.rs:846:29
    |
846 |             Some(x) => Some(f(x)),
    |                             ^^^^
note: related location
   --> /Users/hermanv/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-1.5.4/src/exec.rs:702:57
    |
702 |                 lits.find(&text[start..]).map(|(s, e)| (start + s, start + e))
    |                                                         ^^^^^^^^^

warning: `grep-regex` (lib) generated 6 warnings
warning: incomplete analysis of call because of a nested call to a function without a MIR body
   --> crates/cli/src/lib.rs:218:5
    |
218 |     atty::is(atty::Stream::Stdin)
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: related location
   --> /Users/hermanv/.cargo/registry/src/github.com-1ecc6299db9ec823/atty-0.2.14/src/lib.rs:48:14
    |
48  |     unsafe { libc::isatty(fd) != 0 }
    |              ^^^^^^^^^^^^^^^^

warning: incomplete analysis of call because of a nested call to a function without a MIR body
   --> crates/cli/src/lib.rs:230:5
    |
230 |     atty::is(atty::Stream::Stdout)
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: related location
   --> /Users/hermanv/.cargo/registry/src/github.com-1ecc6299db9ec823/atty-0.2.14/src/lib.rs:48:14
    |
48  |     unsafe { libc::isatty(fd) != 0 }
    |              ^^^^^^^^^^^^^^^^

warning: incomplete analysis of call because of a nested call to a function without a MIR body
   --> crates/cli/src/lib.rs:236:5
    |
236 |     atty::is(atty::Stream::Stderr)
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: related location
   --> /Users/hermanv/.cargo/registry/src/github.com-1ecc6299db9ec823/atty-0.2.14/src/lib.rs:48:14
    |
48  |     unsafe { libc::isatty(fd) != 0 }
    |              ^^^^^^^^^^^^^^^^

warning: incomplete analysis of call because of failure to resolve a nested call
   --> crates/cli/src/decompress.rs:166:9
    |
166 | /         DecompressionMatcherBuilder::new()
167 | |             .build()
    | |____________________^
    |
note: related location
   --> crates/cli/src/decompress.rs:57:24
    |
57  |             let glob = Glob::new(&decomp_cmd.glob).map_err(|err| {
    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: incomplete analysis of call because of failure to resolve a nested call
   --> crates/cli/src/decompress.rs:497:5
    |
497 |     add("*.gz", ARGS_GZIP, &mut cmds);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: related location
   --> crates/cli/src/decompress.rs:479:25
    |
479 |         let bin = match resolve_binary(Path::new(args[0])) {
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: possible range start index 
   --> crates/cli/src/escape.rs:42:23
    |
42  |     for (s, e, ch) in bytes.char_indices() {
    |                       ^^^^^^^^^^^^^^^^^^^^
    |
note: related location
   --> /Users/hermanv/.cargo/registry/src/github.com-1ecc6299db9ec823/bstr-0.2.16/src/utf8.rs:209:20
    |
209 |         self.bs = &self.bs[size..];
    |                    ^^^^^^^^^^^^^^^
note: related location
   --> /Users/hermanv/.rustup/toolchains/nightly-2021-11-07-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/slice/index.rs:15:9
    |
15  |         index.index(self)
    |         ^^^^^^^^^^^^^^^^^
note: related location
   --> /Users/hermanv/.rustup/toolchains/nightly-2021-11-07-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/slice/index.rs:324:13
    |
324 |             slice_start_index_len_fail(self.start, slice.len());
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: possible slice index starts at after slice end
   --> crates/cli/src/escape.rs:44:22
    |
44  |             for b in bytes[s..e].bytes() {
    |                      ^^^^^^^^^^^
    |
note: related location
   --> /Users/hermanv/.rustup/toolchains/nightly-2021-11-07-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/slice/index.rs:15:9
    |
15  |         index.index(self)
    |         ^^^^^^^^^^^^^^^^^
note: related location
   --> /Users/hermanv/.rustup/toolchains/nightly-2021-11-07-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/slice/index.rs:238:13
    |
238 |             slice_index_order_fail(self.start, self.end);
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

   Compiling grep v0.2.8 (/Users/hermanv/CLionProjects/ripgrep/crates/grep)
warning: `grep-cli` (lib) generated 7 warnings
warning: possible attempt to add with overflow
   --> crates/ignore/src/types.rs:433:30
    |
433 |         if name == "all" || !RE.is_match(name) {
    |                              ^^^^^^^^^^^^^^^^^
    |
note: related location
   --> /Users/hermanv/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-1.5.4/src/re_unicode.rs:198:9
    |
198 |         self.is_match_at(text, 0)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^
note: related location
   --> /Users/hermanv/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-1.5.4/src/re_unicode.rs:639:9
    |
639 |         self.shortest_match_at(text, start).is_some()
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: related location
   --> /Users/hermanv/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-1.5.4/src/re_unicode.rs:629:9
    |
629 |         self.0.searcher_str().shortest_match_at(text, start)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: related location
   --> /Users/hermanv/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-1.5.4/src/exec.rs:397:9
    |
397 |         self.0.shortest_match_at(text.as_bytes(), start)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: related location
   --> /Users/hermanv/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-1.5.4/src/exec.rs:445:17
    |
445 |                 self.find_literals(ty, text, start).map(|(_, e)| e)
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: related location
   --> /Users/hermanv/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-1.5.4/src/exec.rs:702:17
    |
702 |                 lits.find(&text[start..]).map(|(s, e)| (start + s, start + e))
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^
note: related location
   --> /Users/hermanv/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-1.5.4/src/literal/imp.rs:89:17
    |
89  |                 s.find(haystack).map(|m| (m.start(), m.end()))
    |                 ^^^^^^^^^^^^^^^^
note: related location
   --> /Users/hermanv/.cargo/registry/src/github.com-1ecc6299db9ec823/aho-corasick-0.7.18/src/packed/api.rs:457:9
    |
457 |         self.find_at(haystack, 0)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^
note: related location
   --> /Users/hermanv/.cargo/registry/src/github.com-1ecc6299db9ec823/aho-corasick-0.7.18/src/packed/api.rs:503:17
    |
503 |                 self.rabinkarp.find_at(&self.patterns, haystack, at)
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: related location
   --> /Users/hermanv/.cargo/registry/src/github.com-1ecc6299db9ec823/aho-corasick-0.7.18/src/packed/rabinkarp.rs:104:13
    |
104 |             patterns.max_pattern_id(),
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^
note: related location
   --> /Users/hermanv/.cargo/registry/src/github.com-1ecc6299db9ec823/aho-corasick-0.7.18/src/packed/pattern.rs:140:20
    |
140 |         assert_eq!((self.max_pattern_id + 1) as usize, self.len());
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: possible attempt to add with overflow
    --> crates/ignore/src/types.rs:437:9
     |
437  | /         self.types
438  | |             .entry(key)
     | |_______________________^
     |
note: related location
    --> /Users/hermanv/.rustup/toolchains/nightly-2021-11-07-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/collections/hash/map.rs:711:19
     |
711  |         map_entry(self.base.rustc_entry(key))
     |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
note: related location /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/hashbrown-0.11.0/src/rustc_entry.rs:46:13: 46:28
note: related location /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/hashbrown-0.11.0/src/map.rs:803:9: 804:80
note: related location /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/hashbrown-0.11.0/src/raw/mod.rs:646:16: 647:77
note: related location /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/hashbrown-0.11.0/src/raw/mod.rs:693:13: 697:14
note: related location /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/hashbrown-0.11.0/src/raw/mod.rs:788:17: 789:84
note: related location /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/hashbrown-0.11.0/src/raw/mod.rs:1396:29: 1401:10
note: related location /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/hashbrown-0.11.0/src/raw/mod.rs:1184:21: 1184:50
note: related location /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/hashbrown-0.11.0/src/raw/mod.rs:215:10: 215:42
note: related location
    --> /Users/hermanv/.rustup/toolchains/nightly-2021-11-07-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/num/mod.rs:883:5
     |
883  | /     uint_impl! { usize, u64, isize, 64, 18446744073709551615, 12, "0xaa00000000006e1", "0x6e10aa",
884  | |     "0x1234567890123456", "0x5634129078563412", "0x6a2c48091e6a2c48",
885  | |     "[0x56, 0x34, 0x12, 0x90, 0x78, 0x56, 0x34, 0x12]",
886  | |     "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]",
887  | |     usize_isize_to_xe_bytes_doc!(), usize_isize_from_xe_bytes_doc!() }
     | |______________________________________________________________________^
     = note: this warning originates in the macro `uint_impl` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: possible assertion failed
   --> crates/ignore/src/types.rs:501:17
    |
501 |                 self.add(name, ext).expect(MSG);
    |                 ^^^^^^^^^^^^^^^^^^^
    |
note: related location
   --> crates/ignore/src/types.rs:433:30
    |
433 |         if name == "all" || !RE.is_match(name) {
    |                              ^^^^^^^^^^^^^^^^^
note: related location
   --> /Users/hermanv/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-1.5.4/src/re_unicode.rs:198:9
    |
198 |         self.is_match_at(text, 0)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^
note: related location
   --> /Users/hermanv/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-1.5.4/src/re_unicode.rs:639:9
    |
639 |         self.shortest_match_at(text, start).is_some()
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: related location
   --> /Users/hermanv/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-1.5.4/src/re_unicode.rs:629:9
    |
629 |         self.0.searcher_str().shortest_match_at(text, start)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: related location
   --> /Users/hermanv/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-1.5.4/src/exec.rs:397:9
    |
397 |         self.0.shortest_match_at(text.as_bytes(), start)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: related location
   --> /Users/hermanv/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-1.5.4/src/exec.rs:445:17
    |
445 |                 self.find_literals(ty, text, start).map(|(_, e)| e)
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: related location
   --> /Users/hermanv/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-1.5.4/src/exec.rs:702:17
    |
702 |                 lits.find(&text[start..]).map(|(s, e)| (start + s, start + e))
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^
note: related location
   --> /Users/hermanv/.cargo/registry/src/github.com-1ecc6299db9ec823/regex-1.5.4/src/literal/imp.rs:89:17
    |
89  |                 s.find(haystack).map(|m| (m.start(), m.end()))
    |                 ^^^^^^^^^^^^^^^^
note: related location
   --> /Users/hermanv/.cargo/registry/src/github.com-1ecc6299db9ec823/aho-corasick-0.7.18/src/packed/api.rs:457:9
    |
457 |         self.find_at(haystack, 0)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^
note: related location
   --> /Users/hermanv/.cargo/registry/src/github.com-1ecc6299db9ec823/aho-corasick-0.7.18/src/packed/api.rs:503:17
    |
503 |                 self.rabinkarp.find_at(&self.patterns, haystack, at)
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: possible attempt to add with overflow
    --> crates/ignore/src/walk.rs:1088:21
     |
1088 |                     self.depth += 1;
     |                     ^^^^^^^^^^^^^^^

warning: `ignore` (lib) generated 6 warnings
   Compiling ripgrep v13.0.0 (/Users/hermanv/CLionProjects/ripgrep)
warning: incomplete analysis of call because of failure to resolve a nested call
    --> crates/core/args.rs:341:12
     |
341  |         Ok(self.matches().types()?.definitions().to_vec())
     |            ^^^^^^^^^^^^^^^^^^^^^^
     |
note: related location
    --> crates/core/args.rs:1614:9
     |
1614 |         builder.build().map_err(From::from)
     |         ^^^^^^^^^^^^^^^

warning: possible index out of bounds
   --> crates/core/args.rs:341:12
    |
341 |         Ok(self.matches().types()?.definitions().to_vec())
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: related location
   --> /Users/hermanv/.rustup/toolchains/nightly-2021-11-07-x86_64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/slice.rs:474:9
    |
474 |         self.to_vec_in(Global)
    |         ^^^^^^^^^^^^^^^^^^^^^^
note: related location
   --> /Users/hermanv/.rustup/toolchains/nightly-2021-11-07-x86_64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/slice.rs:498:9
    |
498 |         hack::to_vec(self, alloc)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^
note: related location
   --> /Users/hermanv/.rustup/toolchains/nightly-2021-11-07-x86_64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/slice.rs:176:9
    |
176 |         T::to_vec(s, alloc)
    |         ^^^^^^^^^^^^^^^^^^^
note: related location
   --> /Users/hermanv/.rustup/toolchains/nightly-2021-11-07-x86_64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/slice.rs:211:17
    |
211 |                 slots[i].write(b.clone());
    |                 ^^^^^^^^

warning: possible attempted to index slice up to maximum usize
    --> crates/core/config.rs:28:30
     |
28   |     let (args, errs) = match parse(&config_path) {
     |                              ^^^^^^^^^^^^^^^^^^^
     |
note: related location
    --> crates/core/config.rs:61:21
     |
61   |         Ok(file) => parse_reader(file),
     |                     ^^^^^^^^^^^^^^^^^^
note: related location
    --> crates/core/config.rs:83:5
     |
83   | /     bufrdr.for_byte_line_with_terminator(|line| {
84   | |         line_number += 1;
85   | |
86   | |         let line = line.trim();
...    |
98   | |         Ok(true)
99   | |     })?;
     | |______^
note: related location
    --> /Users/hermanv/.cargo/registry/src/github.com-1ecc6299db9ec823/bstr-0.2.16/src/io.rs:247:9
     |
247  |         self.for_byte_record_with_terminator(b'\n', for_each_line)
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: related location
    --> /Users/hermanv/.cargo/registry/src/github.com-1ecc6299db9ec823/bstr-0.2.16/src/io.rs:333:13
     |
333  |             self.read_until(terminator, &mut bytes)?;
     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: related location
    --> /Users/hermanv/.rustup/toolchains/nightly-2021-11-07-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/io/mod.rs:2151:9
     |
2151 |         read_until(self, byte, buf)
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: related location
    --> /Users/hermanv/.rustup/toolchains/nightly-2021-11-07-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/io/mod.rs:1934:44
     |
1934 |                     buf.extend_from_slice(&available[..=i]);
     |                                            ^^^^^^^^^^^^^^^
note: related location
    --> /Users/hermanv/.rustup/toolchains/nightly-2021-11-07-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/slice/index.rs:15:9
     |
15   |         index.index(self)
     |         ^^^^^^^^^^^^^^^^^
note: related location
    --> /Users/hermanv/.rustup/toolchains/nightly-2021-11-07-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/slice/index.rs:446:9
     |
446  |         (0..=self.end).index(slice)
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: related location
    --> /Users/hermanv/.rustup/toolchains/nightly-2021-11-07-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/slice/index.rs:404:13
     |
404  |             slice_end_index_overflow_fail();
     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: possible index out of bounds
  --> crates/core/config.rs:87:31
   |
87 |         if line.is_empty() || line[0] == b'#' {
   |                               ^^^^^^^

warning: `ripgrep` (bin "rg") generated 4 warnings
    Finished dev [unoptimized + debuginfo] target(s) in 124m 54s
hermanv@hermanv-mbp ripgrep % 

Wow, thanks @hermanventer. I had tried but encountered some issue building bstr with the nightly that I'd yet to investigate.

I'm curious what your take on the two hours of compute. Is this acceptable as MIRAI continues to evolve as a high precision static analysis tool or do you see a future involving trade-offs between time and precision (ex infer)?

I regard it as a bug that I need to fix. There are various k-limits where abstraction kicks in (and precision is lost), but getting them just so that things are usually fast and mostly precise is inherently heuristic and I'm still slowly discovering these heuristics in a rather painful way.

The specific panics mentioned in this issue are gone, but analysis of the syn crate does not seem to terminate.