Open Bug 2005687 Opened 11 days ago Updated 6 days ago

rust-analyzer panics in the glean build

Categories

(Webtools :: Searchfox, defect)

defect

Tracking

(Not tracked)

People

(Reporter: arai, Unassigned)

Details

Attachments

(1 file)

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/

...

:chutten, can you take a look?

Flags: needinfo?(chutten)

These are coming from the Glean SDK itself, so passing baton to Jan-Erik

Flags: needinfo?(chutten) → needinfo?(jrediger)
Attached file run.sh

This started to fail in the past 2 weeks.

$ ./run.sh
rust-analyzer 0.3.2719-standalone (87cf6631c6 2025-12-14)
FAILED: 2025-12-15

rust-analyzer 0.3.2711-standalone (5e3e9c4e61 2025-12-07)
FAILED: 2025-12-08

rust-analyzer 0.3.2693-standalone (4a2b38f49f 2025-11-23)

Looking at rust-analyzer's crates/rust-analyzer/src/cli/scip.rs to see what changed:
Only this PR landed: https://github.com/rust-lang/rust-analyzer/pull/21141
The duplicates where there before, for the reasons listed in the earlier output. However that change made it now panic and thus fail.

I'll file an upstream bug.

Flags: needinfo?(jrediger)

This was fixed now: https://github.com/rust-lang/rust-analyzer/pull/21270
The latest rust-analyzer nightly already works. Are we using nightly in the searchfox deployment? If not, r-a releases on Mondays, so we will have to wait until then.

Thank you for filing the issue and the update!

IIUC, the rust-analyzer is installed/updated on each indexing run, and it's using nightly.
The currently-running indexer for config5 uses rust-analyzer 1.94.0-nightly (21ff67d 2025-12-15), so the next indexing for the config4 should use the up-to-date nightly as well.
I'll close this bug once the next run finishes without the panic.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: