Bug 2005687 Comment 0 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

glean build is hitting the following panic:

```
thread 'main' (289797) panicked at src/tools/rust-analyzer/crates/rust-analyzer/src/cli/scip.rs:227:17:
Invariant violation: file emitted multiple times.
stack backtrace:
  0: __rustc::rust_begin_unwind
  1: core::panicking::panic_fmt
  2: <rust_analyzer::cli::flags::Scip>::run
  3: rust_analyzer::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
+ handle_tree_error 'tree build script'
+ local 'msg=tree build script'
+ echo 'warning: Tree '\''glean'\'' error: tree build script'
warning: Tree 'glean' error: tree build script
```

possibly in the following line:

https://searchfox.org/mozsearch-mozilla/rev/61189b0620e50ecf5f230303d29034dbfb66d1e8/glean/build#8
```
rust-analyzer scip .
```

the indexer seems to be using rust-analyzer 1.94.0-nightly (f520900 2025-12-10) (or maybe a bit older version for the yesterday's build)

with the `RUST_BACKTRACE=full`, it shows the following locally:

```
thread 'main' (1042037) panicked at src/tools/rust-analyzer/crates/rust-analyzer/src/cli/scip.rs:227:17:
Invariant violation: file emitted multiple times.
stack backtrace:
   0:     0x774075aa23e3 - <<std[9c4b50c3ebfa6b3a]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[d9360cd39ab1b003]::fmt::Display>::fmt
   1:     0x774076210688 - core[d9360cd39ab1b003]::fmt::write
   2:     0x774075ab8af6 - <std[9c4b50c3ebfa6b3a]::sys::stdio::unix::Stderr as std[9c4b50c3ebfa6b3a]::io::Write>::write_fmt
   3:     0x774075a78ba8 - std[9c4b50c3ebfa6b3a]::panicking::default_hook::{closure#0}
   4:     0x774075a962b3 - std[9c4b50c3ebfa6b3a]::panicking::default_hook
   5:     0x774075a9655b - std[9c4b50c3ebfa6b3a]::panicking::panic_with_hook
   6:     0x774075a78c9a - std[9c4b50c3ebfa6b3a]::panicking::panic_handler::{closure#0}
   7:     0x774075a6fc99 - std[9c4b50c3ebfa6b3a]::sys::backtrace::__rust_end_short_backtrace::<std[9c4b50c3ebfa6b3a]::panicking::panic_handler::{closure#0}, !>
   8:     0x774075a7a81d - __rustc[b1c156c3cad71f26]::rust_begin_unwind
   9:     0x774072c0a84c - core[d9360cd39ab1b003]::panicking::panic_fmt
  10:     0x5a0d56b6a132 - <rust_analyzer[41f4115c5fbde4fa]::cli::flags::Scip>::run
  11:     0x5a0d56dfef64 - rust_analyzer[f7952edd1ac28368]::main
  12:     0x5a0d56da9c83 - std[9c4b50c3ebfa6b3a]::sys::backtrace::__rust_begin_short_backtrace::<fn() -> core[d9360cd39ab1b003]::result::Result<std[9c4b50c3ebfa6b3a]::process::ExitCode, anyhow[4f49afcec37988f2]::Error>, core[d9360cd39ab1b003]::result::Result<std[9c4b50c3ebfa6b3a]::process::ExitCode, anyhow[4f49afcec37988f2]::Error>>
  13:     0x5a0d56df7362 - std[9c4b50c3ebfa6b3a]::rt::lang_start::<core[d9360cd39ab1b003]::result::Result<std[9c4b50c3ebfa6b3a]::process::ExitCode, anyhow[4f49afcec37988f2]::Error>>::{closure#0}
  14:     0x7740773239e6 - std[9c4b50c3ebfa6b3a]::rt::lang_start_internal
  15:     0x5a0d56e17458 - main
  16:     0x774070e181ca - __libc_start_call_main
                               at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
  17:     0x774070e1828b - __libc_start_main_impl
                               at ./csu/../csu/libc-start.c:360:3
  18:     0x5a0d556b9679 - <unknown>
  19:                0x0 - <unknown>
```

Also, with the older rust-analyzer from 2025-08, I got the following output locally:

```
Encountered duplicate scip symbols, indicating an internal rust-analyzer bug. These duplicates are
included in the output, but this causes information lookup to be ambiguous and so information about
these symbols presented by downstream tools may be incorrect.

Known rust-analyzer bugs that can cause this:

  * Definitions in crate example binaries which have the same symbol as definitions in the library
    or some other example.

  * Struct/enum/const/static/impl definitions nested in a function do not mention the function name.
    See #18771.

Duplicate symbols encountered:

samples/rust/src/main.rs:0:0-263:0
  Duplicate symbol: rust-analyzer cargo sample 0.1.0 crate/

samples/rust/src/main.rs:89:3-89:7
  Duplicate symbol: rust-analyzer cargo sample 0.1.0 main().

glean-core/rlb/tests/upload_timing.rs:0:0-229:0
  Duplicate symbol: rust-analyzer cargo glean 66.2.0 crate/

...
```
glean build is hitting the following panic during the searchfox indexing:

```
thread 'main' (289797) panicked at src/tools/rust-analyzer/crates/rust-analyzer/src/cli/scip.rs:227:17:
Invariant violation: file emitted multiple times.
stack backtrace:
  0: __rustc::rust_begin_unwind
  1: core::panicking::panic_fmt
  2: <rust_analyzer::cli::flags::Scip>::run
  3: rust_analyzer::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
+ handle_tree_error 'tree build script'
+ local 'msg=tree build script'
+ echo 'warning: Tree '\''glean'\'' error: tree build script'
warning: Tree 'glean' error: tree build script
```

possibly in the following line:

https://searchfox.org/mozsearch-mozilla/rev/61189b0620e50ecf5f230303d29034dbfb66d1e8/glean/build#8
```
rust-analyzer scip .
```

the indexer seems to be using rust-analyzer 1.94.0-nightly (f520900 2025-12-10) (or maybe a bit older version for the yesterday's build)

with the `RUST_BACKTRACE=full`, it shows the following locally:

```
thread 'main' (1042037) panicked at src/tools/rust-analyzer/crates/rust-analyzer/src/cli/scip.rs:227:17:
Invariant violation: file emitted multiple times.
stack backtrace:
   0:     0x774075aa23e3 - <<std[9c4b50c3ebfa6b3a]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[d9360cd39ab1b003]::fmt::Display>::fmt
   1:     0x774076210688 - core[d9360cd39ab1b003]::fmt::write
   2:     0x774075ab8af6 - <std[9c4b50c3ebfa6b3a]::sys::stdio::unix::Stderr as std[9c4b50c3ebfa6b3a]::io::Write>::write_fmt
   3:     0x774075a78ba8 - std[9c4b50c3ebfa6b3a]::panicking::default_hook::{closure#0}
   4:     0x774075a962b3 - std[9c4b50c3ebfa6b3a]::panicking::default_hook
   5:     0x774075a9655b - std[9c4b50c3ebfa6b3a]::panicking::panic_with_hook
   6:     0x774075a78c9a - std[9c4b50c3ebfa6b3a]::panicking::panic_handler::{closure#0}
   7:     0x774075a6fc99 - std[9c4b50c3ebfa6b3a]::sys::backtrace::__rust_end_short_backtrace::<std[9c4b50c3ebfa6b3a]::panicking::panic_handler::{closure#0}, !>
   8:     0x774075a7a81d - __rustc[b1c156c3cad71f26]::rust_begin_unwind
   9:     0x774072c0a84c - core[d9360cd39ab1b003]::panicking::panic_fmt
  10:     0x5a0d56b6a132 - <rust_analyzer[41f4115c5fbde4fa]::cli::flags::Scip>::run
  11:     0x5a0d56dfef64 - rust_analyzer[f7952edd1ac28368]::main
  12:     0x5a0d56da9c83 - std[9c4b50c3ebfa6b3a]::sys::backtrace::__rust_begin_short_backtrace::<fn() -> core[d9360cd39ab1b003]::result::Result<std[9c4b50c3ebfa6b3a]::process::ExitCode, anyhow[4f49afcec37988f2]::Error>, core[d9360cd39ab1b003]::result::Result<std[9c4b50c3ebfa6b3a]::process::ExitCode, anyhow[4f49afcec37988f2]::Error>>
  13:     0x5a0d56df7362 - std[9c4b50c3ebfa6b3a]::rt::lang_start::<core[d9360cd39ab1b003]::result::Result<std[9c4b50c3ebfa6b3a]::process::ExitCode, anyhow[4f49afcec37988f2]::Error>>::{closure#0}
  14:     0x7740773239e6 - std[9c4b50c3ebfa6b3a]::rt::lang_start_internal
  15:     0x5a0d56e17458 - main
  16:     0x774070e181ca - __libc_start_call_main
                               at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
  17:     0x774070e1828b - __libc_start_main_impl
                               at ./csu/../csu/libc-start.c:360:3
  18:     0x5a0d556b9679 - <unknown>
  19:                0x0 - <unknown>
```

Also, with the older rust-analyzer from 2025-08, I got the following output locally:

```
Encountered duplicate scip symbols, indicating an internal rust-analyzer bug. These duplicates are
included in the output, but this causes information lookup to be ambiguous and so information about
these symbols presented by downstream tools may be incorrect.

Known rust-analyzer bugs that can cause this:

  * Definitions in crate example binaries which have the same symbol as definitions in the library
    or some other example.

  * Struct/enum/const/static/impl definitions nested in a function do not mention the function name.
    See #18771.

Duplicate symbols encountered:

samples/rust/src/main.rs:0:0-263:0
  Duplicate symbol: rust-analyzer cargo sample 0.1.0 crate/

samples/rust/src/main.rs:89:3-89:7
  Duplicate symbol: rust-analyzer cargo sample 0.1.0 main().

glean-core/rlb/tests/upload_timing.rs:0:0-229:0
  Duplicate symbol: rust-analyzer cargo glean 66.2.0 crate/

...
```

Back to Bug 2005687 Comment 0