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: Encountered error .. selecting .. during codegen: glacier / fixed/72793.rs #89312

Closed
matthiaskrgr opened this issue Sep 27, 2021 · 4 comments · Fixed by #94081 or #95471
Closed

ice: Encountered error .. selecting .. during codegen: glacier / fixed/72793.rs #89312

matthiaskrgr opened this issue Sep 27, 2021 · 4 comments · Fixed by #94081 or #95471
Labels
C-bug Category: This is a bug. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` glacier ICE tracked in rust-lang/glacier. 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

code from glacier/fixed/72793.rs

Code

#![feature(type_alias_impl_trait)]

trait T { type Item; }

type Alias<'a> = impl T<Item = &'a ()>;

struct S;
impl<'a> T for &'a S {
    type Item = &'a ();
}

fn filter_positive<'a>() -> Alias<'a> {
    &S
}

fn with_positive(fun: impl Fn(Alias<'_>)) {
    fun(filter_positive());
}

fn main() {
    with_positive(|_| ());
}

Meta

rustc --version --verbose:

rustc 1.57.0-nightly (2b6ed3b67 2021-09-27)
binary: rustc
commit-hash: 2b6ed3b675475abc01ce7e68bb75b457f0c85684
commit-date: 2021-09-27
host: x86_64-unknown-linux-gnu
release: 1.57.0-nightly
LLVM version: 13.0.0

Error output

error: internal compiler error: compiler/rustc_trait_selection/src/traits/codegen.rs:78:17: Encountered error `OutputTypeParameterMismatch(Binder(<[closure@./72793.rs:21:19: 21:25] as std::ops::Fn<(impl for<'r> T,)>>, [Region(BrAnon(0))]), Binder(<[closure@./72793.rs:21:19: 21:25] as std::ops::Fn<(&S,)>>, []), Sorts(ExpectedFound { expected: &S, found: impl T }))` selecting `Binder(<[closure@./72793.rs:21:19: 21:25] as std::ops::Fn<(&S,)>>, [])` during codegen

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1146: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.57.0-nightly (2b6ed3b67 2021-09-27) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [codegen_fulfill_obligation] checking if `core::ops::function::Fn` fulfills its obligations
#1 [resolve_instance] resolving instance `<[closure@./72793.rs:21:19: 21:25] as core::ops::function::Fn<(&S,)>>::call`
end of query stack
error: aborting due to previous error
Backtrace

error: internal compiler error: compiler/rustc_trait_selection/src/traits/codegen.rs:78:17: Encountered error `OutputTypeParameterMismatch(Binder(<[closure@./72793.rs:21:19: 21:25] as std::ops::Fn<(impl for<'r> T,)>>, [Region(BrAnon(0))]), Binder(<[closure@./72793.rs:21:19: 21:25] as std::ops::Fn<(&S,)>>, []), Sorts(ExpectedFound { expected: &S, found: impl T }))` selecting `Binder(<[closure@./72793.rs:21:19: 21:25] as std::ops::Fn<(&S,)>>, [])` during codegen

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1146:9
stack backtrace:
   0:     0x7fbedb43c05c - std::backtrace_rs::backtrace::libunwind::trace::h2ab374bc2a3b7023
                               at /rustc/2b6ed3b675475abc01ce7e68bb75b457f0c85684/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7fbedb43c05c - std::backtrace_rs::backtrace::trace_unsynchronized::h128cb5178b04dc46
                               at /rustc/2b6ed3b675475abc01ce7e68bb75b457f0c85684/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fbedb43c05c - std::sys_common::backtrace::_print_fmt::h5344f9eefca2041f
                               at /rustc/2b6ed3b675475abc01ce7e68bb75b457f0c85684/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7fbedb43c05c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h213003bc5c7acf04
                               at /rustc/2b6ed3b675475abc01ce7e68bb75b457f0c85684/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7fbedb49a02c - core::fmt::write::h78bf85fc3e93663f
                               at /rustc/2b6ed3b675475abc01ce7e68bb75b457f0c85684/library/core/src/fmt/mod.rs:1161:17
   5:     0x7fbedb42d7b5 - std::io::Write::write_fmt::he619515c888f21a5
                               at /rustc/2b6ed3b675475abc01ce7e68bb75b457f0c85684/library/std/src/io/mod.rs:1668:15
   6:     0x7fbedb43f380 - std::sys_common::backtrace::_print::hf706674f77848203
                               at /rustc/2b6ed3b675475abc01ce7e68bb75b457f0c85684/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7fbedb43f380 - std::sys_common::backtrace::print::hf0b6c7a88804ec56
                               at /rustc/2b6ed3b675475abc01ce7e68bb75b457f0c85684/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7fbedb43f380 - std::panicking::default_hook::{{closure}}::h2dde766cd83a333a
                               at /rustc/2b6ed3b675475abc01ce7e68bb75b457f0c85684/library/std/src/panicking.rs:210:50
   9:     0x7fbedb43ef2b - std::panicking::default_hook::h501e3b2e134eb149
                               at /rustc/2b6ed3b675475abc01ce7e68bb75b457f0c85684/library/std/src/panicking.rs:227:9
  10:     0x7fbedbc19121 - rustc_driver::DEFAULT_HOOK::{{closure}}::{{closure}}::h8ff5de92123cb8fd
  11:     0x7fbedb43fb99 - std::panicking::rust_panic_with_hook::hc09e869c4cf00885
                               at /rustc/2b6ed3b675475abc01ce7e68bb75b457f0c85684/library/std/src/panicking.rs:628:17
  12:     0x7fbedccf1d0b - std::panicking::begin_panic::{{closure}}::h5c7a29a9f3c50d8d
  13:     0x7fbedccf1c46 - std::sys_common::backtrace::__rust_end_short_backtrace::h11b7892876009c1e
  14:     0x7fbedccf1cdf - std::panicking::begin_panic::hd63e7fe0ba9182da
  15:     0x7fbedcd025dd - std::panic::panic_any::h3c06e175d31a9167
  16:     0x7fbedcd0467a - rustc_errors::HandlerInner::bug::he6d06053695a98ed
  17:     0x7fbedcd04120 - rustc_errors::Handler::bug::h61abf9991ffffcbc
  18:     0x7fbedcb7c416 - rustc_middle::ty::context::tls::with_opt::hd0b25ef1fa372784
  19:     0x7fbedcb7c920 - rustc_middle::util::bug::opt_span_bug_fmt::he982db01d383152c
  20:     0x7fbedcb7c896 - rustc_middle::util::bug::bug_fmt::h3252ae0338f3fde6
  21:     0x7fbedd7e813c - rustc_infer::infer::InferCtxtBuilder::enter::hec2ad036de26d1b3
  22:     0x7fbedd87a300 - rustc_trait_selection::traits::codegen::codegen_fulfill_obligation::hed4e9cb9d1de2510
  23:     0x7fbedd4d4457 - rustc_query_system::query::plumbing::get_query::h30eb0324a9879b87
  24:     0x7fbedd55fc4c - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::codegen_fulfill_obligation::h8abee1d4fec56f99
  25:     0x7fbedd0d12f3 - rustc_ty_utils::instance::inner_resolve_instance::h7eac2e598ef3ba40
  26:     0x7fbedd0d0080 - rustc_ty_utils::instance::resolve_instance::h87a188fe9327f0cd
  27:     0x7fbedd4f5aba - rustc_query_system::query::plumbing::get_query::hd722c6562df9f8d3
  28:     0x7fbedd564a9e - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::resolve_instance::h09952e8be47c097a
  29:     0x7fbedd9d2983 - rustc_middle::ty::instance::Instance::resolve::hc277be0f855cd859
  30:     0x7fbedceeaca6 - rustc_monomorphize::collector::collect_neighbours::h6e82023d33cda04c
  31:     0x7fbedcee5c8e - rustc_monomorphize::collector::collect_items_rec::hbe8a265e99aa8ce1
  32:     0x7fbedcee5df9 - rustc_monomorphize::collector::collect_items_rec::hbe8a265e99aa8ce1
  33:     0x7fbeddc68375 - rustc_session::utils::<impl rustc_session::session::Session>::time::h9332f921d1e660c4
  34:     0x7fbeddc6db8f - rustc_monomorphize::collector::collect_crate_mono_items::h1bd00d8a2e16193c
  35:     0x7fbeddc6d025 - rustc_monomorphize::partitioning::collect_and_partition_mono_items::ha6015931ad704302
  36:     0x7fbeddf53c60 - rustc_query_system::query::plumbing::try_execute_query::h5735bfbdb6792926
  37:     0x7fbeddfbdcb4 - rustc_query_system::query::plumbing::get_query::h051480b1940d0148
  38:     0x7fbede04fc2e - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::collect_and_partition_mono_items::h097303a84872e8bf
  39:     0x7fbeddb3be38 - rustc_codegen_ssa::base::codegen_crate::h1fe4c5f4ca7611b8
  40:     0x7fbeddb522aa - <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate::h31f11bd612d21420
  41:     0x7fbeddb0b207 - rustc_session::utils::<impl rustc_session::session::Session>::time::hecabaee18c46b59e
  42:     0x7fbeddae621b - rustc_interface::queries::Queries::ongoing_codegen::h0da52d2aa5626063
  43:     0x7fbeddac4d8f - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::hded9061889acb733
  44:     0x7fbeddab58e2 - rustc_span::with_source_map::hce3a664e96079636
  45:     0x7fbeddac6044 - rustc_interface::interface::create_compiler_and_run::ha4222a436c1ad978
  46:     0x7fbeddab68b2 - std::sys_common::backtrace::__rust_begin_short_backtrace::h4110caeb43804b52
  47:     0x7fbeddad8222 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h78b1590830fa3a44
  48:     0x7fbedb44cac3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h59eef3b9c8a82350
                               at /rustc/2b6ed3b675475abc01ce7e68bb75b457f0c85684/library/alloc/src/boxed.rs:1638:9
  49:     0x7fbedb44cac3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb5bbe017c347469c
                               at /rustc/2b6ed3b675475abc01ce7e68bb75b457f0c85684/library/alloc/src/boxed.rs:1638:9
  50:     0x7fbedb44cac3 - std::sys::unix::thread::Thread::new::thread_start::h62931528f61e35f5
                               at /rustc/2b6ed3b675475abc01ce7e68bb75b457f0c85684/library/std/src/sys/unix/thread.rs:106:17
  51:     0x7fbedb35a259 - start_thread
  52:     0x7fbedb26f5e3 - __GI___clone
  53:                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.57.0-nightly (2b6ed3b67 2021-09-27) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [codegen_fulfill_obligation] checking if `core::ops::function::Fn` fulfills its obligations
#1 [resolve_instance] resolving instance `<[closure@./72793.rs:21:19: 21:25] as core::ops::function::Fn<(&S,)>>::call`
#2 [collect_and_partition_mono_items] collect_and_partition_mono_items
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 Sep 27, 2021
@matthiaskrgr
Copy link
Member Author

The ICE appeared between rustc 1.57.0-nightly (05044c2e6 2021-09-26) and 98c8619502093f34ca82f8f26ccf32e753924440;
ran bisection:

searched toolchains addb4da686a97da46159f0123cb6cdc2ce3d7fdb through 98c8619502093f34ca82f8f26ccf32e753924440
Regression in 2b6ed3b

cc @jackh726

@jackh726
Copy link
Member

jackh726 commented Sep 28, 2021

If this is the worst we get - a regression in an unstable feature - I'll be happy. Not sure it will be.

That said, the "fix" is simple: revert the revert. But the perf impact needs to be addressed.

@matthiaskrgr
Copy link
Member Author

@oli-obk this still crashes 🤔

error: internal compiler error: compiler/rustc_trait_selection/src/traits/codegen.rs:98:13: VecMap(
                                    [
                                        (
                                            OpaqueTypeKey {
                                                def_id: DefId(0:7 ~ issue_89312[27c2]::Alias::{opaque#0}),
                                                substs: [
                                                    '_#0r,
                                                ],
                                            },
                                            OpaqueTypeDecl {
                                                hidden_type: OpaqueHiddenType {
                                                    span: no-location (#0),
                                                    ty: &S,
                                                },
                                                origin: TyAlias,
                                            },
                                        ),
                                    ],
                                )

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1279:9
stack backtrace:
   0:     0x7f882ea9d4bd - std::backtrace_rs::backtrace::libunwind::trace::h5518e6be1e7d4fed
                               at /rustc/f132bcf3bdf6d3ff9be7d02e8d0088b99007cd5e/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f882ea9d4bd - std::backtrace_rs::backtrace::trace_unsynchronized::h15fd2d8832f91324
                               at /rustc/f132bcf3bdf6d3ff9be7d02e8d0088b99007cd5e/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f882ea9d4bd - std::sys_common::backtrace::_print_fmt::h85c9b6dc9f59e211
                               at /rustc/f132bcf3bdf6d3ff9be7d02e8d0088b99007cd5e/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f882ea9d4bd - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h0b5d7dc6ae932a3c
                               at /rustc/f132bcf3bdf6d3ff9be7d02e8d0088b99007cd5e/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f882eaf732c - core::fmt::write::h5ceb17dd50b3b2a6
                               at /rustc/f132bcf3bdf6d3ff9be7d02e8d0088b99007cd5e/library/core/src/fmt/mod.rs:1190:17
   5:     0x7f882ea8ea11 - std::io::Write::write_fmt::h3447798faac22fb1
                               at /rustc/f132bcf3bdf6d3ff9be7d02e8d0088b99007cd5e/library/std/src/io/mod.rs:1655:15
   6:     0x7f882eaa05a5 - std::sys_common::backtrace::_print::h9a41a14aa8472d67
                               at /rustc/f132bcf3bdf6d3ff9be7d02e8d0088b99007cd5e/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f882eaa05a5 - std::sys_common::backtrace::print::had8dced11e076d04
                               at /rustc/f132bcf3bdf6d3ff9be7d02e8d0088b99007cd5e/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f882eaa05a5 - std::panicking::default_hook::{{closure}}::hf5b7507853788630
                               at /rustc/f132bcf3bdf6d3ff9be7d02e8d0088b99007cd5e/library/std/src/panicking.rs:295:22
   9:     0x7f882eaa0259 - std::panicking::default_hook::hae8fcf8cc0c48e73
                               at /rustc/f132bcf3bdf6d3ff9be7d02e8d0088b99007cd5e/library/std/src/panicking.rs:314:9
  10:     0x7f882f2c7181 - rustc_driver[534d81c5b56eff30]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f882eaa0cf0 - std::panicking::rust_panic_with_hook::ha56b4b8e979660f2
                               at /rustc/f132bcf3bdf6d3ff9be7d02e8d0088b99007cd5e/library/std/src/panicking.rs:702:17
  12:     0x7f88303654a1 - std[6abc34ddb203e24a]::panicking::begin_panic::<rustc_errors[60cffa1887773b15]::ExplicitBug>::{closure#0}
  13:     0x7f8830365126 - std[6abc34ddb203e24a]::sys_common::backtrace::__rust_end_short_backtrace::<std[6abc34ddb203e24a]::panicking::begin_panic<rustc_errors[60cffa1887773b15]::ExplicitBug>::{closure#0}, !>
  14:     0x7f883036c32f - std[6abc34ddb203e24a]::panicking::begin_panic::<rustc_errors[60cffa1887773b15]::ExplicitBug>
  15:     0x7f8830378586 - std[6abc34ddb203e24a]::panic::panic_any::<rustc_errors[60cffa1887773b15]::ExplicitBug>
  16:     0x7f883037a683 - <rustc_errors[60cffa1887773b15]::HandlerInner>::bug
  17:     0x7f883037a0e0 - <rustc_errors[60cffa1887773b15]::Handler>::bug
  18:     0x7f88302b9f56 - rustc_middle[2e9ecac3ac57679a]::ty::context::tls::with_opt::<rustc_middle[2e9ecac3ac57679a]::util::bug::opt_span_bug_fmt<rustc_span[c59ac07462d462be]::span_encoding::Span>::{closure#0}, ()>
  19:     0x7f88302bcfe6 - rustc_middle[2e9ecac3ac57679a]::util::bug::opt_span_bug_fmt::<rustc_span[c59ac07462d462be]::span_encoding::Span>
  20:     0x7f88302bcf53 - rustc_middle[2e9ecac3ac57679a]::util::bug::bug_fmt
  21:     0x7f8830e6c6f1 - <rustc_infer[19cbb247616e1fca]::infer::InferCtxtBuilder>::enter::<core[98647bc572ccb271]::result::Result<&rustc_middle[2e9ecac3ac57679a]::traits::ImplSource<()>, rustc_errors[60cffa1887773b15]::ErrorGuaranteed>, rustc_trait_selection[b2f2a884b31fcfb9]::traits::codegen::codegen_fulfill_obligation::{closure#0}>
  22:     0x7f8830ef987e - rustc_trait_selection[b2f2a884b31fcfb9]::traits::codegen::codegen_fulfill_obligation
  23:     0x7f8830bb3b59 - rustc_query_system[4eeaba550dde3146]::query::plumbing::try_execute_query::<rustc_query_impl[b8a580452fca6ad5]::plumbing::QueryCtxt, rustc_query_system[4eeaba550dde3146]::query::caches::DefaultCache<(rustc_middle[2e9ecac3ac57679a]::ty::ParamEnv, rustc_middle[2e9ecac3ac57679a]::ty::sty::Binder<rustc_middle[2e9ecac3ac57679a]::ty::sty::TraitRef>), core[98647bc572ccb271]::result::Result<&rustc_middle[2e9ecac3ac57679a]::traits::ImplSource<()>, rustc_errors[60cffa1887773b15]::ErrorGuaranteed>>>
  24:     0x7f8830c51785 - <rustc_query_impl[b8a580452fca6ad5]::Queries as rustc_middle[2e9ecac3ac57679a]::ty::query::QueryEngine>::codegen_fulfill_obligation
  25:     0x7f88307ada5a - rustc_ty_utils[37785157efa9b39b]::instance::inner_resolve_instance
  26:     0x7f88307acb4f - rustc_ty_utils[37785157efa9b39b]::instance::resolve_instance
  27:     0x7f8830bc52bc - rustc_query_system[4eeaba550dde3146]::query::plumbing::get_query::<rustc_query_impl[b8a580452fca6ad5]::queries::resolve_instance, rustc_query_impl[b8a580452fca6ad5]::plumbing::QueryCtxt>
  28:     0x7f8830c53888 - <rustc_query_impl[b8a580452fca6ad5]::Queries as rustc_middle[2e9ecac3ac57679a]::ty::query::QueryEngine>::resolve_instance
  29:     0x7f8831049393 - <rustc_middle[2e9ecac3ac57679a]::ty::instance::Instance>::resolve
  30:     0x7f8830584dc2 - rustc_monomorphize[617a6ab36e6002f]::collector::collect_neighbours
  31:     0x7f8830580064 - rustc_monomorphize[617a6ab36e6002f]::collector::collect_items_rec
  32:     0x7f88305801c8 - rustc_monomorphize[617a6ab36e6002f]::collector::collect_items_rec
  33:     0x7f88312ed8eb - <rustc_session[c60934eb1ab24f8d]::session::Session>::time::<(), rustc_monomorphize[617a6ab36e6002f]::collector::collect_crate_mono_items::{closure#1}>
  34:     0x7f88312ddc2b - rustc_monomorphize[617a6ab36e6002f]::collector::collect_crate_mono_items
  35:     0x7f88312e4766 - rustc_monomorphize[617a6ab36e6002f]::partitioning::collect_and_partition_mono_items
  36:     0x7f88316397a0 - rustc_query_system[4eeaba550dde3146]::query::plumbing::try_execute_query::<rustc_query_impl[b8a580452fca6ad5]::plumbing::QueryCtxt, rustc_query_system[4eeaba550dde3146]::query::caches::DefaultCache<(), (&std[6abc34ddb203e24a]::collections::hash::set::HashSet<rustc_span[c59ac07462d462be]::def_id::DefId, core[98647bc572ccb271]::hash::BuildHasherDefault<rustc_hash[6368fc160eb0a0c8]::FxHasher>>, &[rustc_middle[2e9ecac3ac57679a]::mir::mono::CodegenUnit])>>
  37:     0x7f883166e7e5 - rustc_query_system[4eeaba550dde3146]::query::plumbing::get_query::<rustc_query_impl[b8a580452fca6ad5]::queries::collect_and_partition_mono_items, rustc_query_impl[b8a580452fca6ad5]::plumbing::QueryCtxt>
  38:     0x7f883171a5a2 - <rustc_query_impl[b8a580452fca6ad5]::Queries as rustc_middle[2e9ecac3ac57679a]::ty::query::QueryEngine>::collect_and_partition_mono_items
  39:     0x7f883118b9b0 - <rustc_codegen_llvm[778abd054f5e5b38]::LlvmCodegenBackend as rustc_codegen_ssa[a5e4443dd651f1d7]::traits::backend::CodegenBackend>::codegen_crate
  40:     0x7f88311708a7 - <rustc_session[c60934eb1ab24f8d]::session::Session>::time::<alloc[6c9db84e1ceb9229]::boxed::Box<dyn core[98647bc572ccb271]::any::Any>, rustc_interface[4f22add5d71eaea7]::passes::start_codegen::{closure#0}>
  41:     0x7f883115f408 - <rustc_interface[4f22add5d71eaea7]::passes::QueryContext>::enter::<<rustc_interface[4f22add5d71eaea7]::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core[98647bc572ccb271]::result::Result<alloc[6c9db84e1ceb9229]::boxed::Box<dyn core[98647bc572ccb271]::any::Any>, rustc_errors[60cffa1887773b15]::ErrorGuaranteed>>
  42:     0x7f88311550af - <rustc_interface[4f22add5d71eaea7]::queries::Queries>::ongoing_codegen
  43:     0x7f8831119eab - <rustc_interface[4f22add5d71eaea7]::interface::Compiler>::enter::<rustc_driver[534d81c5b56eff30]::run_compiler::{closure#1}::{closure#2}, core[98647bc572ccb271]::result::Result<core[98647bc572ccb271]::option::Option<rustc_interface[4f22add5d71eaea7]::queries::Linker>, rustc_errors[60cffa1887773b15]::ErrorGuaranteed>>
  44:     0x7f883112cebf - rustc_span[c59ac07462d462be]::with_source_map::<core[98647bc572ccb271]::result::Result<(), rustc_errors[60cffa1887773b15]::ErrorGuaranteed>, rustc_interface[4f22add5d71eaea7]::interface::create_compiler_and_run<core[98647bc572ccb271]::result::Result<(), rustc_errors[60cffa1887773b15]::ErrorGuaranteed>, rustc_driver[534d81c5b56eff30]::run_compiler::{closure#1}>::{closure#1}>
  45:     0x7f883111aaf4 - rustc_interface[4f22add5d71eaea7]::interface::create_compiler_and_run::<core[98647bc572ccb271]::result::Result<(), rustc_errors[60cffa1887773b15]::ErrorGuaranteed>, rustc_driver[534d81c5b56eff30]::run_compiler::{closure#1}>
  46:     0x7f8831117862 - <scoped_tls[3f8091782b19ddb8]::ScopedKey<rustc_span[c59ac07462d462be]::SessionGlobals>>::set::<rustc_interface[4f22add5d71eaea7]::interface::run_compiler<core[98647bc572ccb271]::result::Result<(), rustc_errors[60cffa1887773b15]::ErrorGuaranteed>, rustc_driver[534d81c5b56eff30]::run_compiler::{closure#1}>::{closure#0}, core[98647bc572ccb271]::result::Result<(), rustc_errors[60cffa1887773b15]::ErrorGuaranteed>>
  47:     0x7f8831115bbf - std[6abc34ddb203e24a]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[4f22add5d71eaea7]::util::run_in_thread_pool_with_globals<rustc_interface[4f22add5d71eaea7]::interface::run_compiler<core[98647bc572ccb271]::result::Result<(), rustc_errors[60cffa1887773b15]::ErrorGuaranteed>, rustc_driver[534d81c5b56eff30]::run_compiler::{closure#1}>::{closure#0}, core[98647bc572ccb271]::result::Result<(), rustc_errors[60cffa1887773b15]::ErrorGuaranteed>>::{closure#0}, core[98647bc572ccb271]::result::Result<(), rustc_errors[60cffa1887773b15]::ErrorGuaranteed>>
  48:     0x7f883112de52 - <<std[6abc34ddb203e24a]::thread::Builder>::spawn_unchecked_<rustc_interface[4f22add5d71eaea7]::util::run_in_thread_pool_with_globals<rustc_interface[4f22add5d71eaea7]::interface::run_compiler<core[98647bc572ccb271]::result::Result<(), rustc_errors[60cffa1887773b15]::ErrorGuaranteed>, rustc_driver[534d81c5b56eff30]::run_compiler::{closure#1}>::{closure#0}, core[98647bc572ccb271]::result::Result<(), rustc_errors[60cffa1887773b15]::ErrorGuaranteed>>::{closure#0}, core[98647bc572ccb271]::result::Result<(), rustc_errors[60cffa1887773b15]::ErrorGuaranteed>>::{closure#1} as core[98647bc572ccb271]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  49:     0x7f882eaaaee3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h2886a9bccd9e4f41
                               at /rustc/f132bcf3bdf6d3ff9be7d02e8d0088b99007cd5e/library/alloc/src/boxed.rs:1861:9
  50:     0x7f882eaaaee3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h24fe0a3ccb1a9186
                               at /rustc/f132bcf3bdf6d3ff9be7d02e8d0088b99007cd5e/library/alloc/src/boxed.rs:1861:9
  51:     0x7f882eaaaee3 - std::sys::unix::thread::Thread::new::thread_start::h6e8defb8d96e41f9
                               at /rustc/f132bcf3bdf6d3ff9be7d02e8d0088b99007cd5e/library/std/src/sys/unix/thread.rs:108:17
  52:     0x7f882e8835c2 - start_thread
  53:     0x7f882e908584 - __clone
  54:                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.61.0-nightly (f132bcf3b 2022-03-30) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [codegen_fulfill_obligation] checking if `core::ops::function::Fn` fulfills its obligations
#1 [resolve_instance] resolving instance `<[closure@./src/test/ui/impl-trait/issues/issue-89312.rs:23:19: 23:25] as core::ops::function::Fn<(&S,)>>::call`
#2 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
error: aborting due to previous error

@oli-obk
Copy link
Contributor

oli-obk commented Mar 30, 2022

oh... I only did a check, need to build all the way to codegen to hit this.

Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Mar 30, 2022
Don't ICE when opaque types get their hidden type constrained again.

Contrary to popular belief, `codegen_fulfill_obligation` does not get used solely in codegen, so we cannot rely on `param_env` being set to RevealAll and thus revealing the hidden types instead of constraining them.

Fixes rust-lang#89312 (for real this time)
@bors bors closed this as completed in 64a3767 Mar 31, 2022
@oli-obk oli-obk moved this from Todo to Done in type alias impl trait stabilization Sep 9, 2022
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. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` glacier ICE tracked in rust-lang/glacier. 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.
4 participants