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: Region parameter out of range when substituting in region #114285

Closed
niluxv opened this issue Jul 31, 2023 · 1 comment · Fixed by #114602
Closed

ICE: Region parameter out of range when substituting in region #114285

niluxv opened this issue Jul 31, 2023 · 1 comment · Fixed by #114602
Assignees
Labels
C-bug Category: This is a bug. 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.

Comments

@niluxv
Copy link
Contributor

niluxv commented Jul 31, 2023

While compiling the diagnostics subcrate of texlab with recent nightlies.

Code

pub struct Key;
#[derive(Clone)]
pub struct Value;

use std::collections::HashMap;

pub struct DiagnosticBuilder<'db> {
    inner: HashMap<&'db Key, Vec<&'db Value>>,
}

impl<'db> DiagnosticBuilder<'db> {
    pub fn iter(&self) -> impl Iterator<Item = (&'db Key, impl Iterator<Item = &Value>)> {
        self.inner
            .iter()
            .map(|(key, values)| (*key, values.iter().map(|v| *v)))
    }
}

playground

Meta

With stable (1.71.0) and beta (1.72.0-beta.3) it compiles fine.

rustc --version --verbose:

rustc 1.73.0-nightly (32303b219 2023-07-29)
binary: rustc
commit-hash: 32303b219d4dffa447aa606bc11c7a648f44a862
commit-date: 2023-07-29
host: x86_64-unknown-linux-gnu
release: 1.73.0-nightly
LLVM version: 16.0.5

Error output

error: internal compiler error: compiler/rustc_middle/src/ty/generic_args.rs:808:13: Region parameter out of range when substituting in region '_ (index=2, args = [ReEarlyBound(DefId(0:207 ~ diagnostics[32bc]::{impl#0}::'db), 0, 'db), ReLateBound(DebruijnIndex(1), BoundRegion { var: 0, kind: BrNamed(DefId(0:402 ~ diagnostics[32bc]::{impl#0}::iter::'_), '_) })])
Backtrace

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/compiler/rustc_errors/src/lib.rs:1645:9
stack backtrace:
   0:     0x7f3b46362fc1 - std::backtrace_rs::backtrace::libunwind::trace::he692921cd71061da
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f3b46362fc1 - std::backtrace_rs::backtrace::trace_unsynchronized::h268323222e8c1ab8
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f3b46362fc1 - std::sys_common::backtrace::_print_fmt::haee60c61afbc4ed3
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f3b46362fc1 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd36c36e4b57d240a
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f3b463c949c - core::fmt::rt::Argument::fmt::h0bae45bdae59332b
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/core/src/fmt/rt.rs:138:9
   5:     0x7f3b463c949c - core::fmt::write::h1eff66863ae03e81
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/core/src/fmt/mod.rs:1094:21
   6:     0x7f3b463557ae - std::io::Write::write_fmt::ha8cad047da0cc87b
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/std/src/io/mod.rs:1714:15
   7:     0x7f3b46362dd5 - std::sys_common::backtrace::_print::h55c2e79c6c43fc91
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f3b46362dd5 - std::sys_common::backtrace::print::ha1cd10f2ad29b00d
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f3b46365e2a - std::panicking::panic_hook_with_disk_dump::{{closure}}::h1c11dff971492549
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/std/src/panicking.rs:278:22
  10:     0x7f3b46365996 - std::panicking::panic_hook_with_disk_dump::hffdc434b289dce74
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/std/src/panicking.rs:305:9
  11:     0x7f3b49617f39 - rustc_driver_impl[2f0949cc27d93100]::install_ice_hook::{closure#0}
  12:     0x7f3b463666d0 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h85e1510843a93c91
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/alloc/src/boxed.rs:2021:9
  13:     0x7f3b463666d0 - std::panicking::rust_panic_with_hook::hf537c3fb4549c7ab
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/std/src/panicking.rs:733:13
  14:     0x7f3b49be3271 - std[ec332d703e613242]::panicking::begin_panic::<rustc_errors[e840185ed010efcf]::ExplicitBug>::{closure#0}
  15:     0x7f3b49be1cd6 - std[ec332d703e613242]::sys_common::backtrace::__rust_end_short_backtrace::<std[ec332d703e613242]::panicking::begin_panic<rustc_errors[e840185ed010efcf]::ExplicitBug>::{closure#0}, !>
  16:     0x7f3b49ba3ab6 - std[ec332d703e613242]::panicking::begin_panic::<rustc_errors[e840185ed010efcf]::ExplicitBug>
  17:     0x7f3b49bda934 - <rustc_errors[e840185ed010efcf]::HandlerInner>::bug::<alloc[3f9bbb105762381e]::string::String>
  18:     0x7f3b49bda7c6 - <rustc_errors[e840185ed010efcf]::Handler>::bug::<alloc[3f9bbb105762381e]::string::String>
  19:     0x7f3b49bc084c - rustc_middle[e8d608d57e197328]::util::bug::opt_span_bug_fmt::<rustc_span[3261ff60f64e7044]::span_encoding::Span>::{closure#0}
  20:     0x7f3b49bbf64a - rustc_middle[e8d608d57e197328]::ty::context::tls::with_opt::<rustc_middle[e8d608d57e197328]::util::bug::opt_span_bug_fmt<rustc_span[3261ff60f64e7044]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7f3b49bbf618 - rustc_middle[e8d608d57e197328]::ty::context::tls::with_context_opt::<rustc_middle[e8d608d57e197328]::ty::context::tls::with_opt<rustc_middle[e8d608d57e197328]::util::bug::opt_span_bug_fmt<rustc_span[3261ff60f64e7044]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7f3b47fa4c60 - rustc_middle[e8d608d57e197328]::util::bug::bug_fmt
  23:     0x7f3b49bd3cf1 - <rustc_middle[e8d608d57e197328]::ty::generic_args::ArgFolder as rustc_type_ir[982dbabe9c9a37e2]::fold::TypeFolder<rustc_middle[e8d608d57e197328]::ty::context::TyCtxt>>::fold_region::region_param_out_of_range
  24:     0x7f3b476945e0 - <rustc_middle[e8d608d57e197328]::ty::generic_args::GenericArg as rustc_type_ir[982dbabe9c9a37e2]::fold::TypeFoldable<rustc_middle[e8d608d57e197328]::ty::context::TyCtxt>>::try_fold_with::<rustc_middle[e8d608d57e197328]::ty::generic_args::ArgFolder>
  25:     0x7f3b4768e76f - <rustc_middle[e8d608d57e197328]::ty::Ty as rustc_type_ir[982dbabe9c9a37e2]::fold::TypeSuperFoldable<rustc_middle[e8d608d57e197328]::ty::context::TyCtxt>>::try_super_fold_with::<rustc_middle[e8d608d57e197328]::ty::generic_args::ArgFolder>
  26:     0x7f3b476944fa - <rustc_middle[e8d608d57e197328]::ty::generic_args::GenericArg as rustc_type_ir[982dbabe9c9a37e2]::fold::TypeFoldable<rustc_middle[e8d608d57e197328]::ty::context::TyCtxt>>::try_fold_with::<rustc_middle[e8d608d57e197328]::ty::generic_args::ArgFolder>
  27:     0x7f3b4768e76f - <rustc_middle[e8d608d57e197328]::ty::Ty as rustc_type_ir[982dbabe9c9a37e2]::fold::TypeSuperFoldable<rustc_middle[e8d608d57e197328]::ty::context::TyCtxt>>::try_super_fold_with::<rustc_middle[e8d608d57e197328]::ty::generic_args::ArgFolder>
  28:     0x7f3b486ce2e3 - rustc_hir_analysis[ac900bc9cb535ca9]::check::check::check_mod_item_types
  29:     0x7f3b4825d85c - rustc_query_impl[7a7d4cbbbc398ddf]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[7a7d4cbbbc398ddf]::query_impl::check_mod_item_types::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e8d608d57e197328]::query::erase::Erased<[u8; 0usize]>>
  30:     0x7f3b4825d83e - <rustc_query_impl[7a7d4cbbbc398ddf]::query_impl::check_mod_item_types::dynamic_query::{closure#2} as core[7c3dc332a8e1c229]::ops::function::FnOnce<(rustc_middle[e8d608d57e197328]::ty::context::TyCtxt, rustc_span[3261ff60f64e7044]::def_id::LocalDefId)>>::call_once
  31:     0x7f3b4825a9b0 - rustc_query_system[86f95befa84333f8]::query::plumbing::try_execute_query::<rustc_query_impl[7a7d4cbbbc398ddf]::DynamicConfig<rustc_query_system[86f95befa84333f8]::query::caches::VecCache<rustc_span[3261ff60f64e7044]::def_id::LocalDefId, rustc_middle[e8d608d57e197328]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[7a7d4cbbbc398ddf]::plumbing::QueryCtxt, true>
  32:     0x7f3b48f7c1b2 - rustc_query_impl[7a7d4cbbbc398ddf]::query_impl::check_mod_item_types::get_query_incr::__rust_end_short_backtrace
  33:     0x7f3b489f7f67 - <rustc_middle[e8d608d57e197328]::hir::map::Map>::for_each_module::<rustc_hir_analysis[ac900bc9cb535ca9]::check_crate::{closure#6}::{closure#0}>
  34:     0x7f3b489f665f - rustc_hir_analysis[ac900bc9cb535ca9]::check_crate
  35:     0x7f3b489f1c6a - rustc_interface[3259f0f1c0f54e17]::passes::analysis
  36:     0x7f3b48b16a4a - rustc_query_impl[7a7d4cbbbc398ddf]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[7a7d4cbbbc398ddf]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e8d608d57e197328]::query::erase::Erased<[u8; 1usize]>>
  37:     0x7f3b48b16a39 - <rustc_query_impl[7a7d4cbbbc398ddf]::query_impl::analysis::dynamic_query::{closure#2} as core[7c3dc332a8e1c229]::ops::function::FnOnce<(rustc_middle[e8d608d57e197328]::ty::context::TyCtxt, ())>>::call_once
  38:     0x7f3b48dfadf6 - rustc_query_system[86f95befa84333f8]::query::plumbing::try_execute_query::<rustc_query_impl[7a7d4cbbbc398ddf]::DynamicConfig<rustc_query_system[86f95befa84333f8]::query::caches::SingleCache<rustc_middle[e8d608d57e197328]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[7a7d4cbbbc398ddf]::plumbing::QueryCtxt, true>
  39:     0x7f3b48dfa96e - rustc_query_impl[7a7d4cbbbc398ddf]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
  40:     0x7f3b4888e4d5 - <rustc_middle[e8d608d57e197328]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[2f0949cc27d93100]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[7c3dc332a8e1c229]::result::Result<(), rustc_span[3261ff60f64e7044]::ErrorGuaranteed>>
  41:     0x7f3b4888db02 - <rustc_interface[3259f0f1c0f54e17]::interface::Compiler>::enter::<rustc_driver_impl[2f0949cc27d93100]::run_compiler::{closure#1}::{closure#2}, core[7c3dc332a8e1c229]::result::Result<core[7c3dc332a8e1c229]::option::Option<rustc_interface[3259f0f1c0f54e17]::queries::Linker>, rustc_span[3261ff60f64e7044]::ErrorGuaranteed>>
  42:     0x7f3b48886bb8 - std[ec332d703e613242]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[3259f0f1c0f54e17]::util::run_in_thread_pool_with_globals<rustc_interface[3259f0f1c0f54e17]::interface::run_compiler<core[7c3dc332a8e1c229]::result::Result<(), rustc_span[3261ff60f64e7044]::ErrorGuaranteed>, rustc_driver_impl[2f0949cc27d93100]::run_compiler::{closure#1}>::{closure#0}, core[7c3dc332a8e1c229]::result::Result<(), rustc_span[3261ff60f64e7044]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[7c3dc332a8e1c229]::result::Result<(), rustc_span[3261ff60f64e7044]::ErrorGuaranteed>>
  43:     0x7f3b4888633e - <<std[ec332d703e613242]::thread::Builder>::spawn_unchecked_<rustc_interface[3259f0f1c0f54e17]::util::run_in_thread_pool_with_globals<rustc_interface[3259f0f1c0f54e17]::interface::run_compiler<core[7c3dc332a8e1c229]::result::Result<(), rustc_span[3261ff60f64e7044]::ErrorGuaranteed>, rustc_driver_impl[2f0949cc27d93100]::run_compiler::{closure#1}>::{closure#0}, core[7c3dc332a8e1c229]::result::Result<(), rustc_span[3261ff60f64e7044]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[7c3dc332a8e1c229]::result::Result<(), rustc_span[3261ff60f64e7044]::ErrorGuaranteed>>::{closure#1} as core[7c3dc332a8e1c229]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  44:     0x7f3b46370dc5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hc5b9f463e020ec3e
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/alloc/src/boxed.rs:2007:9
  45:     0x7f3b46370dc5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h140e20c91de13bb4
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/alloc/src/boxed.rs:2007:9
  46:     0x7f3b46370dc5 - std::sys::unix::thread::Thread::new::thread_start::hfad7ee6626cdd5ae
                               at /rustc/32303b219d4dffa447aa606bc11c7a648f44a862/library/std/src/sys/unix/thread.rs:108:17
  47:     0x7f3b4608f18a - start_thread
                               at ./nptl/pthread_create.c:444:8
  48:     0x7f3b4611dbd0 - __GI___clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
  49:                0x0 - <unknown>


rustc version: 1.73.0-nightly (32303b219 2023-07-29)
platform: x86_64-unknown-linux-gnu

query stack during panic:
#0 [check_mod_item_types] checking item types in top-level module
#1 [analysis] running analysis passes on this crate
end of query stack

@niluxv niluxv added C-bug Category: This is a bug. 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. labels Jul 31, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 31, 2023
@lqd
Copy link
Member

lqd commented Jul 31, 2023

bisected to nightly-2023-07-27, rollup #114076, unrolled perf build for #113661 cc @oli-obk

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) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
5 participants