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: report_selection_error did not emit an error #112293

Closed
matthiaskrgr opened this issue Jun 4, 2023 · 2 comments · Fixed by #112303
Closed

ICE: report_selection_error did not emit an error #112293

matthiaskrgr opened this issue Jun 4, 2023 · 2 comments · Fixed by #112303
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

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Jun 4, 2023

Code

struct ST3<'a>(&'a i32);

impl<'a> ST3<'a> {
    fn type_alias(self) {
        let _opt: Option<Self> = Some(0).map(Self);
    }
}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.72.0-nightly (398fa2187 2023-06-03)
binary: rustc
commit-hash: 398fa2187c88de46c13c142f600064483a563c86
commit-date: 2023-06-03
host: x86_64-unknown-linux-gnu
release: 1.72.0-nightly
LLVM version: 16.0.4

Error output

<output>
Backtrace

thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 0', /cargo/registry/src/index.crates.io-6f17d22bba15001f/ena-0.14.2/src/snapshot_vec.rs:199:10
stack backtrace:
   0:     0x7f39e0f69bc1 - std::backtrace_rs::backtrace::libunwind::trace::h3746d9da3fce0c89
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f39e0f69bc1 - std::backtrace_rs::backtrace::trace_unsynchronized::hb22c8868d0c6ddc4
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f39e0f69bc1 - std::sys_common::backtrace::_print_fmt::h6efce3fb8f8916d2
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f39e0f69bc1 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h231c49729c204f24
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f39e0fca19f - core::fmt::rt::Argument::fmt::h9d9a01dce9616182
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/core/src/fmt/rt.rs:138:9
   5:     0x7f39e0fca19f - core::fmt::write::h7c911ba9bb1b7f5b
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/core/src/fmt/mod.rs:1094:21
   6:     0x7f39e0f5ce71 - std::io::Write::write_fmt::h901432478ccb3614
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/std/src/io/mod.rs:1713:15
   7:     0x7f39e0f699d5 - std::sys_common::backtrace::_print::h9834cbc9ab2c1f67
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f39e0f699d5 - std::sys_common::backtrace::print::h2e0fe58f84439b47
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f39e0f6c697 - std::panicking::default_hook::{{closure}}::hde864a3c143ecbbd
  10:     0x7f39e0f6c484 - std::panicking::default_hook::h2207b05fdedc08ce
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/std/src/panicking.rs:288:9
  11:     0x7f39e41a583b - rustc_driver_impl[fa5b9237e02b60ed]::install_ice_hook::{closure#0}
  12:     0x7f39e0f6cddd - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hb513c8b00f8e1160
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/alloc/src/boxed.rs:1999:9
  13:     0x7f39e0f6cddd - std::panicking::rust_panic_with_hook::h3a37bf9048506528
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/std/src/panicking.rs:709:13
  14:     0x7f39e0f6cb77 - std::panicking::begin_panic_handler::{{closure}}::h01ecc692a3fbee86
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/std/src/panicking.rs:597:13
  15:     0x7f39e0f69ff6 - std::sys_common::backtrace::__rust_end_short_backtrace::ha5aa2b230f0b7cfb
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/std/src/sys_common/backtrace.rs:151:18
  16:     0x7f39e0f6c8c2 - rust_begin_unwind
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/std/src/panicking.rs:593:5
  17:     0x7f39e0fc6423 - core::panicking::panic_fmt::hdd65235218858022
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/core/src/panicking.rs:67:14
  18:     0x7f39e0fc6582 - core::panicking::panic_bounds_check::h0fb4635391296670
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/core/src/panicking.rs:162:5
  19:     0x7f39e2214913 - <rustc_infer[8931c3b5ad764c67]::infer::InferCtxt>::opportunistic_resolve_int_var
  20:     0x7f39e220f3bc - <rustc_infer[8931c3b5ad764c67]::infer::canonical::canonicalizer::Canonicalizer as rustc_type_ir[c37869d76dc9c71f]::fold::TypeFolder<rustc_middle[7c6d68ebc026a18c]::ty::context::TyCtxt>>::fold_ty
  21:     0x7f39e2af669e - <&rustc_middle[7c6d68ebc026a18c]::ty::list::List<rustc_middle[7c6d68ebc026a18c]::ty::subst::GenericArg> as rustc_type_ir[c37869d76dc9c71f]::fold::TypeFoldable<rustc_middle[7c6d68ebc026a18c]::ty::context::TyCtxt>>::try_fold_with::<rustc_infer[8931c3b5ad764c67]::infer::canonical::canonicalizer::Canonicalizer>
  22:     0x7f39e2b3e550 - <rustc_trait_selection[81a135f8de2bc87b]::traits::query::normalize::QueryNormalizer as rustc_type_ir[c37869d76dc9c71f]::fold::FallibleTypeFolder<rustc_middle[7c6d68ebc026a18c]::ty::context::TyCtxt>>::try_fold_ty
  23:     0x7f39e3043867 - <rustc_traits[a30337c7c7b6e644]::normalize_erasing_regions::provide::{closure#0} as core[9fc488d0d60b190b]::ops::function::FnOnce<(rustc_middle[7c6d68ebc026a18c]::ty::context::TyCtxt, rustc_middle[7c6d68ebc026a18c]::ty::ParamEnvAnd<rustc_middle[7c6d68ebc026a18c]::ty::subst::GenericArg>)>>::call_once
  24:     0x7f39e21fabd6 - rustc_query_impl[78033b6434c6f9d2]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[78033b6434c6f9d2]::query_impl::try_normalize_generic_arg_after_erasing_regions::dynamic_query::{closure#2}::{closure#0}, rustc_middle[7c6d68ebc026a18c]::query::erase::Erased<[u8; 8usize]>>
  25:     0x7f39e318698b - rustc_query_system[bbbd0cb2bdad9a91]::query::plumbing::try_execute_query::<rustc_query_impl[78033b6434c6f9d2]::DynamicConfig<rustc_query_system[bbbd0cb2bdad9a91]::query::caches::DefaultCache<rustc_middle[7c6d68ebc026a18c]::ty::ParamEnvAnd<rustc_middle[7c6d68ebc026a18c]::ty::subst::GenericArg>, rustc_middle[7c6d68ebc026a18c]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[78033b6434c6f9d2]::plumbing::QueryCtxt, false>
  26:     0x7f39e31866a5 - rustc_query_impl[78033b6434c6f9d2]::query_impl::try_normalize_generic_arg_after_erasing_regions::get_query_non_incr::__rust_end_short_backtrace
  27:     0x7f39e2308bd6 - <rustc_middle[7c6d68ebc026a18c]::ty::normalize_erasing_regions::TryNormalizeAfterErasingRegionsFolder as rustc_type_ir[c37869d76dc9c71f]::fold::FallibleTypeFolder<rustc_middle[7c6d68ebc026a18c]::ty::context::TyCtxt>>::try_fold_ty
  28:     0x7f39e43875e9 - <rustc_middle[7c6d68ebc026a18c]::ty::context::TyCtxt>::try_normalize_erasing_regions::<rustc_middle[7c6d68ebc026a18c]::ty::Ty>
  29:     0x7f39e4d7d5a3 - <rustc_infer[8931c3b5ad764c67]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[81a135f8de2bc87b]::traits::error_reporting::suggestions::TypeErrCtxtExt>::suggest_option_method_if_applicable
  30:     0x7f39e4d7ce7f - <rustc_infer[8931c3b5ad764c67]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[81a135f8de2bc87b]::traits::error_reporting::suggestions::TypeErrCtxtExt>::note_function_argument_obligation
  31:     0x7f39e4d7af52 - <rustc_infer[8931c3b5ad764c67]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[81a135f8de2bc87b]::traits::error_reporting::suggestions::TypeErrCtxtExt>::note_obligation_cause_code::<rustc_middle[7c6d68ebc026a18c]::ty::Predicate>
  32:     0x7f39e4d87274 - <rustc_infer[8931c3b5ad764c67]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[81a135f8de2bc87b]::traits::error_reporting::InferCtxtPrivExt>::note_obligation_cause
  33:     0x7f39e4d80e93 - <rustc_infer[8931c3b5ad764c67]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[81a135f8de2bc87b]::traits::error_reporting::TypeErrCtxtExt>::report_selection_error
  34:     0x7f39e4d8c4c4 - <rustc_infer[8931c3b5ad764c67]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[81a135f8de2bc87b]::traits::error_reporting::InferCtxtPrivExt>::report_fulfillment_error
  35:     0x7f39e4d7fde4 - <rustc_infer[8931c3b5ad764c67]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[81a135f8de2bc87b]::traits::error_reporting::TypeErrCtxtExt>::report_fulfillment_errors
  36:     0x7f39e23eef95 - <rustc_hir_typeck[75435b5bae2acf6f]::fn_ctxt::FnCtxt>::check_argument_types
  37:     0x7f39e276521d - <rustc_hir_typeck[75435b5bae2acf6f]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  38:     0x7f39e27ad1fa - <rustc_hir_typeck[75435b5bae2acf6f]::fn_ctxt::FnCtxt>::check_decl
  39:     0x7f39e27a8762 - <rustc_hir_typeck[75435b5bae2acf6f]::fn_ctxt::FnCtxt>::check_block_with_expected
  40:     0x7f39e2763fa8 - <rustc_hir_typeck[75435b5bae2acf6f]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  41:     0x7f39e2b7d116 - <rustc_hir_typeck[75435b5bae2acf6f]::fn_ctxt::FnCtxt>::check_return_expr
  42:     0x7f39e2b74de4 - rustc_hir_typeck[75435b5bae2acf6f]::check::check_fn
  43:     0x7f39e2b62ac3 - rustc_hir_typeck[75435b5bae2acf6f]::typeck
  44:     0x7f39e221967e - rustc_query_impl[78033b6434c6f9d2]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[78033b6434c6f9d2]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[7c6d68ebc026a18c]::query::erase::Erased<[u8; 8usize]>>
  45:     0x7f39e221964e - <rustc_query_impl[78033b6434c6f9d2]::query_impl::typeck::dynamic_query::{closure#2} as core[9fc488d0d60b190b]::ops::function::FnOnce<(rustc_middle[7c6d68ebc026a18c]::ty::context::TyCtxt, rustc_span[4f17c337c7c51916]::def_id::LocalDefId)>>::call_once
  46:     0x7f39e22e71bd - rustc_query_system[bbbd0cb2bdad9a91]::query::plumbing::try_execute_query::<rustc_query_impl[78033b6434c6f9d2]::DynamicConfig<rustc_query_system[bbbd0cb2bdad9a91]::query::caches::VecCache<rustc_span[4f17c337c7c51916]::def_id::LocalDefId, rustc_middle[7c6d68ebc026a18c]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[78033b6434c6f9d2]::plumbing::QueryCtxt, false>
  47:     0x7f39e3b2e4d1 - rustc_query_impl[78033b6434c6f9d2]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  48:     0x7f39e232918d - rustc_query_impl[78033b6434c6f9d2]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[78033b6434c6f9d2]::query_impl::used_trait_imports::dynamic_query::{closure#2}::{closure#0}, rustc_middle[7c6d68ebc026a18c]::query::erase::Erased<[u8; 8usize]>>
  49:     0x7f39e23290ee - <rustc_query_impl[78033b6434c6f9d2]::query_impl::used_trait_imports::dynamic_query::{closure#2} as core[9fc488d0d60b190b]::ops::function::FnOnce<(rustc_middle[7c6d68ebc026a18c]::ty::context::TyCtxt, rustc_span[4f17c337c7c51916]::def_id::LocalDefId)>>::call_once
  50:     0x7f39e22e71bd - rustc_query_system[bbbd0cb2bdad9a91]::query::plumbing::try_execute_query::<rustc_query_impl[78033b6434c6f9d2]::DynamicConfig<rustc_query_system[bbbd0cb2bdad9a91]::query::caches::VecCache<rustc_span[4f17c337c7c51916]::def_id::LocalDefId, rustc_middle[7c6d68ebc026a18c]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[78033b6434c6f9d2]::plumbing::QueryCtxt, false>
  51:     0x7f39e3b2e5d1 - rustc_query_impl[78033b6434c6f9d2]::query_impl::used_trait_imports::get_query_non_incr::__rust_end_short_backtrace
  52:     0x7f39e36362bd - rustc_hir_analysis[9c71b3080ee2b927]::check_crate
  53:     0x7f39e363106d - rustc_interface[1a72d66b377c1c6b]::passes::analysis
  54:     0x7f39e36913ea - rustc_query_impl[78033b6434c6f9d2]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[78033b6434c6f9d2]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[7c6d68ebc026a18c]::query::erase::Erased<[u8; 1usize]>>
  55:     0x7f39e36913d9 - <rustc_query_impl[78033b6434c6f9d2]::query_impl::analysis::dynamic_query::{closure#2} as core[9fc488d0d60b190b]::ops::function::FnOnce<(rustc_middle[7c6d68ebc026a18c]::ty::context::TyCtxt, ())>>::call_once
  56:     0x7f39e3851d88 - rustc_query_system[bbbd0cb2bdad9a91]::query::plumbing::try_execute_query::<rustc_query_impl[78033b6434c6f9d2]::DynamicConfig<rustc_query_system[bbbd0cb2bdad9a91]::query::caches::SingleCache<rustc_middle[7c6d68ebc026a18c]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[78033b6434c6f9d2]::plumbing::QueryCtxt, false>
  57:     0x7f39e3851b59 - rustc_query_impl[78033b6434c6f9d2]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  58:     0x7f39e3829715 - <rustc_middle[7c6d68ebc026a18c]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[fa5b9237e02b60ed]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[9fc488d0d60b190b]::result::Result<(), rustc_span[4f17c337c7c51916]::ErrorGuaranteed>>
  59:     0x7f39e3356290 - <rustc_interface[1a72d66b377c1c6b]::interface::Compiler>::enter::<rustc_driver_impl[fa5b9237e02b60ed]::run_compiler::{closure#1}::{closure#2}, core[9fc488d0d60b190b]::result::Result<core[9fc488d0d60b190b]::option::Option<rustc_interface[1a72d66b377c1c6b]::queries::Linker>, rustc_span[4f17c337c7c51916]::ErrorGuaranteed>>
  60:     0x7f39e33538a0 - std[7f1619080ab2f47c]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[1a72d66b377c1c6b]::util::run_in_thread_pool_with_globals<rustc_interface[1a72d66b377c1c6b]::interface::run_compiler<core[9fc488d0d60b190b]::result::Result<(), rustc_span[4f17c337c7c51916]::ErrorGuaranteed>, rustc_driver_impl[fa5b9237e02b60ed]::run_compiler::{closure#1}>::{closure#0}, core[9fc488d0d60b190b]::result::Result<(), rustc_span[4f17c337c7c51916]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9fc488d0d60b190b]::result::Result<(), rustc_span[4f17c337c7c51916]::ErrorGuaranteed>>
  61:     0x7f39e3353045 - <<std[7f1619080ab2f47c]::thread::Builder>::spawn_unchecked_<rustc_interface[1a72d66b377c1c6b]::util::run_in_thread_pool_with_globals<rustc_interface[1a72d66b377c1c6b]::interface::run_compiler<core[9fc488d0d60b190b]::result::Result<(), rustc_span[4f17c337c7c51916]::ErrorGuaranteed>, rustc_driver_impl[fa5b9237e02b60ed]::run_compiler::{closure#1}>::{closure#0}, core[9fc488d0d60b190b]::result::Result<(), rustc_span[4f17c337c7c51916]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9fc488d0d60b190b]::result::Result<(), rustc_span[4f17c337c7c51916]::ErrorGuaranteed>>::{closure#1} as core[9fc488d0d60b190b]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  62:     0x7f39e0f772d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6b0ed82aea8dcab0
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/alloc/src/boxed.rs:1985:9
  63:     0x7f39e0f772d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h2aa07bcc5de04999
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/alloc/src/boxed.rs:1985:9
  64:     0x7f39e0f772d5 - std::sys::unix::thread::Thread::new::thread_start::h159e3511f98c27c9
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/std/src/sys/unix/thread.rs:108:17
  65:     0x7f39e0cd844b - <unknown>
  66:     0x7f39e0d5be40 - <unknown>
  67:                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.72.0-nightly (398fa2187 2023-06-03) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [try_normalize_generic_arg_after_erasing_regions] normalizing `<{integer} as core::ops::deref::Deref>::Target`
#1 [typeck] type-checking `<impl at treereduce.out:3:1: 3:17>::type_alias`
#2 [used_trait_imports] finding used_trait_imports `<impl at treereduce.out:3:1: 3:17>::type_alias`
#3 [analysis] running analysis passes on this crate
end of query stack
error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: `report_selection_error` did not emit an error
 --> treereduce.out:5:46
  |
5 |         let _opt: Option<Self> = Some(0).map(Self);
  |                                              ^^^^
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs:631:22
             0: <rustc_errors::HandlerInner>::emit_diagnostic
             1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, &str>
             2: <rustc_infer::infer::error_reporting::TypeErrCtxt as rustc_trait_selection::traits::error_reporting::TypeErrCtxtExt>::report_selection_error
             3: <rustc_infer::infer::error_reporting::TypeErrCtxt as rustc_trait_selection::traits::error_reporting::InferCtxtPrivExt>::report_fulfillment_error
             4: <rustc_infer::infer::error_reporting::TypeErrCtxt as rustc_trait_selection::traits::error_reporting::TypeErrCtxtExt>::report_fulfillment_errors
             5: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
             6: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
             7: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_decl
             8: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
             9: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
            10: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_return_expr
            11: rustc_hir_typeck::check::check_fn
            12: rustc_hir_typeck::typeck
            13: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
            14: <rustc_query_impl::query_impl::typeck::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId)>>::call_once
            15: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
            16: rustc_query_impl::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
            17: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::used_trait_imports::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
            18: <rustc_query_impl::query_impl::used_trait_imports::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId)>>::call_once
            19: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
            20: rustc_query_impl::query_impl::used_trait_imports::get_query_non_incr::__rust_end_short_backtrace
            21: rustc_hir_analysis::check_crate
            22: rustc_interface::passes::analysis
            23: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
            24: <rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, ())>>::call_once
            25: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
            26: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
            27: <rustc_middle::ty::context::GlobalCtxt>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#4}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
            28: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
            29: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
            30: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
            31: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/alloc/src/boxed.rs:1985:9
            32: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/alloc/src/boxed.rs:1985:9
            33: std::sys::unix::thread::Thread::new::thread_start
                       at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/std/src/sys/unix/thread.rs:108:17
            34: <unknown>
            35: <unknown>


error: internal compiler error: TyKind::Error constructed but no error reported
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs:3640:69
             0: <rustc_errors::HandlerInner>::emit_diagnostic
             1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, &str>
             2: <rustc_middle::ty::context::TyCtxt>::ty_error_misc
             3: <rustc_infer::infer::error_reporting::TypeErrCtxt as rustc_trait_selection::traits::error_reporting::suggestions::TypeErrCtxtExt>::point_at_chain
             4: <rustc_infer::infer::error_reporting::TypeErrCtxt as rustc_trait_selection::traits::error_reporting::suggestions::TypeErrCtxtExt>::note_function_argument_obligation
             5: <rustc_infer::infer::error_reporting::TypeErrCtxt as rustc_trait_selection::traits::error_reporting::suggestions::TypeErrCtxtExt>::note_obligation_cause_code::<rustc_middle::ty::Predicate>
             6: <rustc_infer::infer::error_reporting::TypeErrCtxt as rustc_trait_selection::traits::error_reporting::InferCtxtPrivExt>::note_obligation_cause
             7: <rustc_infer::infer::error_reporting::TypeErrCtxt as rustc_trait_selection::traits::error_reporting::TypeErrCtxtExt>::report_selection_error
             8: <rustc_infer::infer::error_reporting::TypeErrCtxt as rustc_trait_selection::traits::error_reporting::InferCtxtPrivExt>::report_fulfillment_error
             9: <rustc_infer::infer::error_reporting::TypeErrCtxt as rustc_trait_selection::traits::error_reporting::TypeErrCtxtExt>::report_fulfillment_errors
            10: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
            11: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
            12: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_decl
            13: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
            14: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
            15: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_return_expr
            16: rustc_hir_typeck::check::check_fn
            17: rustc_hir_typeck::typeck
            18: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
            19: <rustc_query_impl::query_impl::typeck::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId)>>::call_once
            20: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
            21: rustc_query_impl::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
            22: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::used_trait_imports::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
            23: <rustc_query_impl::query_impl::used_trait_imports::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId)>>::call_once
            24: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
            25: rustc_query_impl::query_impl::used_trait_imports::get_query_non_incr::__rust_end_short_backtrace
            26: rustc_hir_analysis::check_crate
            27: rustc_interface::passes::analysis
            28: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
            29: <rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, ())>>::call_once
            30: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
            31: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
            32: <rustc_middle::ty::context::GlobalCtxt>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#4}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
            33: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
            34: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
            35: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
            36: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/alloc/src/boxed.rs:1985:9
            37: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/alloc/src/boxed.rs:1985:9
            38: std::sys::unix::thread::Thread::new::thread_start
                       at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/std/src/sys/unix/thread.rs:108:17
            39: <unknown>
            40: <unknown>


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.72.0-nightly (398fa2187 2023-06-03) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
thread 'rustc' panicked at 'panic in a function that cannot unwind', library/core/src/panicking.rs:126:5
stack backtrace:
   0:     0x7f39e0f69bc1 - std::backtrace_rs::backtrace::libunwind::trace::h3746d9da3fce0c89
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f39e0f69bc1 - std::backtrace_rs::backtrace::trace_unsynchronized::hb22c8868d0c6ddc4
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f39e0f69bc1 - std::sys_common::backtrace::_print_fmt::h6efce3fb8f8916d2
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f39e0f69bc1 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h231c49729c204f24
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f39e0fca19f - core::fmt::rt::Argument::fmt::h9d9a01dce9616182
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/core/src/fmt/rt.rs:138:9
   5:     0x7f39e0fca19f - core::fmt::write::h7c911ba9bb1b7f5b
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/core/src/fmt/mod.rs:1094:21
   6:     0x7f39e0f5ce71 - std::io::Write::write_fmt::h901432478ccb3614
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/std/src/io/mod.rs:1713:15
   7:     0x7f39e0f699d5 - std::sys_common::backtrace::_print::h9834cbc9ab2c1f67
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f39e0f699d5 - std::sys_common::backtrace::print::h2e0fe58f84439b47
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f39e0f6c697 - std::panicking::default_hook::{{closure}}::hde864a3c143ecbbd
  10:     0x7f39e0f6c484 - std::panicking::default_hook::h2207b05fdedc08ce
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/std/src/panicking.rs:288:9
  11:     0x7f39e41a583b - rustc_driver_impl[fa5b9237e02b60ed]::install_ice_hook::{closure#0}
  12:     0x7f39e0f6cddd - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hb513c8b00f8e1160
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/alloc/src/boxed.rs:1999:9
  13:     0x7f39e0f6cddd - std::panicking::rust_panic_with_hook::h3a37bf9048506528
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/std/src/panicking.rs:709:13
  14:     0x7f39e0f6cb31 - std::panicking::begin_panic_handler::{{closure}}::h01ecc692a3fbee86
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/std/src/panicking.rs:595:13
  15:     0x7f39e0f69ff6 - std::sys_common::backtrace::__rust_end_short_backtrace::ha5aa2b230f0b7cfb
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/std/src/sys_common/backtrace.rs:151:18
  16:     0x7f39e0f6c8c2 - rust_begin_unwind
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/std/src/panicking.rs:593:5
  17:     0x7f39e0fc6463 - core::panicking::panic_nounwind_fmt::h006679908021cf6c
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/core/src/panicking.rs:96:14
  18:     0x7f39e0fc6507 - core::panicking::panic_nounwind::hc9eaf9e9277ea826
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/core/src/panicking.rs:126:5
  19:     0x7f39e0fc6693 - core::panicking::panic_cannot_unwind::hd17b84ed1c4bfea8
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/core/src/panicking.rs:188:5
  20:     0x7f39e3354234 - std[7f1619080ab2f47c]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[1a72d66b377c1c6b]::util::run_in_thread_pool_with_globals<rustc_interface[1a72d66b377c1c6b]::interface::run_compiler<core[9fc488d0d60b190b]::result::Result<(), rustc_span[4f17c337c7c51916]::ErrorGuaranteed>, rustc_driver_impl[fa5b9237e02b60ed]::run_compiler::{closure#1}>::{closure#0}, core[9fc488d0d60b190b]::result::Result<(), rustc_span[4f17c337c7c51916]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9fc488d0d60b190b]::result::Result<(), rustc_span[4f17c337c7c51916]::ErrorGuaranteed>>
  21:     0x7f39e3353045 - <<std[7f1619080ab2f47c]::thread::Builder>::spawn_unchecked_<rustc_interface[1a72d66b377c1c6b]::util::run_in_thread_pool_with_globals<rustc_interface[1a72d66b377c1c6b]::interface::run_compiler<core[9fc488d0d60b190b]::result::Result<(), rustc_span[4f17c337c7c51916]::ErrorGuaranteed>, rustc_driver_impl[fa5b9237e02b60ed]::run_compiler::{closure#1}>::{closure#0}, core[9fc488d0d60b190b]::result::Result<(), rustc_span[4f17c337c7c51916]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9fc488d0d60b190b]::result::Result<(), rustc_span[4f17c337c7c51916]::ErrorGuaranteed>>::{closure#1} as core[9fc488d0d60b190b]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  22:     0x7f39e0f772d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6b0ed82aea8dcab0
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/alloc/src/boxed.rs:1985:9
  23:     0x7f39e0f772d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h2aa07bcc5de04999
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/alloc/src/boxed.rs:1985:9
  24:     0x7f39e0f772d5 - std::sys::unix::thread::Thread::new::thread_start::h159e3511f98c27c9
                               at /rustc/398fa2187c88de46c13c142f600064483a563c86/library/std/src/sys/unix/thread.rs:108:17
  25:     0x7f39e0cd844b - <unknown>
  26:     0x7f39e0d5be40 - <unknown>
  27:                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.72.0-nightly (398fa2187 2023-06-03) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
thread caused non-unwinding panic. aborting.
[1]    754762 IOT instruction  rustc treereduce.out

@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. labels Jun 4, 2023
@matthiaskrgr
Copy link
Member Author

regression in #111659 cc @y21

@Noratrieb
Copy link
Member

I think the relevant ICE here is the index out of bounds in ena. That means that inference variables were carried across inference contexts. I think the issue is that here, TyCtxt::try_normalize_erasing_regions is called with a type that may contain inference variables. Instead of that, the local infcx should probably be used for normalization.
@rustbot claim

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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
@matthiaskrgr @Noratrieb and others