Skip to content

ICE: removal index (is 0) should be < len (is 0) / glacier fixed/81899.rs #88434

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

code from glacier fixed/81899.rs

const _CONST: &[u8] = &f(&[], |_| {});

const fn f<F>(_: &[u8], _: F) -> &[u8]
where
    F: FnMut(&u8),
{
    panic!()
}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.56.0-nightly (ac50a5335 2021-08-27)
binary: rustc
commit-hash: ac50a53359328a5d7f2f558833e63d59d372e4f7
commit-date: 2021-08-27
host: x86_64-unknown-linux-gnu
release: 1.56.0-nightly
LLVM version: 13.0.0

Error output

thread 'rustc' panicked at 'removal index (is 0) should be < len (is 0)', compiler/rustc_mir/src/borrow_check/region_infer/mod.rs:2148:26
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.56.0-nightly (ac50a5335 2021-08-27) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [mir_borrowck] borrow-checking `_CONST`
#1 [analysis] running analysis passes on this crate
end of query stack
Backtrace

thread 'rustc' panicked at 'removal index (is 0) should be < len (is 0)', compiler/rustc_mir/src/borrow_check/region_infer/mod.rs:2148:26
stack backtrace:
   0:     0x7f6afd08f26c - std::backtrace_rs::backtrace::libunwind::trace::hf16bab017f241aa7
                               at /rustc/ac50a53359328a5d7f2f558833e63d59d372e4f7/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7f6afd08f26c - std::backtrace_rs::backtrace::trace_unsynchronized::hfc27e8424e499412
                               at /rustc/ac50a53359328a5d7f2f558833e63d59d372e4f7/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f6afd08f26c - std::sys_common::backtrace::_print_fmt::h5be1efcd85b410a6
                               at /rustc/ac50a53359328a5d7f2f558833e63d59d372e4f7/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f6afd08f26c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h73cf7b443adc9274
                               at /rustc/ac50a53359328a5d7f2f558833e63d59d372e4f7/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7f6afd0ecf3c - core::fmt::write::h9a6d9c74526a6c1b
                               at /rustc/ac50a53359328a5d7f2f558833e63d59d372e4f7/library/core/src/fmt/mod.rs:1150:17
   5:     0x7f6afd080305 - std::io::Write::write_fmt::hb955fdedb1f691a8
                               at /rustc/ac50a53359328a5d7f2f558833e63d59d372e4f7/library/std/src/io/mod.rs:1667:15
   6:     0x7f6afd0927c0 - std::sys_common::backtrace::_print::hd5ba2c14c2d68f09
                               at /rustc/ac50a53359328a5d7f2f558833e63d59d372e4f7/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7f6afd0927c0 - std::sys_common::backtrace::print::h3b3d8e691bd3d5e8
                               at /rustc/ac50a53359328a5d7f2f558833e63d59d372e4f7/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7f6afd0927c0 - std::panicking::default_hook::{{closure}}::h703c292cd78e95a9
                               at /rustc/ac50a53359328a5d7f2f558833e63d59d372e4f7/library/std/src/panicking.rs:210:50
   9:     0x7f6afd09237b - std::panicking::default_hook::h23aea4a9b2140559
                               at /rustc/ac50a53359328a5d7f2f558833e63d59d372e4f7/library/std/src/panicking.rs:227:9
  10:     0x7f6afd864fb1 - rustc_driver::DEFAULT_HOOK::{{closure}}::{{closure}}::h470d093cda0f164a
  11:     0x7f6afd092fd9 - std::panicking::rust_panic_with_hook::hde97eb7782db5504
                               at /rustc/ac50a53359328a5d7f2f558833e63d59d372e4f7/library/std/src/panicking.rs:628:17
  12:     0x7f6afd092a90 - std::panicking::begin_panic_handler::{{closure}}::h531b374cb1cba3c4
                               at /rustc/ac50a53359328a5d7f2f558833e63d59d372e4f7/library/std/src/panicking.rs:521:13
  13:     0x7f6afd08f714 - std::sys_common::backtrace::__rust_end_short_backtrace::h170e7849f1857b98
                               at /rustc/ac50a53359328a5d7f2f558833e63d59d372e4f7/library/std/src/sys_common/backtrace.rs:141:18
  14:     0x7f6afd0929f9 - rust_begin_unwind
                               at /rustc/ac50a53359328a5d7f2f558833e63d59d372e4f7/library/std/src/panicking.rs:517:5
  15:     0x7f6afd058761 - core::panicking::panic_fmt::hcf5f6d96e1dd7099
                               at /rustc/ac50a53359328a5d7f2f558833e63d59d372e4f7/library/core/src/panicking.rs:101:14
  16:     0x7f6afd058562 - alloc::vec::Vec<T,A>::remove::assert_failed::h051d4dc566b2d8cf
                               at /rustc/ac50a53359328a5d7f2f558833e63d59d372e4f7/library/alloc/src/vec/mod.rs:1390:13
  17:     0x7f6afeeac476 - rustc_mir::borrow_check::region_infer::RegionInferenceContext::find_outlives_blame_span::h6eb564df239b09b8
  18:     0x7f6afee5a521 - rustc_mir::borrow_check::do_mir_borrowck::h51a94d100c5e3888
  19:     0x7f6afedcdf2a - rustc_infer::infer::InferCtxtBuilder::enter::h646b279d9c768cff
  20:     0x7f6afee57dcc - rustc_mir::borrow_check::mir_borrowck::h6c76a3d9979e297a
  21:     0x7f6afee4f9ea - core::ops::function::FnOnce::call_once::habe1f175ab86996b
  22:     0x7f6afeee5cc9 - rustc_query_system::query::plumbing::get_query_impl::h2ccb16f3af1c7b60
  23:     0x7f6afef7b80b - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_borrowck::h04071480a6190c53
  24:     0x7f6afe9af3c6 - rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::par_body_owners::h7dc05cca49a9f847
  25:     0x7f6aff378bc5 - rustc_interface::passes::analysis::h9dedef5d4f497722
  26:     0x7f6aff86af1f - rustc_query_system::query::plumbing::get_query_impl::h57cd2e389f82820b
  27:     0x7f6aff9ce4bd - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis::h71bb1ebf7eea66a8
  28:     0x7f6aff36f9a7 - rustc_interface::passes::QueryContext::enter::h8700e1ecccfeda2c
  29:     0x7f6aff356811 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::h0161b9a0a28c5115
  30:     0x7f6aff34392c - rustc_span::with_source_map::h4517cd205ea168e7
  31:     0x7f6aff356148 - scoped_tls::ScopedKey<T>::set::hf5457a6127e91291
  32:     0x7f6aff3440ab - std::sys_common::backtrace::__rust_begin_short_backtrace::h967f189214a28c38
  33:     0x7f6aff343095 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hbf5ef41d18b70b15
  34:     0x7f6afd09f633 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h132ab4ac45190c0c
                               at /rustc/ac50a53359328a5d7f2f558833e63d59d372e4f7/library/alloc/src/boxed.rs:1636:9
  35:     0x7f6afd09f633 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hf5feeb35085fa69e
                               at /rustc/ac50a53359328a5d7f2f558833e63d59d372e4f7/library/alloc/src/boxed.rs:1636:9
  36:     0x7f6afd09f633 - std::sys::unix::thread::Thread::new::thread_start::h21e4b7c982487240
                               at /rustc/ac50a53359328a5d7f2f558833e63d59d372e4f7/library/std/src/sys/unix/thread.rs:106:17
  37:     0x7f6afcfa8259 - start_thread
  38:     0x7f6afcebd5e3 - __GI___clone
  39:                0x0 - <unknown>

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.56.0-nightly (ac50a5335 2021-08-27) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [mir_borrowck] borrow-checking `_CONST`
#1 [analysis] running analysis passes on this crate
end of query stack

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions