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 '_ (index=0) glacier fixed/69487-1.rs #88433

Closed
matthiaskrgr opened this issue Aug 28, 2021 · 6 comments · Fixed by #88592
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 Aug 28, 2021

Code

code from glacier/fixed/69487-1.rs

#![feature(const_trait_impl)]
#![feature(fn_traits)]
#![feature(unboxed_closures)]

struct Closure;

impl const FnOnce<&usize> for Closure {
    type Output = usize;

    extern "rust-call" fn call_once(self, arg: &usize) -> Self::Output {
        *arg
    }
}

enum Bug<T = [(); Closure.call_once(&0) ]> {
    V(T),
}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.56.0-nightly (42a2a53ec 2021-08-28)
binary: rustc
commit-hash: 42a2a53ec13b0e6e915acd09a2a9a963e5fa3b92
commit-date: 2021-08-28
host: x86_64-unknown-linux-gnu
release: 1.56.0-nightly
LLVM version: 13.0.0

Error output

error: internal compiler error: compiler/rustc_middle/src/ty/subst.rs:480:25: Region parameter out of range when substituting in region '_ (index=0)

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/42a2a53ec13b0e6e915acd09a2a9a963e5fa3b92/compiler/rustc_errors/src/lib.rs:1093:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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 (42a2a53ec 2021-08-28) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [resolve_instance] resolving instance `<impl at ./69487-1.rs:7:1: 13:2>::call_once`
#1 [mir_const_qualif] const checking `Bug::{constant#0}`
end of query stack
Backtrace

error: internal compiler error: compiler/rustc_middle/src/ty/subst.rs:480:25: Region parameter out of range when substituting in region '_ (index=0)

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/42a2a53ec13b0e6e915acd09a2a9a963e5fa3b92/compiler/rustc_errors/src/lib.rs:1093:9
stack backtrace:
   0:     0x7fba4faf326c - std::backtrace_rs::backtrace::libunwind::trace::hf16bab017f241aa7
                               at /rustc/42a2a53ec13b0e6e915acd09a2a9a963e5fa3b92/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7fba4faf326c - std::backtrace_rs::backtrace::trace_unsynchronized::hfc27e8424e499412
                               at /rustc/42a2a53ec13b0e6e915acd09a2a9a963e5fa3b92/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fba4faf326c - std::sys_common::backtrace::_print_fmt::h5be1efcd85b410a6
                               at /rustc/42a2a53ec13b0e6e915acd09a2a9a963e5fa3b92/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7fba4faf326c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h73cf7b443adc9274
                               at /rustc/42a2a53ec13b0e6e915acd09a2a9a963e5fa3b92/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7fba4fb50f3c - core::fmt::write::h9a6d9c74526a6c1b
                               at /rustc/42a2a53ec13b0e6e915acd09a2a9a963e5fa3b92/library/core/src/fmt/mod.rs:1150:17
   5:     0x7fba4fae4305 - std::io::Write::write_fmt::hb955fdedb1f691a8
                               at /rustc/42a2a53ec13b0e6e915acd09a2a9a963e5fa3b92/library/std/src/io/mod.rs:1667:15
   6:     0x7fba4faf67c0 - std::sys_common::backtrace::_print::hd5ba2c14c2d68f09
                               at /rustc/42a2a53ec13b0e6e915acd09a2a9a963e5fa3b92/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7fba4faf67c0 - std::sys_common::backtrace::print::h3b3d8e691bd3d5e8
                               at /rustc/42a2a53ec13b0e6e915acd09a2a9a963e5fa3b92/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7fba4faf67c0 - std::panicking::default_hook::{{closure}}::h703c292cd78e95a9
                               at /rustc/42a2a53ec13b0e6e915acd09a2a9a963e5fa3b92/library/std/src/panicking.rs:210:50
   9:     0x7fba4faf637b - std::panicking::default_hook::h23aea4a9b2140559
                               at /rustc/42a2a53ec13b0e6e915acd09a2a9a963e5fa3b92/library/std/src/panicking.rs:227:9
  10:     0x7fba502c8f41 - rustc_driver::DEFAULT_HOOK::{{closure}}::{{closure}}::hfc7f4e708637f032
  11:     0x7fba4faf6fd9 - std::panicking::rust_panic_with_hook::hde97eb7782db5504
                               at /rustc/42a2a53ec13b0e6e915acd09a2a9a963e5fa3b92/library/std/src/panicking.rs:628:17
  12:     0x7fba5125a31b - std::panicking::begin_panic::{{closure}}::hc7e931d8cf1ce937
  13:     0x7fba5125a236 - std::sys_common::backtrace::__rust_end_short_backtrace::h159c3a655afcac75
  14:     0x7fba511c0a0f - std::panicking::begin_panic::hcfa8f7084d2ad744
  15:     0x7fba511d94fd - std::panic::panic_any::hc492258cd10579b6
  16:     0x7fba511d8f85 - rustc_errors::HandlerInner::span_bug::hd7521de3929de86f
  17:     0x7fba511d94a0 - rustc_errors::Handler::span_bug::h56da3dbfc169dc20
  18:     0x7fba5126472a - rustc_middle::ty::context::tls::with_opt::h041c52acf5b20d1a
  19:     0x7fba51264af0 - rustc_middle::util::bug::opt_span_bug_fmt::hc0456f9ed0e76496
  20:     0x7fba51264abc - rustc_middle::util::bug::span_bug_fmt::h49ae480aa673b7bc
  21:     0x7fba51d58243 - <rustc_middle::ty::subst::SubstFolder as rustc_middle::ty::fold::TypeFolder>::fold_region::h742cc6da933d9469
  22:     0x7fba51d5535a - rustc_middle::ty::fold::TypeFoldable::fold_with::hff490c08ce6aeb68
  23:     0x7fba51d2d453 - rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_fold_with::h0f482dea181f39b3
  24:     0x7fba515d6ac3 - rustc_ty_utils::instance::inner_resolve_instance::hdfb93f0bd43749b2
  25:     0x7fba515d60df - rustc_ty_utils::instance::resolve_instance::hd0a8ff259fd0df63
  26:     0x7fba51950be2 - rustc_query_system::query::plumbing::get_query_impl::h3cec1d0b00a2ad61
  27:     0x7fba519e38a3 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::resolve_instance::hfad9aa3b7a9c0fb8
  28:     0x7fba51d319d7 - rustc_middle::ty::instance::Instance::resolve_opt_const_arg::h4de89db76e91555f
  29:     0x7fba51d2cc99 - rustc_middle::ty::instance::Instance::resolve::h0bb09f1467c97646
  30:     0x7fba522559ea - <rustc_mir::transform::check_consts::check::Checker as rustc_middle::mir::visit::Visitor>::visit_terminator::hca0476447cea4e12
  31:     0x7fba518aa77b - rustc_mir::transform::check_consts::check::Checker::check_body::h30295f0d1eb385f8
  32:     0x7fba517b67ff - rustc_mir::transform::mir_const_qualif::hd70b38d2e8fbea2f
  33:     0x7fba517a31b6 - core::ops::function::FnOnce::call_once::h1da685a90e50a866
  34:     0x7fba5194618c - rustc_query_system::query::plumbing::get_query_impl::h0f7ec824728a4d7f
  35:     0x7fba519e0129 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_const_qualif::hde21fc8a6d87d704
  36:     0x7fba517a0978 - rustc_middle::mir::query::<impl rustc_middle::ty::context::TyCtxt>::mir_const_qualif_opt_const_arg::ha640696eb4bf0061
  37:     0x7fba517a8294 - rustc_mir::const_eval::eval_queries::eval_to_allocation_raw_provider::h94bca15ee5206564
  38:     0x7fba51957ea0 - rustc_query_system::query::plumbing::get_query_impl::h6228d963b6d64d0c
  39:     0x7fba519e16ac - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::eval_to_allocation_raw::h8097b3c3f4480b12
  40:     0x7fba517a72c5 - rustc_mir::const_eval::eval_queries::eval_to_const_value_raw_provider::h8774c483fb3933eb
  41:     0x7fba5196b102 - rustc_query_system::query::plumbing::get_query_impl::hce7fd64c8727349b
  42:     0x7fba519e17d0 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::eval_to_const_value_raw::h4f495444d54b0e76
  43:     0x7fba517a6e8b - rustc_mir::const_eval::eval_queries::eval_to_const_value_raw_provider::h8774c483fb3933eb
  44:     0x7fba5196b102 - rustc_query_system::query::plumbing::get_query_impl::hce7fd64c8727349b
  45:     0x7fba519e17d0 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::eval_to_const_value_raw::h4f495444d54b0e76
  46:     0x7fba51cd24b5 - rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_global_id::h16ace0211d0ade42
  47:     0x7fba527463d4 - rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_resolve::hc02bca22ee0011e5
  48:     0x7fba526c9d22 - <rustc_trait_selection::traits::project::AssocTypeNormalizer as rustc_middle::ty::fold::TypeFolder>::fold_const::h1ad499036d67aad6
  49:     0x7fba51c3c921 - rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_fold_with::hbedf45ed1761fd86
  50:     0x7fba5156cbf3 - rustc_middle::ty::fold::TypeFoldable::fold_with::h48edef78f82c3e89
  51:     0x7fba5156cf11 - rustc_middle::ty::fold::TypeFoldable::fold_with::h49fca19efe52de89
  52:     0x7fba520748de - rustc_trait_selection::traits::project::AssocTypeNormalizer::fold::h4613e4a22a07680a
  53:     0x7fba52074d97 - rustc_trait_selection::traits::project::normalize::h146879fb2e02522f
  54:     0x7fba52055f91 - <rustc_infer::infer::InferCtxt as rustc_trait_selection::infer::InferCtxtExt>::partially_normalize_associated_types_in::h16ebfa05adbac732
  55:     0x7fba5151c237 - rustc_typeck::check::wfcheck::check_where_clauses::h0c6bd8c0d1bdb982
  56:     0x7fba52048c22 - rustc_infer::infer::InferCtxtBuilder::enter::h97acd2b71096b0ae
  57:     0x7fba51519f6d - rustc_typeck::check::wfcheck::check_item_well_formed::h76c101d5daa714fa
  58:     0x7fba51973f39 - rustc_query_system::query::plumbing::get_query_impl::hef48ef938ffda69f
  59:     0x7fba519e2a0b - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::check_item_well_formed::hab433991e1bb8b90
  60:     0x7fba5151e9b1 - <rustc_typeck::check::wfcheck::CheckTypeWellFormedVisitor as rustc_hir::intravisit::Visitor>::visit_item::h9dcf363afa027d21
  61:     0x7fba51527ae1 - std::panic::catch_unwind::he9d09f52964b28fb
  62:     0x7fba5157332b - rustc_data_structures::sync::par_for_each_in::hdec0d7d444dcda7b
  63:     0x7fba5201716b - rustc_session::session::Session::track_errors::h455c226fe1feabdf
  64:     0x7fba520af093 - rustc_typeck::check_crate::h11bdbd793759c190
  65:     0x7fba51dde213 - rustc_interface::passes::analysis::hb269babe9466e073
  66:     0x7fba522cb04f - rustc_query_system::query::plumbing::get_query_impl::h57cd2e389f82820b
  67:     0x7fba5242dadd - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis::h71bb1ebf7eea66a8
  68:     0x7fba51dd50c7 - rustc_interface::passes::QueryContext::enter::hd663b8cdd3c6a9b1
  69:     0x7fba51dbc111 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::h06260323cdb48c58
  70:     0x7fba51da928c - rustc_span::with_source_map::he902f9cc4e931296
  71:     0x7fba51dbba48 - scoped_tls::ScopedKey<T>::set::hb252def087903683
  72:     0x7fba51da9a0b - std::sys_common::backtrace::__rust_begin_short_backtrace::h1e0eeab0dccc540c
  73:     0x7fba51da89f5 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h52394afe7007bbd9
  74:     0x7fba4fb03633 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h132ab4ac45190c0c
                               at /rustc/42a2a53ec13b0e6e915acd09a2a9a963e5fa3b92/library/alloc/src/boxed.rs:1636:9
  75:     0x7fba4fb03633 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hf5feeb35085fa69e
                               at /rustc/42a2a53ec13b0e6e915acd09a2a9a963e5fa3b92/library/alloc/src/boxed.rs:1636:9
  76:     0x7fba4fb03633 - std::sys::unix::thread::Thread::new::thread_start::h21e4b7c982487240
                               at /rustc/42a2a53ec13b0e6e915acd09a2a9a963e5fa3b92/library/std/src/sys/unix/thread.rs:106:17
  77:     0x7fba4fa0c259 - start_thread
  78:     0x7fba4f9215e3 - __GI___clone
  79:                0x0 - <unknown>

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 (42a2a53ec 2021-08-28) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [resolve_instance] resolving instance `<impl at ./69487-1.rs:7:1: 13:2>::call_once`
#1 [mir_const_qualif] const checking `Bug::{constant#0}`
#2 [eval_to_allocation_raw] const-evaluating + checking `Bug::{constant#0}`
#3 [eval_to_const_value_raw] simplifying constant for the type system `Bug::{constant#0}`
#4 [eval_to_const_value_raw] simplifying constant for the type system `Bug::{constant#0}`
#5 [check_item_well_formed] checking that `Bug` is well-formed
#6 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error

@matthiaskrgr matthiaskrgr 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 Aug 28, 2021
@b-naber
Copy link
Contributor

b-naber commented Aug 31, 2021

@rustbot claim

@b-naber
Copy link
Contributor

b-naber commented Sep 1, 2021

@fee1-dead This is caused by ac50a53, when we try to resolve the instance for a trait fn we use receiver substs from the MethodCall, which don't match with the generic params the associated fn expects. This happens here when we change the DefId of the callee. What was the intent of that change?

@fee1-dead
Copy link
Member

I didn't see the call to Instance::resolve after that. I think I basically wanted to replicate the behavior of Instance::resolve, when I didn't know that it is already being done. A trivial fix is to just leave that match arm empty.

Ok(Some(ImplSource::UserDefined(data))) => {}

@b-naber
Copy link
Contributor

b-naber commented Sep 1, 2021

I tried that, I also tried to just use the identity substs, in which case the resolution succeeds. But in both cases we get another ICE later during monorphization (which I'm not familiar with). This is the backtrace:

warning: enum is never used: `Bug`
  --> test_wo_abi.rs:37:6
   |
37 | enum Bug<T = [(); Closure.call_once(&0) ]> {
   |      ^^^
   |
   = note: `#[warn(dead_code)]` on by default

thread 'rustc' panicked at 'DefId::expect_local: `DefId(1:7173 ~ std[ff7f]::process::{impl#46}::SUCCESS)` isn't local', /Users/bn/Documents/rust-local-fork/another-debug/compiler/rustc_span/src/def_id.rs:234:43
stack backtrace:
   0: rust_begin_unwind
             at ./library/std/src/panicking.rs:517:5
   1: std::panicking::begin_panic_fmt
             at ./library/std/src/panicking.rs:460:5
   2: rustc_span::def_id::DefId::expect_local::{{closure}}
             at ./compiler/rustc_span/src/def_id.rs:234:43
   3: core::option::Option<T>::unwrap_or_else
             at ./library/core/src/option.rs:776:21
   4: rustc_span::def_id::DefId::expect_local
             at ./compiler/rustc_span/src/def_id.rs:234:9
   5: rustc_middle::ty::consts::kind::ConstKind::try_eval
             at ./compiler/rustc_middle/src/ty/consts/kind.rs:163:26
   6: rustc_middle::ty::consts::Const::eval
             at ./compiler/rustc_middle/src/ty/consts.rs:181:28
   7: <rustc_trait_selection::traits::query::normalize::QueryNormalizer as rustc_middle::ty::fold::TypeFolder>::fold_const
             at ./compiler/rustc_trait_selection/src/traits/query/normalize.rs:370:25
   8: rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::consts::Const>::fold_with
             at ./compiler/rustc_middle/src/ty/structural_impls.rs:1054:9
   9: rustc_middle::mir::type_foldable::<impl rustc_middle::ty::fold::TypeFoldable for rustc_middle::mir::ConstantKind>::super_fold_with
             at ./compiler/rustc_middle/src/mir/type_foldable.rs:358:53
  10: <rustc_trait_selection::traits::query::normalize::QueryNormalizer as rustc_middle::ty::fold::TypeFolder>::fold_mir_const
             at ./compiler/rustc_trait_selection/src/traits/query/normalize.rs:376:9
  11: rustc_middle::mir::type_foldable::<impl rustc_middle::ty::fold::TypeFoldable for rustc_middle::mir::ConstantKind>::fold_with
             at ./compiler/rustc_middle/src/mir/type_foldable.rs:353:9
  12: <rustc_infer::infer::at::At as rustc_trait_selection::traits::query::normalize::AtExt>::normalize
             at ./compiler/rustc_trait_selection/src/traits/query/normalize.rs:91:22
  13: rustc_traits::normalize_erasing_regions::normalize_after_erasing_regions::{{closure}}
             at ./compiler/rustc_traits/src/normalize_erasing_regions.rs:35:15
  14: rustc_infer::infer::InferCtxtBuilder::enter
             at ./compiler/rustc_infer/src/infer/mod.rs:620:9
  15: rustc_traits::normalize_erasing_regions::normalize_after_erasing_regions
             at ./compiler/rustc_traits/src/normalize_erasing_regions.rs:33:5
  16: rustc_traits::normalize_erasing_regions::provide::{{closure}}
             at ./compiler/rustc_traits/src/normalize_erasing_regions.rs:21:13
  17: core::ops::function::FnOnce::call_once
             at ./library/core/src/ops/function.rs:227:5
  18: rustc_query_system::query::plumbing::try_execute_query::{{closure}}
             at ./compiler/rustc_query_system/src/query/plumbing.rs:462:55
  19: stacker::maybe_grow
             at /Users/bn/.cargo/registry/src/github.com-1ecc6299db9ec823/stacker-0.1.12/src/lib.rs:55:9
  20: rustc_data_structures::stack::ensure_sufficient_stack
             at ./compiler/rustc_data_structures/src/stack.rs:16:5
  21: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query::{{closure}}::{{closure}}
             at ./compiler/rustc_query_impl/src/plumbing.rs:137:17
  22: rustc_middle::ty::context::tls::enter_context::{{closure}}
             at ./compiler/rustc_middle/src/ty/context.rs:1782:50
  23: rustc_middle::ty::context::tls::set_tlv
             at ./compiler/rustc_middle/src/ty/context.rs:1766:9
  24: rustc_middle::ty::context::tls::enter_context
             at ./compiler/rustc_middle/src/ty/context.rs:1782:9
  25: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query::{{closure}}
             at ./compiler/rustc_query_impl/src/plumbing.rs:136:13
  26: rustc_middle::ty::context::tls::with_related_context::{{closure}}
             at ./compiler/rustc_middle/src/ty/context.rs:1826:13
  27: rustc_middle::ty::context::tls::with_context::{{closure}}
             at ./compiler/rustc_middle/src/ty/context.rs:1810:40
  28: rustc_middle::ty::context::tls::with_context_opt
             at ./compiler/rustc_middle/src/ty/context.rs:1799:22
  29: rustc_middle::ty::context::tls::with_context
             at ./compiler/rustc_middle/src/ty/context.rs:1810:9
  30: rustc_middle::ty::context::tls::with_related_context
             at ./compiler/rustc_middle/src/ty/context.rs:1823:9
  31: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query
             at ./compiler/rustc_query_impl/src/plumbing.rs:125:9
  32: rustc_query_system::query::plumbing::try_execute_query
             at ./compiler/rustc_query_system/src/query/plumbing.rs:462:22
  33: rustc_query_system::query::plumbing::get_query_impl
             at ./compiler/rustc_query_system/src/query/plumbing.rs:730:5
  34: rustc_query_system::query::plumbing::get_query
             at ./compiler/rustc_query_system/src/query/plumbing.rs:853:17
  35: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::normalize_mir_const_after_erasing_regions
             at ./compiler/rustc_query_impl/src/plumbing.rs:563:17
  36: rustc_middle::ty::query::TyCtxtAt::normalize_mir_const_after_erasing_regions
             at ./compiler/rustc_middle/src/ty/query.rs:203:17
  37: rustc_middle::ty::query::<impl rustc_middle::ty::context::TyCtxt>::normalize_mir_const_after_erasing_regions
             at ./compiler/rustc_middle/src/ty/query.rs:184:17
  38: <rustc_middle::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder as rustc_middle::ty::fold::TypeFolder>::fold_mir_const
             at ./compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:118:9
  39: rustc_middle::mir::type_foldable::<impl rustc_middle::ty::fold::TypeFoldable for rustc_middle::mir::ConstantKind>::fold_with
             at ./compiler/rustc_middle/src/mir/type_foldable.rs:353:9
  40: rustc_middle::ty::normalize_erasing_regions::<impl rustc_middle::ty::context::TyCtxt>::normalize_erasing_regions
             at ./compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:38:13
  41: rustc_middle::ty::normalize_erasing_regions::<impl rustc_middle::ty::context::TyCtxt>::subst_and_normalize_erasing_regions
             at ./compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:82:9
  42: rustc_middle::ty::instance::Instance::subst_mir_and_normalize_erasing_regions
             at ./compiler/rustc_middle/src/ty/instance.rs:557:13
  43: rustc_mir::monomorphize::collector::MirNeighborCollector::monomorphize
             at ./compiler/rustc_mir/src/monomorphize/collector.rs:619:9
  44: <rustc_mir::monomorphize::collector::MirNeighborCollector as rustc_middle::mir::visit::Visitor>::visit_constant
             at ./compiler/rustc_mir/src/monomorphize/collector.rs:718:23
  45: <rustc_mir::monomorphize::collector::MirNeighborCollector as rustc_middle::mir::visit::Visitor>::visit_operand
             at ./compiler/rustc_mir/src/monomorphize/collector.rs:826:9
  46: rustc_middle::mir::visit::Visitor::super_terminator
             at ./compiler/rustc_middle/src/mir/visit.rs:542:29
  47: <rustc_mir::monomorphize::collector::MirNeighborCollector as rustc_middle::mir::visit::Visitor>::visit_terminator
             at ./compiler/rustc_mir/src/monomorphize/collector.rs:822:9
  48: rustc_middle::mir::visit::Visitor::super_basic_block_data
             at ./compiler/rustc_middle/src/mir/visit.rs:318:21
  49: rustc_middle::mir::visit::Visitor::visit_basic_block_data
             at ./compiler/rustc_middle/src/mir/visit.rs:84:17
  50: rustc_middle::mir::visit::Visitor::super_body
             at ./compiler/rustc_middle/src/mir/visit.rs:261:21
  51: rustc_middle::mir::visit::Visitor::visit_body
             at ./compiler/rustc_middle/src/mir/visit.rs:78:17
  52: rustc_mir::monomorphize::collector::collect_neighbours
             at ./compiler/rustc_mir/src/monomorphize/collector.rs:1397:5
  53: rustc_mir::monomorphize::collector::collect_items_rec::{{closure}}
             at ./compiler/rustc_mir/src/monomorphize/collector.rs:426:17
  54: stacker::maybe_grow
             at /Users/bn/.cargo/registry/src/github.com-1ecc6299db9ec823/stacker-0.1.12/src/lib.rs:55:9
  55: rustc_data_structures::stack::ensure_sufficient_stack
             at ./compiler/rustc_data_structures/src/stack.rs:16:5
  56: rustc_mir::monomorphize::collector::collect_items_rec
             at ./compiler/rustc_mir/src/monomorphize/collector.rs:425:13
  57: rustc_mir::monomorphize::collector::collect_items_rec
             at ./compiler/rustc_mir/src/monomorphize/collector.rs:467:9
  58: rustc_mir::monomorphize::collector::collect_items_rec
             at ./compiler/rustc_mir/src/monomorphize/collector.rs:467:9
  59: rustc_mir::monomorphize::collector::collect_items_rec
             at ./compiler/rustc_mir/src/monomorphize/collector.rs:467:9
  60: rustc_mir::monomorphize::collector::collect_items_rec
             at ./compiler/rustc_mir/src/monomorphize/collector.rs:467:9
  61: rustc_mir::monomorphize::collector::collect_crate_mono_items::{{closure}}::{{closure}}
             at ./compiler/rustc_mir/src/monomorphize/collector.rs:307:17
  62: core::iter::traits::iterator::Iterator::for_each::call::{{closure}}
             at ./library/core/src/iter/traits/iterator.rs:730:29
  63: core::iter::traits::iterator::Iterator::fold
             at ./library/core/src/iter/traits/iterator.rs:2170:21
  64: core::iter::traits::iterator::Iterator::for_each
             at ./library/core/src/iter/traits/iterator.rs:733:9
  65: rustc_mir::monomorphize::collector::collect_crate_mono_items::{{closure}}
             at ./compiler/rustc_mir/src/monomorphize/collector.rs:305:13
  66: rustc_data_structures::profiling::VerboseTimingGuard::run
             at ./compiler/rustc_data_structures/src/profiling.rs:611:9
  67: rustc_session::utils::<impl rustc_session::session::Session>::time
             at ./compiler/rustc_session/src/utils.rs:16:9
  68: rustc_mir::monomorphize::collector::collect_crate_mono_items
             at ./compiler/rustc_mir/src/monomorphize/collector.rs:304:9
  69: rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items
             at ./compiler/rustc_mir/src/monomorphize/partitioning/mod.rs:344:33
  70: rustc_query_system::query::plumbing::try_execute_query::{{closure}}
             at ./compiler/rustc_query_system/src/query/plumbing.rs:462:55
  71: stacker::maybe_grow
             at /Users/bn/.cargo/registry/src/github.com-1ecc6299db9ec823/stacker-0.1.12/src/lib.rs:55:9
  72: rustc_data_structures::stack::ensure_sufficient_stack
             at ./compiler/rustc_data_structures/src/stack.rs:16:5
  73: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query::{{closure}}::{{closure}}
             at ./compiler/rustc_query_impl/src/plumbing.rs:137:17
  74: rustc_middle::ty::context::tls::enter_context::{{closure}}
             at ./compiler/rustc_middle/src/ty/context.rs:1782:50
  75: rustc_middle::ty::context::tls::set_tlv
             at ./compiler/rustc_middle/src/ty/context.rs:1766:9
  76: rustc_middle::ty::context::tls::enter_context
             at ./compiler/rustc_middle/src/ty/context.rs:1782:9
  77: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query::{{closure}}
             at ./compiler/rustc_query_impl/src/plumbing.rs:136:13
  78: rustc_middle::ty::context::tls::with_related_context::{{closure}}
             at ./compiler/rustc_middle/src/ty/context.rs:1826:13
  79: rustc_middle::ty::context::tls::with_context::{{closure}}
             at ./compiler/rustc_middle/src/ty/context.rs:1810:40
  80: rustc_middle::ty::context::tls::with_context_opt
             at ./compiler/rustc_middle/src/ty/context.rs:1799:22
  81: rustc_middle::ty::context::tls::with_context
             at ./compiler/rustc_middle/src/ty/context.rs:1810:9
  82: rustc_middle::ty::context::tls::with_related_context
             at ./compiler/rustc_middle/src/ty/context.rs:1823:9
  83: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query
             at ./compiler/rustc_query_impl/src/plumbing.rs:125:9
  84: rustc_query_system::query::plumbing::try_execute_query
             at ./compiler/rustc_query_system/src/query/plumbing.rs:462:22
  85: rustc_query_system::query::plumbing::get_query_impl
             at ./compiler/rustc_query_system/src/query/plumbing.rs:730:5
  86: rustc_query_system::query::plumbing::get_query
             at ./compiler/rustc_query_system/src/query/plumbing.rs:853:17
  87: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::collect_and_partition_mono_items
             at ./compiler/rustc_query_impl/src/plumbing.rs:563:17
  88: rustc_middle::ty::query::TyCtxtAt::collect_and_partition_mono_items
             at ./compiler/rustc_middle/src/ty/query.rs:203:17
  89: rustc_middle::ty::query::<impl rustc_middle::ty::context::TyCtxt>::collect_and_partition_mono_items
             at ./compiler/rustc_middle/src/ty/query.rs:184:17
  90: rustc_codegen_ssa::base::codegen_crate
             at ./compiler/rustc_codegen_ssa/src/base.rs:507:25
  91: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
             at ./compiler/rustc_codegen_llvm/src/lib.rs:256:18
  92: rustc_interface::passes::start_codegen::{{closure}}
             at ./compiler/rustc_interface/src/passes.rs:1053:9
  93: rustc_data_structures::profiling::VerboseTimingGuard::run
             at ./compiler/rustc_data_structures/src/profiling.rs:611:9
  94: rustc_session::utils::<impl rustc_session::session::Session>::time
             at ./compiler/rustc_session/src/utils.rs:16:9
  95: rustc_interface::passes::start_codegen
             at ./compiler/rustc_interface/src/passes.rs:1052:19
  96: rustc_interface::queries::Queries::ongoing_codegen::{{closure}}::{{closure}}
             at ./compiler/rustc_interface/src/queries.rs:254:20
  97: rustc_interface::passes::QueryContext::enter::{{closure}}
             at ./compiler/rustc_interface/src/passes.rs:779:42
  98: rustc_middle::ty::context::tls::enter_context::{{closure}}
             at ./compiler/rustc_middle/src/ty/context.rs:1782:50
  99: rustc_middle::ty::context::tls::set_tlv
             at ./compiler/rustc_middle/src/ty/context.rs:1766:9
 100: rustc_middle::ty::context::tls::enter_context
             at ./compiler/rustc_middle/src/ty/context.rs:1782:9
 101: rustc_interface::passes::QueryContext::enter
             at ./compiler/rustc_interface/src/passes.rs:779:9
 102: rustc_interface::queries::Queries::ongoing_codegen::{{closure}}
             at ./compiler/rustc_interface/src/queries.rs:245:13
 103: rustc_interface::queries::Query<T>::compute
             at ./compiler/rustc_interface/src/queries.rs:38:28
 104: rustc_interface::queries::Queries::ongoing_codegen
             at ./compiler/rustc_interface/src/queries.rs:243:9
 105: rustc_driver::run_compiler::{{closure}}::{{closure}}
             at ./compiler/rustc_driver/src/lib.rs:407:13
 106: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
             at ./compiler/rustc_interface/src/queries.rs:390:19
 107: rustc_driver::run_compiler::{{closure}}
             at ./compiler/rustc_driver/src/lib.rs:312:22
 108: rustc_interface::interface::create_compiler_and_run::{{closure}}
             at ./compiler/rustc_interface/src/interface.rs:209:13
 109: rustc_span::with_source_map
             at ./compiler/rustc_span/src/lib.rs:913:5
 110: rustc_interface::interface::create_compiler_and_run
             at ./compiler/rustc_interface/src/interface.rs:203:5
 111: rustc_interface::interface::run_compiler::{{closure}}
             at ./compiler/rustc_interface/src/interface.rs:225:12
 112: rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals::{{closure}}::{{closure}}
             at ./compiler/rustc_interface/src/util.rs:157:13
 113: scoped_tls::ScopedKey<T>::set
             at /Users/bn/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137:9
 114: rustc_span::create_session_globals_then
             at ./compiler/rustc_span/src/lib.rs:107:5
 115: rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals::{{closure}}
             at ./compiler/rustc_interface/src/util.rs:155:9
 116: rustc_interface::util::scoped_thread::{{closure}}
             at ./compiler/rustc_interface/src/util.rs:130:24
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose 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-dev running on x86_64-apple-darwin

query stack during panic:
#0 [normalize_mir_const_after_erasing_regions] normalizing `std::process::ExitCode::SUCCESS`
#1 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
warning: 1 warning emitted

What does DefId(1:7173 ~ std[ff7f]::process::{impl#46}::SUCCESS correspond to? Where is the instance for that DefId created and why isn't it local? Could this be related to the changes in your PR?

cc @oli-obk

@fee1-dead
Copy link
Member

I have no idea what that ICE means. I haven't touched code in that backtrace.

@b-naber
Copy link
Contributor

b-naber commented Sep 2, 2021

@fee1-dead That ICE resulted from some debugging code I had included, sorry for the confusion.

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