rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
96.28k stars 12.45k forks source link

range start index 351645 out of range for slice of length 16384 getting the resolver for lowering #119456

Closed mattfbacon closed 7 months ago

mattfbacon commented 7 months ago

Code

fn main() {
  println!("Hello world");
}

With github.com/typst/typst as a dependency.

Meta

rustc --version --verbose:

rustc 1.75.0 (82e1608df 2023-12-21)
binary: rustc
commit-hash: 82e1608dfa6e0b5569232559e3d385fea5a93112
commit-date: 2023-12-21
host: x86_64-unknown-linux-gnu
release: 1.75.0
LLVM version: 17.0.6

Error output

thread 'rustc' panicked at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/compiler/rustc_serialize/src/opaque.rs:233:42:
range start index 351645 out of range for slice of length 16384
stack backtrace:
   0:     0x7fe3f958b62c - std::backtrace_rs::backtrace::libunwind::trace::ha637c64ce894333a
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7fe3f958b62c - std::backtrace_rs::backtrace::trace_unsynchronized::h47f62dea28e0c88d
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fe3f958b62c - std::sys_common::backtrace::_print_fmt::h9eef0abe20ede486
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7fe3f958b62c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hed7f999df88cc644
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fe3f95de630 - core::fmt::rt::Argument::fmt::h1539a9308b8d058d
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/fmt/rt.rs:142:9
   5:     0x7fe3f95de630 - core::fmt::write::h3a39390d8560d9c9
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/fmt/mod.rs:1120:17
   6:     0x7fe3f957f54f - std::io::Write::write_fmt::h5fc9997dfe05f882
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/io/mod.rs:1762:15
   7:     0x7fe3f958b414 - std::sys_common::backtrace::_print::h894006fb5c6f3d45
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7fe3f958b414 - std::sys_common::backtrace::print::h23a2d212c6fff936
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7fe3f958e0a7 - std::panicking::default_hook::{{closure}}::h8a1d2ee00185001a
  10:     0x7fe3f958de0f - std::panicking::default_hook::h6038f2eba384e475
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:292:9
  11:     0x7fe3fc137190 - std[409886f6357001f0]::panicking::update_hook::<alloc[c1b021ad36e35877]::boxed::Box<rustc_driver_impl[7d23c5715ff089db]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7fe3f958e7e8 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h1f8f335eaa9cfaee
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/alloc/src/boxed.rs:2021:9
  13:     0x7fe3f958e7e8 - std::panicking::rust_panic_with_hook::h2b5517d590cab22e
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:783:13
  14:     0x7fe3f958e53e - std::panicking::begin_panic_handler::{{closure}}::h233112c06e0ef43e
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:657:13
  15:     0x7fe3f958baf6 - std::sys_common::backtrace::__rust_end_short_backtrace::h6e893f24d7ebbff8
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:170:18
  16:     0x7fe3f958e2a2 - rust_begin_unwind
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:645:5
  17:     0x7fe3f95dad15 - core::panicking::panic_fmt::hbf0e066aabfa482c
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/panicking.rs:72:14
  18:     0x7fe3f95e0f62 - core::slice::index::slice_start_index_len_fail_rt::h2cff72a74e55bc89
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/slice/index.rs:52:5
  19:     0x7fe3f95e0f62 - core::slice::index::slice_start_index_len_fail::h89a39d0ac724bb0b
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/slice/index.rs:40:9
  20:     0x7fe3fdf46011 - <rustc_metadata[21a965c5240b0d]::locator::CrateLocator>::extract_one
  21:     0x7fe3fdf44cca - <rustc_metadata[21a965c5240b0d]::locator::CrateLocator>::extract_lib
  22:     0x7fe3fde9c5e9 - <rustc_metadata[21a965c5240b0d]::creader::CrateLoader>::load
  23:     0x7fe3fe08b690 - <rustc_metadata[21a965c5240b0d]::creader::CrateLoader>::maybe_resolve_crate
  24:     0x7fe3fe088c41 - <rustc_metadata[21a965c5240b0d]::creader::CrateLoader>::resolve_crate
  25:     0x7fe3fdaf212f - <rustc_resolve[ec47402b5e317cbf]::Resolver>::resolve_path_with_ribs
  26:     0x7fe3fd666c93 - <rustc_resolve[ec47402b5e317cbf]::late::LateResolutionVisitor>::smart_resolve_path_fragment
  27:     0x7fe3fdffebb3 - <rustc_resolve[ec47402b5e317cbf]::late::LateResolutionVisitor as rustc_ast[b38fd0150461c9ea]::visit::Visitor>::visit_item
  28:     0x7fe3fdffcb8c - rustc_ast[b38fd0150461c9ea]::visit::walk_item::<rustc_resolve[ec47402b5e317cbf]::late::LateResolutionVisitor>
  29:     0x7fe3fe003f58 - <rustc_resolve[ec47402b5e317cbf]::late::LateResolutionVisitor as rustc_ast[b38fd0150461c9ea]::visit::Visitor>::visit_item
  30:     0x7fe3fe24ab24 - <rustc_resolve[ec47402b5e317cbf]::Resolver>::resolve_crate::{closure#0}
  31:     0x7fe3fe247e42 - <rustc_resolve[ec47402b5e317cbf]::Resolver>::resolve_crate
  32:     0x7fe3fe09c02b - rustc_interface[fbb0cb4be6c0ba34]::passes::resolver_for_lowering
  33:     0x7fe3fe09af89 - rustc_query_impl[664ae873a521fa7c]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[664ae873a521fa7c]::query_impl::resolver_for_lowering::dynamic_query::{closure#2}::{closure#0}, rustc_middle[aca4860da4e5a967]::query::erase::Erased<[u8; 8usize]>>
  34:     0x7fe3fe1068e5 - rustc_query_system[b5dcdc06a735d5f1]::query::plumbing::try_execute_query::<rustc_query_impl[664ae873a521fa7c]::DynamicConfig<rustc_query_system[b5dcdc06a735d5f1]::query::caches::SingleCache<rustc_middle[aca4860da4e5a967]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[664ae873a521fa7c]::plumbing::QueryCtxt, false>
  35:     0x7fe3fe106fc9 - rustc_query_impl[664ae873a521fa7c]::query_impl::resolver_for_lowering::get_query_non_incr::__rust_end_short_backtrace
  36:     0x7fe3fe206e46 - rustc_interface[fbb0cb4be6c0ba34]::interface::run_compiler::<core[21cdcf8e8af4c2d9]::result::Result<(), rustc_span[3d5dc97049ad8d50]::ErrorGuaranteed>, rustc_driver_impl[7d23c5715ff089db]::run_compiler::{closure#1}>::{closure#0}
  37:     0x7fe3fe20215b - std[409886f6357001f0]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[fbb0cb4be6c0ba34]::util::run_in_thread_with_globals<rustc_interface[fbb0cb4be6c0ba34]::interface::run_compiler<core[21cdcf8e8af4c2d9]::result::Result<(), rustc_span[3d5dc97049ad8d50]::ErrorGuaranteed>, rustc_driver_impl[7d23c5715ff089db]::run_compiler::{closure#1}>::{closure#0}, core[21cdcf8e8af4c2d9]::result::Result<(), rustc_span[3d5dc97049ad8d50]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[21cdcf8e8af4c2d9]::result::Result<(), rustc_span[3d5dc97049ad8d50]::ErrorGuaranteed>>
  38:     0x7fe3fe201fb3 - <<std[409886f6357001f0]::thread::Builder>::spawn_unchecked_<rustc_interface[fbb0cb4be6c0ba34]::util::run_in_thread_with_globals<rustc_interface[fbb0cb4be6c0ba34]::interface::run_compiler<core[21cdcf8e8af4c2d9]::result::Result<(), rustc_span[3d5dc97049ad8d50]::ErrorGuaranteed>, rustc_driver_impl[7d23c5715ff089db]::run_compiler::{closure#1}>::{closure#0}, core[21cdcf8e8af4c2d9]::result::Result<(), rustc_span[3d5dc97049ad8d50]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[21cdcf8e8af4c2d9]::result::Result<(), rustc_span[3d5dc97049ad8d50]::ErrorGuaranteed>>::{closure#1} as core[21cdcf8e8af4c2d9]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  39:     0x7fe3f95986a5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hc7eafaff61e32df9
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/alloc/src/boxed.rs:2007:9
  40:     0x7fe3f95986a5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6ba4a5de48dd2304
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/alloc/src/boxed.rs:2007:9
  41:     0x7fe3f95986a5 - std::sys::unix::thread::Thread::new::thread_start::he469335aef763e45
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys/unix/thread.rs:108:17
  42:     0x7fe3f93849eb - <unknown>
  43:     0x7fe3f94087cc - <unknown>
  44:                0x0 - <unknown>

error: 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.75.0 (82e1608df 2023-12-21) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type rlib -C embed-bitcode=no -C debuginfo=2 -C linker=clang -C link-arg=-fuse-ld=mold -C target-cpu=native

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

query stack during panic:
#0 [resolver_for_lowering] getting the resolver for lowering
end of query stack
error: could not compile `rustybuzz` (lib)

This is repeated for what seems like every parallel compilation unit.

mattfbacon commented 7 months ago

It appeared to be related to running out of space in the target directory.

saethlin commented 7 months ago

Thank you for opening the issue and that explanation. This is probably fixed by https://github.com/rust-lang/rust/pull/117301 (which will be in 1.76 but not 1.75) but I'll try to reproduce the crash just in case it isn't fixed by that.

saethlin commented 7 months ago

The reproducer script I cooked up for https://github.com/rust-lang/rust/pull/119510 reproduces this ICE backtrace on stable, so I'm linking this to that PR.