Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE: 'index out of bounds: the len is 1 but the index is 1', compiler/rustc_lint/src/internal.rs:481:82 #111280

Closed
matthiaskrgr opened this issue May 6, 2023 · 3 comments · Fixed by #111289
Assignees
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented May 6, 2023

Code

rustc -Zuntable-options file.rs

fn parse_local() {
    struct_span_err(msg).emit();
}

Meta

rustc --version --verbose:

rustc 1.71.0-nightly (f9a6b7158 2023-05-05)
binary: rustc
commit-hash: f9a6b71580cd53dd4491d9bb6400f7ee841d9c22
commit-date: 2023-05-05
host: x86_64-unknown-linux-gnu
release: 1.71.0-nightly
LLVM version: 16.0.2

Error output

<output>
Backtrace

error[E0425]: cannot find value `msg` in this scope
 --> treereduce.out:2:20
  |
2 |    struct_span_err(msg).emit();
  |                    ^^^ not found in this scope

thread 'rustc' panicked at 'index out of bounds: the len is 1 but the index is 1', compiler/rustc_lint/src/internal.rs:481:82
stack backtrace:
   0:     0x7fc683f1e0d1 - std::backtrace_rs::backtrace::libunwind::trace::hc5cc5a7b57b58c57
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fc683f1e0d1 - std::backtrace_rs::backtrace::trace_unsynchronized::h8c88bdc231d617c1
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fc683f1e0d1 - std::sys_common::backtrace::_print_fmt::h0e5dc0d56b79c5f7
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7fc683f1e0d1 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h973cecc960c48c9f
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fc683f7ed9f - core::fmt::rt::Argument::fmt::he483a5677bdde3d9
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/core/src/fmt/rt.rs:138:9
   5:     0x7fc683f7ed9f - core::fmt::write::h17e471b2a1f54138
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/core/src/fmt/mod.rs:1094:21
   6:     0x7fc683f11111 - std::io::Write::write_fmt::hb44c5b0111a069d0
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/std/src/io/mod.rs:1712:15
   7:     0x7fc683f1dee5 - std::sys_common::backtrace::_print::h5923eda925dd6ba1
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7fc683f1dee5 - std::sys_common::backtrace::print::h566e5ff86e5942bd
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7fc683f20b77 - std::panicking::default_hook::{{closure}}::ha47eb115c9bbaf3b
  10:     0x7fc683f20964 - std::panicking::default_hook::h73f3c1afd91adbd8
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/std/src/panicking.rs:288:9
  11:     0x7fc682d837c5 - rustc_driver_impl[c0e409223ee7d3a7]::DEFAULT_HOOK::{closure#0}::{closure#0}
  12:     0x7fc683f21297 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h24ea620f6424be90
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/alloc/src/boxed.rs:1999:9
  13:     0x7fc683f21297 - std::panicking::rust_panic_with_hook::h8980a64edf93fb32
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/std/src/panicking.rs:695:13
  14:     0x7fc683f21017 - std::panicking::begin_panic_handler::{{closure}}::h6525d669adc9202e
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/std/src/panicking.rs:582:13
  15:     0x7fc683f1e516 - std::sys_common::backtrace::__rust_end_short_backtrace::h430e040c8a194032
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/std/src/sys_common/backtrace.rs:150:18
  16:     0x7fc683f20d82 - rust_begin_unwind
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/std/src/panicking.rs:578:5
  17:     0x7fc683f7b023 - core::panicking::panic_fmt::hbf5fcb80896261a7
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/core/src/panicking.rs:67:14
  18:     0x7fc683f7b182 - core::panicking::panic_bounds_check::h8bd6a5a617749418
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/core/src/panicking.rs:162:5
  19:     0x7fc68314126b - <core[ba2508254c353298]::slice::iter::Iter<(rustc_span[772d4278e54f258a]::symbol::Symbol, &thin_vec[2af43ab3db6bb794]::ThinVec<rustc_ast[bedbd59f126f6eff]::ptr::P<rustc_ast[bedbd59f126f6eff]::ast::Expr>>)> as core[ba2508254c353298]::iter::traits::iterator::Iterator>::all::<<rustc_lint[f589ffefbf661d2b]::internal::Diagnostics as rustc_lint[f589ffefbf661d2b]::passes::EarlyLintPass>::check_stmt::{closure#0}>
  20:     0x7fc683145537 - <rustc_lint[f589ffefbf661d2b]::internal::Diagnostics as rustc_lint[f589ffefbf661d2b]::passes::EarlyLintPass>::check_stmt
  21:     0x7fc683145b33 - <rustc_lint[f589ffefbf661d2b]::early::RuntimeCombinedEarlyLintPass as rustc_lint[f589ffefbf661d2b]::passes::EarlyLintPass>::check_stmt
  22:     0x7fc6830fdbc4 - <rustc_lint[f589ffefbf661d2b]::early::EarlyContextAndPass<rustc_lint[f589ffefbf661d2b]::early::RuntimeCombinedEarlyLintPass> as rustc_ast[bedbd59f126f6eff]::visit::Visitor>::visit_stmt
  23:     0x7fc68311dde7 - rustc_ast[bedbd59f126f6eff]::visit::walk_block::<rustc_lint[f589ffefbf661d2b]::early::EarlyContextAndPass<rustc_lint[f589ffefbf661d2b]::early::RuntimeCombinedEarlyLintPass>>
  24:     0x7fc6830ff3e5 - <rustc_lint[f589ffefbf661d2b]::early::EarlyContextAndPass<rustc_lint[f589ffefbf661d2b]::early::RuntimeCombinedEarlyLintPass> as rustc_ast[bedbd59f126f6eff]::visit::Visitor>::visit_fn
  25:     0x7fc68312076e - rustc_ast[bedbd59f126f6eff]::visit::walk_item::<rustc_lint[f589ffefbf661d2b]::early::EarlyContextAndPass<rustc_lint[f589ffefbf661d2b]::early::RuntimeCombinedEarlyLintPass>>
  26:     0x7fc6830fd8f2 - <rustc_lint[f589ffefbf661d2b]::early::EarlyContextAndPass<rustc_lint[f589ffefbf661d2b]::early::RuntimeCombinedEarlyLintPass> as rustc_ast[bedbd59f126f6eff]::visit::Visitor>::visit_item
  27:     0x7fc68311de2f - rustc_ast[bedbd59f126f6eff]::visit::walk_crate::<rustc_lint[f589ffefbf661d2b]::early::EarlyContextAndPass<rustc_lint[f589ffefbf661d2b]::early::RuntimeCombinedEarlyLintPass>>
  28:     0x7fc6830ee209 - <(&rustc_ast[bedbd59f126f6eff]::ast::Crate, &[rustc_ast[bedbd59f126f6eff]::ast::Attribute]) as rustc_lint[f589ffefbf661d2b]::early::EarlyCheckNode>::check::<rustc_lint[f589ffefbf661d2b]::early::RuntimeCombinedEarlyLintPass>
  29:     0x7fc6830fcc96 - rustc_lint[f589ffefbf661d2b]::early::check_ast_node_inner::<rustc_lint[f589ffefbf661d2b]::early::RuntimeCombinedEarlyLintPass, (&rustc_ast[bedbd59f126f6eff]::ast::Crate, &[rustc_ast[bedbd59f126f6eff]::ast::Attribute])>
  30:     0x7fc6823708c5 - rustc_lint[f589ffefbf661d2b]::early::check_ast_node::<rustc_lint[f589ffefbf661d2b]::BuiltinCombinedEarlyLintPass, (&rustc_ast[bedbd59f126f6eff]::ast::Crate, &[rustc_ast[bedbd59f126f6eff]::ast::Attribute])>
  31:     0x7fc68236ebb4 - rustc_interface[812d3fb677f9c4a2]::passes::early_lint_checks
  32:     0x7fc68250ac1a - rustc_query_system[2ad8c752138085b6]::query::plumbing::try_execute_query::<rustc_query_impl[ed33e76d3dd098ac]::queries::early_lint_checks, rustc_query_impl[ed33e76d3dd098ac]::plumbing::QueryCtxt>
  33:     0x7fc68250a8b3 - rustc_query_impl[ed33e76d3dd098ac]::get_query::early_lint_checks
  34:     0x7fc681a823bc - rustc_ast_lowering[973b6fb5ff52bbfc]::lower_to_hir
  35:     0x7fc68255ec9e - rustc_query_system[2ad8c752138085b6]::query::plumbing::try_execute_query::<rustc_query_impl[ed33e76d3dd098ac]::queries::hir_crate, rustc_query_impl[ed33e76d3dd098ac]::plumbing::QueryCtxt>
  36:     0x7fc68255e99a - rustc_query_impl[ed33e76d3dd098ac]::get_query::hir_crate
  37:     0x7fc68148f97c - rustc_query_system[2ad8c752138085b6]::query::plumbing::try_execute_query::<rustc_query_impl[ed33e76d3dd098ac]::queries::hir_attrs, rustc_query_impl[ed33e76d3dd098ac]::plumbing::QueryCtxt>
  38:     0x7fc680d9781f - <rustc_middle[121321bb00b342e0]::hir::map::Map>::attrs
  39:     0x7fc6825e06f3 - rustc_passes[ace0265fcbf17e34]::entry::entry_fn
  40:     0x7fc6825b49f1 - rustc_query_system[2ad8c752138085b6]::query::plumbing::try_execute_query::<rustc_query_impl[ed33e76d3dd098ac]::queries::entry_fn, rustc_query_impl[ed33e76d3dd098ac]::plumbing::QueryCtxt>
  41:     0x7fc6825b46ca - rustc_query_impl[ed33e76d3dd098ac]::get_query::entry_fn
  42:     0x7fc6822220d2 - <rustc_session[49ded5915b70c0ef]::session::Session>::time::<core[ba2508254c353298]::option::Option<(rustc_span[772d4278e54f258a]::def_id::DefId, rustc_session[49ded5915b70c0ef]::config::EntryFnType)>, rustc_interface[812d3fb677f9c4a2]::passes::analysis::{closure#0}::{closure#0}::{closure#0}>
  43:     0x7fc6822209a5 - <core[ba2508254c353298]::panic::unwind_safe::AssertUnwindSafe<rustc_interface[812d3fb677f9c4a2]::passes::analysis::{closure#0}::{closure#0}> as core[ba2508254c353298]::ops::function::FnOnce<()>>::call_once
  44:     0x7fc68221b62c - rustc_interface[812d3fb677f9c4a2]::passes::analysis
  45:     0x7fc682509e67 - rustc_query_system[2ad8c752138085b6]::query::plumbing::try_execute_query::<rustc_query_impl[ed33e76d3dd098ac]::queries::analysis, rustc_query_impl[ed33e76d3dd098ac]::plumbing::QueryCtxt>
  46:     0x7fc682509b83 - rustc_query_impl[ed33e76d3dd098ac]::get_query::analysis
  47:     0x7fc681fc456f - <rustc_middle[121321bb00b342e0]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[c0e409223ee7d3a7]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[ba2508254c353298]::result::Result<(), rustc_span[772d4278e54f258a]::ErrorGuaranteed>>
  48:     0x7fc681fc375f - <rustc_interface[812d3fb677f9c4a2]::interface::Compiler>::enter::<rustc_driver_impl[c0e409223ee7d3a7]::run_compiler::{closure#1}::{closure#2}, core[ba2508254c353298]::result::Result<core[ba2508254c353298]::option::Option<rustc_interface[812d3fb677f9c4a2]::queries::Linker>, rustc_span[772d4278e54f258a]::ErrorGuaranteed>>
  49:     0x7fc681fc0de5 - std[85c9d9b4ab7b6332]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[812d3fb677f9c4a2]::util::run_in_thread_pool_with_globals<rustc_interface[812d3fb677f9c4a2]::interface::run_compiler<core[ba2508254c353298]::result::Result<(), rustc_span[772d4278e54f258a]::ErrorGuaranteed>, rustc_driver_impl[c0e409223ee7d3a7]::run_compiler::{closure#1}>::{closure#0}, core[ba2508254c353298]::result::Result<(), rustc_span[772d4278e54f258a]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[ba2508254c353298]::result::Result<(), rustc_span[772d4278e54f258a]::ErrorGuaranteed>>
  50:     0x7fc68266aec5 - <<std[85c9d9b4ab7b6332]::thread::Builder>::spawn_unchecked_<rustc_interface[812d3fb677f9c4a2]::util::run_in_thread_pool_with_globals<rustc_interface[812d3fb677f9c4a2]::interface::run_compiler<core[ba2508254c353298]::result::Result<(), rustc_span[772d4278e54f258a]::ErrorGuaranteed>, rustc_driver_impl[c0e409223ee7d3a7]::run_compiler::{closure#1}>::{closure#0}, core[ba2508254c353298]::result::Result<(), rustc_span[772d4278e54f258a]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[ba2508254c353298]::result::Result<(), rustc_span[772d4278e54f258a]::ErrorGuaranteed>>::{closure#1} as core[ba2508254c353298]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  51:     0x7fc683f2b775 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hde1dca3219a28205
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/alloc/src/boxed.rs:1985:9
  52:     0x7fc683f2b775 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h43282d999bed8647
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/alloc/src/boxed.rs:1985:9
  53:     0x7fc683f2b775 - std::sys::unix::thread::Thread::new::thread_start::ha392fc38c0d3e9d4
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/std/src/sys/unix/thread.rs:108:17
  54:     0x7fc67fa9cbb5 - <unknown>
  55:     0x7fc67fb1ed90 - <unknown>
  56:                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.71.0-nightly (f9a6b7158 2023-05-05) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z unstable-options

query stack during panic:
thread 'rustc' panicked at 'already borrowed: BorrowMutError', /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/compiler/rustc_query_system/src/query/plumbing.rs:330:39
stack backtrace:
   0:     0x7fc683f1e0d1 - std::backtrace_rs::backtrace::libunwind::trace::hc5cc5a7b57b58c57
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fc683f1e0d1 - std::backtrace_rs::backtrace::trace_unsynchronized::h8c88bdc231d617c1
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fc683f1e0d1 - std::sys_common::backtrace::_print_fmt::h0e5dc0d56b79c5f7
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7fc683f1e0d1 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h973cecc960c48c9f
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fc683f7ed9f - core::fmt::rt::Argument::fmt::he483a5677bdde3d9
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/core/src/fmt/rt.rs:138:9
   5:     0x7fc683f7ed9f - core::fmt::write::h17e471b2a1f54138
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/core/src/fmt/mod.rs:1094:21
   6:     0x7fc683f11111 - std::io::Write::write_fmt::hb44c5b0111a069d0
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/std/src/io/mod.rs:1712:15
   7:     0x7fc683f1dee5 - std::sys_common::backtrace::_print::h5923eda925dd6ba1
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7fc683f1dee5 - std::sys_common::backtrace::print::h566e5ff86e5942bd
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7fc683f20b77 - std::panicking::default_hook::{{closure}}::ha47eb115c9bbaf3b
  10:     0x7fc683f20964 - std::panicking::default_hook::h73f3c1afd91adbd8
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/std/src/panicking.rs:288:9
  11:     0x7fc682d837c5 - rustc_driver_impl[c0e409223ee7d3a7]::DEFAULT_HOOK::{closure#0}::{closure#0}
  12:     0x7fc683f21297 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h24ea620f6424be90
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/alloc/src/boxed.rs:1999:9
  13:     0x7fc683f21297 - std::panicking::rust_panic_with_hook::h8980a64edf93fb32
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/std/src/panicking.rs:695:13
  14:     0x7fc683f21017 - std::panicking::begin_panic_handler::{{closure}}::h6525d669adc9202e
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/std/src/panicking.rs:582:13
  15:     0x7fc683f1e516 - std::sys_common::backtrace::__rust_end_short_backtrace::h430e040c8a194032
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/std/src/sys_common/backtrace.rs:150:18
  16:     0x7fc683f20d82 - rust_begin_unwind
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/std/src/panicking.rs:578:5
  17:     0x7fc683f7b023 - core::panicking::panic_fmt::hbf5fcb80896261a7
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/core/src/panicking.rs:67:14
  18:     0x7fc683f7b643 - core::result::unwrap_failed::haa291701862cd1bb
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/core/src/result.rs:1651:5
  19:     0x7fc68148fb3c - rustc_query_system[2ad8c752138085b6]::query::plumbing::try_execute_query::<rustc_query_impl[ed33e76d3dd098ac]::queries::hir_attrs, rustc_query_impl[ed33e76d3dd098ac]::plumbing::QueryCtxt>
  20:     0x7fc680d9781f - <rustc_middle[121321bb00b342e0]::hir::map::Map>::attrs
  21:     0x7fc6823ab2c4 - <rustc_middle[121321bb00b342e0]::middle::limits::provide::{closure#0} as core[ba2508254c353298]::ops::function::FnOnce<(rustc_middle[121321bb00b342e0]::ty::context::TyCtxt, ())>>::call_once
  22:     0x7fc682574a2e - rustc_query_system[2ad8c752138085b6]::query::plumbing::try_execute_query::<rustc_query_impl[ed33e76d3dd098ac]::queries::limits, rustc_query_impl[ed33e76d3dd098ac]::plumbing::QueryCtxt>
  23:     0x7fc682574684 - rustc_query_impl[ed33e76d3dd098ac]::get_query::limits
  24:     0x7fc680ef3978 - <rustc_middle[121321bb00b342e0]::ty::print::pretty::FmtPrinter>::new
  25:     0x7fc683231073 - <rustc_middle[121321bb00b342e0]::ty::context::TyCtxt>::def_path_str_with_substs::<rustc_hir[2a114f73b0e9925b]::hir_id::OwnerId>
  26:     0x7fc6832b6112 - rustc_middle[121321bb00b342e0]::query::descs::hir_attrs
  27:     0x7fc6836b188c - rustc_query_impl[ed33e76d3dd098ac]::plumbing::create_query_frame::<rustc_span[772d4278e54f258a]::def_id::LocalDefId>
  28:     0x7fc683710b7b - <rustc_query_impl[ed33e76d3dd098ac]::query_structs::hir_attrs::{closure#0}::{closure#0} as core[ba2508254c353298]::ops::function::FnOnce<(rustc_middle[121321bb00b342e0]::ty::context::TyCtxt, rustc_hir[2a114f73b0e9925b]::hir_id::OwnerId)>>::call_once
  29:     0x7fc6835cc7b6 - <rustc_query_system[2ad8c752138085b6]::query::plumbing::QueryState<rustc_hir[2a114f73b0e9925b]::hir_id::OwnerId, rustc_middle[121321bb00b342e0]::dep_graph::dep_node::DepKind>>::try_collect_active_jobs::<rustc_middle[121321bb00b342e0]::ty::context::TyCtxt>
  30:     0x7fc6836af21b - <rustc_query_impl[ed33e76d3dd098ac]::plumbing::QueryCtxt as rustc_query_system[2ad8c752138085b6]::query::QueryContext>::try_collect_active_jobs
  31:     0x7fc6830f94e5 - rustc_query_system[2ad8c752138085b6]::query::job::print_query_stack::<rustc_query_impl[ed33e76d3dd098ac]::plumbing::QueryCtxt>
  32:     0x7fc6830ecca9 - rustc_interface[812d3fb677f9c4a2]::interface::try_print_query_stack
  33:     0x7fc682d85ac2 - rustc_driver_impl[c0e409223ee7d3a7]::report_ice
  34:     0x7fc682d83809 - rustc_driver_impl[c0e409223ee7d3a7]::DEFAULT_HOOK::{closure#0}::{closure#0}
  35:     0x7fc683f21297 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h24ea620f6424be90
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/alloc/src/boxed.rs:1999:9
  36:     0x7fc683f21297 - std::panicking::rust_panic_with_hook::h8980a64edf93fb32
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/std/src/panicking.rs:695:13
  37:     0x7fc683f21017 - std::panicking::begin_panic_handler::{{closure}}::h6525d669adc9202e
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/std/src/panicking.rs:582:13
  38:     0x7fc683f1e516 - std::sys_common::backtrace::__rust_end_short_backtrace::h430e040c8a194032
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/std/src/sys_common/backtrace.rs:150:18
  39:     0x7fc683f20d82 - rust_begin_unwind
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/std/src/panicking.rs:578:5
  40:     0x7fc683f7b023 - core::panicking::panic_fmt::hbf5fcb80896261a7
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/core/src/panicking.rs:67:14
  41:     0x7fc683f7b182 - core::panicking::panic_bounds_check::h8bd6a5a617749418
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/core/src/panicking.rs:162:5
  42:     0x7fc68314126b - <core[ba2508254c353298]::slice::iter::Iter<(rustc_span[772d4278e54f258a]::symbol::Symbol, &thin_vec[2af43ab3db6bb794]::ThinVec<rustc_ast[bedbd59f126f6eff]::ptr::P<rustc_ast[bedbd59f126f6eff]::ast::Expr>>)> as core[ba2508254c353298]::iter::traits::iterator::Iterator>::all::<<rustc_lint[f589ffefbf661d2b]::internal::Diagnostics as rustc_lint[f589ffefbf661d2b]::passes::EarlyLintPass>::check_stmt::{closure#0}>
  43:     0x7fc683145537 - <rustc_lint[f589ffefbf661d2b]::internal::Diagnostics as rustc_lint[f589ffefbf661d2b]::passes::EarlyLintPass>::check_stmt
  44:     0x7fc683145b33 - <rustc_lint[f589ffefbf661d2b]::early::RuntimeCombinedEarlyLintPass as rustc_lint[f589ffefbf661d2b]::passes::EarlyLintPass>::check_stmt
  45:     0x7fc6830fdbc4 - <rustc_lint[f589ffefbf661d2b]::early::EarlyContextAndPass<rustc_lint[f589ffefbf661d2b]::early::RuntimeCombinedEarlyLintPass> as rustc_ast[bedbd59f126f6eff]::visit::Visitor>::visit_stmt
  46:     0x7fc68311dde7 - rustc_ast[bedbd59f126f6eff]::visit::walk_block::<rustc_lint[f589ffefbf661d2b]::early::EarlyContextAndPass<rustc_lint[f589ffefbf661d2b]::early::RuntimeCombinedEarlyLintPass>>
  47:     0x7fc6830ff3e5 - <rustc_lint[f589ffefbf661d2b]::early::EarlyContextAndPass<rustc_lint[f589ffefbf661d2b]::early::RuntimeCombinedEarlyLintPass> as rustc_ast[bedbd59f126f6eff]::visit::Visitor>::visit_fn
  48:     0x7fc68312076e - rustc_ast[bedbd59f126f6eff]::visit::walk_item::<rustc_lint[f589ffefbf661d2b]::early::EarlyContextAndPass<rustc_lint[f589ffefbf661d2b]::early::RuntimeCombinedEarlyLintPass>>
  49:     0x7fc6830fd8f2 - <rustc_lint[f589ffefbf661d2b]::early::EarlyContextAndPass<rustc_lint[f589ffefbf661d2b]::early::RuntimeCombinedEarlyLintPass> as rustc_ast[bedbd59f126f6eff]::visit::Visitor>::visit_item
  50:     0x7fc68311de2f - rustc_ast[bedbd59f126f6eff]::visit::walk_crate::<rustc_lint[f589ffefbf661d2b]::early::EarlyContextAndPass<rustc_lint[f589ffefbf661d2b]::early::RuntimeCombinedEarlyLintPass>>
  51:     0x7fc6830ee209 - <(&rustc_ast[bedbd59f126f6eff]::ast::Crate, &[rustc_ast[bedbd59f126f6eff]::ast::Attribute]) as rustc_lint[f589ffefbf661d2b]::early::EarlyCheckNode>::check::<rustc_lint[f589ffefbf661d2b]::early::RuntimeCombinedEarlyLintPass>
  52:     0x7fc6830fcc96 - rustc_lint[f589ffefbf661d2b]::early::check_ast_node_inner::<rustc_lint[f589ffefbf661d2b]::early::RuntimeCombinedEarlyLintPass, (&rustc_ast[bedbd59f126f6eff]::ast::Crate, &[rustc_ast[bedbd59f126f6eff]::ast::Attribute])>
  53:     0x7fc6823708c5 - rustc_lint[f589ffefbf661d2b]::early::check_ast_node::<rustc_lint[f589ffefbf661d2b]::BuiltinCombinedEarlyLintPass, (&rustc_ast[bedbd59f126f6eff]::ast::Crate, &[rustc_ast[bedbd59f126f6eff]::ast::Attribute])>
  54:     0x7fc68236ebb4 - rustc_interface[812d3fb677f9c4a2]::passes::early_lint_checks
  55:     0x7fc68250ac1a - rustc_query_system[2ad8c752138085b6]::query::plumbing::try_execute_query::<rustc_query_impl[ed33e76d3dd098ac]::queries::early_lint_checks, rustc_query_impl[ed33e76d3dd098ac]::plumbing::QueryCtxt>
  56:     0x7fc68250a8b3 - rustc_query_impl[ed33e76d3dd098ac]::get_query::early_lint_checks
  57:     0x7fc681a823bc - rustc_ast_lowering[973b6fb5ff52bbfc]::lower_to_hir
  58:     0x7fc68255ec9e - rustc_query_system[2ad8c752138085b6]::query::plumbing::try_execute_query::<rustc_query_impl[ed33e76d3dd098ac]::queries::hir_crate, rustc_query_impl[ed33e76d3dd098ac]::plumbing::QueryCtxt>
  59:     0x7fc68255e99a - rustc_query_impl[ed33e76d3dd098ac]::get_query::hir_crate
  60:     0x7fc68148f97c - rustc_query_system[2ad8c752138085b6]::query::plumbing::try_execute_query::<rustc_query_impl[ed33e76d3dd098ac]::queries::hir_attrs, rustc_query_impl[ed33e76d3dd098ac]::plumbing::QueryCtxt>
  61:     0x7fc680d9781f - <rustc_middle[121321bb00b342e0]::hir::map::Map>::attrs
  62:     0x7fc6825e06f3 - rustc_passes[ace0265fcbf17e34]::entry::entry_fn
  63:     0x7fc6825b49f1 - rustc_query_system[2ad8c752138085b6]::query::plumbing::try_execute_query::<rustc_query_impl[ed33e76d3dd098ac]::queries::entry_fn, rustc_query_impl[ed33e76d3dd098ac]::plumbing::QueryCtxt>
  64:     0x7fc6825b46ca - rustc_query_impl[ed33e76d3dd098ac]::get_query::entry_fn
  65:     0x7fc6822220d2 - <rustc_session[49ded5915b70c0ef]::session::Session>::time::<core[ba2508254c353298]::option::Option<(rustc_span[772d4278e54f258a]::def_id::DefId, rustc_session[49ded5915b70c0ef]::config::EntryFnType)>, rustc_interface[812d3fb677f9c4a2]::passes::analysis::{closure#0}::{closure#0}::{closure#0}>
  66:     0x7fc6822209a5 - <core[ba2508254c353298]::panic::unwind_safe::AssertUnwindSafe<rustc_interface[812d3fb677f9c4a2]::passes::analysis::{closure#0}::{closure#0}> as core[ba2508254c353298]::ops::function::FnOnce<()>>::call_once
  67:     0x7fc68221b62c - rustc_interface[812d3fb677f9c4a2]::passes::analysis
  68:     0x7fc682509e67 - rustc_query_system[2ad8c752138085b6]::query::plumbing::try_execute_query::<rustc_query_impl[ed33e76d3dd098ac]::queries::analysis, rustc_query_impl[ed33e76d3dd098ac]::plumbing::QueryCtxt>
  69:     0x7fc682509b83 - rustc_query_impl[ed33e76d3dd098ac]::get_query::analysis
  70:     0x7fc681fc456f - <rustc_middle[121321bb00b342e0]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[c0e409223ee7d3a7]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[ba2508254c353298]::result::Result<(), rustc_span[772d4278e54f258a]::ErrorGuaranteed>>
  71:     0x7fc681fc375f - <rustc_interface[812d3fb677f9c4a2]::interface::Compiler>::enter::<rustc_driver_impl[c0e409223ee7d3a7]::run_compiler::{closure#1}::{closure#2}, core[ba2508254c353298]::result::Result<core[ba2508254c353298]::option::Option<rustc_interface[812d3fb677f9c4a2]::queries::Linker>, rustc_span[772d4278e54f258a]::ErrorGuaranteed>>
  72:     0x7fc681fc0de5 - std[85c9d9b4ab7b6332]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[812d3fb677f9c4a2]::util::run_in_thread_pool_with_globals<rustc_interface[812d3fb677f9c4a2]::interface::run_compiler<core[ba2508254c353298]::result::Result<(), rustc_span[772d4278e54f258a]::ErrorGuaranteed>, rustc_driver_impl[c0e409223ee7d3a7]::run_compiler::{closure#1}>::{closure#0}, core[ba2508254c353298]::result::Result<(), rustc_span[772d4278e54f258a]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[ba2508254c353298]::result::Result<(), rustc_span[772d4278e54f258a]::ErrorGuaranteed>>
  73:     0x7fc68266aec5 - <<std[85c9d9b4ab7b6332]::thread::Builder>::spawn_unchecked_<rustc_interface[812d3fb677f9c4a2]::util::run_in_thread_pool_with_globals<rustc_interface[812d3fb677f9c4a2]::interface::run_compiler<core[ba2508254c353298]::result::Result<(), rustc_span[772d4278e54f258a]::ErrorGuaranteed>, rustc_driver_impl[c0e409223ee7d3a7]::run_compiler::{closure#1}>::{closure#0}, core[ba2508254c353298]::result::Result<(), rustc_span[772d4278e54f258a]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[ba2508254c353298]::result::Result<(), rustc_span[772d4278e54f258a]::ErrorGuaranteed>>::{closure#1} as core[ba2508254c353298]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  74:     0x7fc683f2b775 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hde1dca3219a28205
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/alloc/src/boxed.rs:1985:9
  75:     0x7fc683f2b775 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h43282d999bed8647
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/alloc/src/boxed.rs:1985:9
  76:     0x7fc683f2b775 - std::sys::unix::thread::Thread::new::thread_start::ha392fc38c0d3e9d4
                               at /rustc/f9a6b71580cd53dd4491d9bb6400f7ee841d9c22/library/std/src/sys/unix/thread.rs:108:17
  77:     0x7fc67fa9cbb5 - <unknown>
  78:     0x7fc67fb1ed90 - <unknown>
  79:                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.71.0-nightly (f9a6b7158 2023-05-05) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z unstable-options

query stack during panic:
#0 [limits] looking up limits
#1 [early_lint_checks] perform lints prior to macro expansion
#2 [hir_crate] getting the crate HIR
end of query stack
thread panicked while panicking. aborting.
[1]    3569776 IOT instruction  rustc treereduce.out -Zunstable-options

@matthiaskrgr matthiaskrgr added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue labels May 6, 2023
@compiler-errors
Copy link
Member

compiler-errors commented May 6, 2023

@matthiaskrgr, I've seen this on a few ICE reports, but I'd recommend putting the first ICE in the title instead of any other subsequent ICE messages, since this:

thread 'rustc' panicked at 'index out of bounds: the len is 1 but the index is 1', compiler/rustc_lint/src/internal.rs:481:82

really is the root cause of this issue, and the second one (mentioning BorrowMutError) is just a side-effect of panicking during certain queries 😸

@matthiaskrgr matthiaskrgr changed the title ICE: already borrowed: BorrowMutError ICE: 'index out of bounds: the len is 1 but the index is 1', compiler/rustc_lint/src/internal.rs:481:82 May 6, 2023
@matthiaskrgr
Copy link
Member Author

searched toolchains nightly-2023-04-21 through nightly-2023-05-06
Regression in nightly-2023-04-27
Regression in 1c42cb4
Regression in rust-lang-ci@34bfa43
#108760 cc @clubby789

@clubby789
Copy link
Contributor

Oops
@rustbot claim

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue May 6, 2023
Check arguments length in trivial diagnostic lint

Fixes rust-lang#111280
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue May 6, 2023
Check arguments length in trivial diagnostic lint

Fixes rust-lang#111280
@bors bors closed this as completed in 1de257b May 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants