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: unwrap on None in find_cycle_in_stack #105321

Closed
jruderman opened this issue Dec 5, 2022 · 2 comments
Closed

ICE: unwrap on None in find_cycle_in_stack #105321

jruderman opened this issue Dec 5, 2022 · 2 comments
Assignees
Labels
C-bug Category: This is a bug. 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

@jruderman
Copy link
Contributor

jruderman commented Dec 5, 2022

Found with a modified fuzz-rustc

Code

fn hof<F>(_: F)
where
    F: FnMut() -> (),
{
}

fn f() -> _ {
    hof(f);
}

fn main() {}

Error output

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', [compiler/rustc_query_system/src/query/job.rs:137](https://github.com/rust-lang/rust/blob/53e4b9dd74c29cc9308b8d0f10facac70bb101a7/compiler/rustc_query_system/src/query/job.rs#L137)

error: internal compiler error: unexpected panic

error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error[[E0391](https://doc.rust-lang.org/error_codes/E0391.html)]: cycle detected when computing function signature of `f`

error: internal compiler error: `TyKind::Error` constructed but no error reported
  |
  = note: delayed at [compiler/rustc_middle/src/values.rs:36](https://github.com/rust-lang/rust/blob/53e4b9dd74c29cc9308b8d0f10facac70bb101a7/compiler/rustc_middle/src/values.rs#L36)
Full output including two backtraces
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_query_system/src/query/job.rs:137:24
stack backtrace:
   0:        0x110214b76 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h4fbf7f9506d0d7e9
   1:        0x1102735ba - core::fmt::write::h99e5c56cbde66a79
   2:        0x110206f4c - std::io::Write::write_fmt::h898a203805a2f0c7
   3:        0x11021495a - std::sys_common::backtrace::print::h9e2881390d902908
   4:        0x110217cc3 - std::panicking::default_hook::{{closure}}::h46869a929ac7ef1e
   5:        0x110217a18 - std::panicking::default_hook::h9fcd367a8b22b0ea
   6:        0x11cb2796d - rustc_driver[c92f8c32e51f19c4]::DEFAULT_HOOK::{closure#0}::{closure#0}
   7:        0x1102184a7 - std::panicking::rust_panic_with_hook::h8cbaa9a506f5110c
   8:        0x110218213 - std::panicking::begin_panic_handler::{{closure}}::h84be22477d41ec61
   9:        0x110215018 - std::sys_common::backtrace::__rust_end_short_backtrace::h9f0abd4aedd5a88e
  10:        0x110217f1d - _rust_begin_unwind
  11:        0x11029fa43 - core::panicking::panic_fmt::hd6b0bfc3dbc6745d
  12:        0x11029fb17 - core::panicking::panic::h88ce25cb0ff92a1c
  13:        0x121a221e3 - <rustc_query_system[e953eb575b1af2ed]::query::job::QueryJobId>::find_cycle_in_stack
  14:        0x120377343 - rustc_query_system[e953eb575b1af2ed]::query::plumbing::try_execute_query::<rustc_query_impl[5215ea03a65f0d15]::plumbing::QueryCtxt, rustc_query_system[e953eb575b1af2ed]::query::caches::DefaultCache<rustc_span[fb6f3bfe63cfc4d8]::def_id::DefId, rustc_middle[ebe25b18dd1c0827]::ty::sty::Binder<rustc_middle[ebe25b18dd1c0827]::ty::sty::FnSig>>>
  15:        0x1204a3b22 - rustc_query_system[e953eb575b1af2ed]::query::plumbing::get_query::<rustc_query_impl[5215ea03a65f0d15]::queries::fn_sig, rustc_query_impl[5215ea03a65f0d15]::plumbing::QueryCtxt>
  16:        0x120554ef5 - <rustc_query_impl[5215ea03a65f0d15]::Queries as rustc_middle[ebe25b18dd1c0827]::ty::query::QueryEngine>::fn_sig
  17:        0x12141e164 - <rustc_middle[ebe25b18dd1c0827]::ty::context::TyCtxt>::bound_fn_sig
  18:        0x1214798ce - <rustc_middle[ebe25b18dd1c0827]::ty::print::pretty::FmtPrinter as rustc_middle[ebe25b18dd1c0827]::ty::print::pretty::PrettyPrinter>::pretty_print_type
  19:        0x121349a77 - <rustc_middle[ebe25b18dd1c0827]::ty::TraitPredicate as rustc_middle[ebe25b18dd1c0827]::ty::print::Print<rustc_middle[ebe25b18dd1c0827]::ty::print::pretty::FmtPrinter>>::print
  20:        0x121349d34 - <rustc_middle[ebe25b18dd1c0827]::ty::PredicateKind as rustc_middle[ebe25b18dd1c0827]::ty::print::Print<rustc_middle[ebe25b18dd1c0827]::ty::print::pretty::FmtPrinter>>::print
  21:        0x12148ab17 - <rustc_middle[ebe25b18dd1c0827]::ty::print::pretty::FmtPrinter as rustc_middle[ebe25b18dd1c0827]::ty::print::pretty::PrettyPrinter>::in_binder::<rustc_middle[ebe25b18dd1c0827]::ty::PredicateKind>
  22:        0x12134ab74 - <rustc_middle[ebe25b18dd1c0827]::ty::Predicate as core[888d5284bcc5795e]::fmt::Display>::fmt
  23:        0x1102735ba - core::fmt::write::h99e5c56cbde66a79
  24:        0x110265959 - alloc::fmt::format::format_inner::h02036a78709044df
  25:        0x121318270 - rustc_middle[ebe25b18dd1c0827]::query::descs::evaluate_obligation
  26:        0x1206a5036 - rustc_query_impl[5215ea03a65f0d15]::plumbing::create_query_frame::<rustc_middle[ebe25b18dd1c0827]::infer::canonical::Canonical<rustc_middle[ebe25b18dd1c0827]::ty::ParamEnvAnd<rustc_middle[ebe25b18dd1c0827]::ty::Ty>>>
  27:        0x1206eb8aa - <rustc_query_impl[5215ea03a65f0d15]::query_structs::evaluate_obligation::{closure#0} as core[888d5284bcc5795e]::ops::function::FnOnce<(rustc_query_impl[5215ea03a65f0d15]::plumbing::QueryCtxt, &mut std[af48a373fa65f370]::collections::hash::map::HashMap<rustc_query_system[e953eb575b1af2ed]::query::job::QueryJobId, rustc_query_system[e953eb575b1af2ed]::query::job::QueryJobInfo, core[888d5284bcc5795e]::hash::BuildHasherDefault<rustc_hash[b7d300aa73f447d6]::FxHasher>>)>>::call_once
  28:        0x1203772a9 - rustc_query_system[e953eb575b1af2ed]::query::plumbing::try_execute_query::<rustc_query_impl[5215ea03a65f0d15]::plumbing::QueryCtxt, rustc_query_system[e953eb575b1af2ed]::query::caches::DefaultCache<rustc_span[fb6f3bfe63cfc4d8]::def_id::DefId, rustc_middle[ebe25b18dd1c0827]::ty::sty::Binder<rustc_middle[ebe25b18dd1c0827]::ty::sty::FnSig>>>
  29:        0x1204a3b22 - rustc_query_system[e953eb575b1af2ed]::query::plumbing::get_query::<rustc_query_impl[5215ea03a65f0d15]::queries::fn_sig, rustc_query_impl[5215ea03a65f0d15]::plumbing::QueryCtxt>
  30:        0x120554ef5 - <rustc_query_impl[5215ea03a65f0d15]::Queries as rustc_middle[ebe25b18dd1c0827]::ty::query::QueryEngine>::fn_sig
  31:        0x12141e164 - <rustc_middle[ebe25b18dd1c0827]::ty::context::TyCtxt>::bound_fn_sig
  32:        0x121345f82 - <rustc_middle[ebe25b18dd1c0827]::ty::Ty>::fn_sig
  33:        0x12113f684 - <rustc_trait_selection[361dfe89ec7dcc93]::traits::select::SelectionContext>::assemble_fn_pointer_candidates
  34:        0x121147162 - <rustc_trait_selection[361dfe89ec7dcc93]::traits::select::SelectionContext>::assemble_candidates
  35:        0x1211417b2 - <rustc_trait_selection[361dfe89ec7dcc93]::traits::select::SelectionContext>::candidate_from_obligation_no_cache
  36:        0x12116438d - <rustc_query_system[e953eb575b1af2ed]::dep_graph::graph::DepGraph<rustc_middle[ebe25b18dd1c0827]::dep_graph::dep_node::DepKind>>::with_anon_task::<rustc_middle[ebe25b18dd1c0827]::ty::context::TyCtxt, <rustc_trait_selection[361dfe89ec7dcc93]::traits::select::SelectionContext>::in_task<<rustc_trait_selection[361dfe89ec7dcc93]::traits::select::SelectionContext>::candidate_from_obligation::{closure#0}::{closure#0}, core[888d5284bcc5795e]::result::Result<core[888d5284bcc5795e]::option::Option<rustc_middle[ebe25b18dd1c0827]::traits::select::SelectionCandidate>, rustc_middle[ebe25b18dd1c0827]::traits::SelectionError>>::{closure#0}, core[888d5284bcc5795e]::result::Result<core[888d5284bcc5795e]::option::Option<rustc_middle[ebe25b18dd1c0827]::traits::select::SelectionCandidate>, rustc_middle[ebe25b18dd1c0827]::traits::SelectionError>>
  37:        0x121151483 - <rustc_trait_selection[361dfe89ec7dcc93]::traits::select::SelectionContext>::candidate_from_obligation
  38:        0x12114389c - <rustc_trait_selection[361dfe89ec7dcc93]::traits::select::SelectionContext>::evaluate_stack
  39:        0x121164729 - <rustc_query_system[e953eb575b1af2ed]::dep_graph::graph::DepGraph<rustc_middle[ebe25b18dd1c0827]::dep_graph::dep_node::DepKind>>::with_anon_task::<rustc_middle[ebe25b18dd1c0827]::ty::context::TyCtxt, <rustc_trait_selection[361dfe89ec7dcc93]::traits::select::SelectionContext>::in_task<<rustc_trait_selection[361dfe89ec7dcc93]::traits::select::SelectionContext>::evaluate_trait_predicate_recursively::{closure#0}::{closure#2}, core[888d5284bcc5795e]::result::Result<rustc_middle[ebe25b18dd1c0827]::traits::select::EvaluationResult, rustc_middle[ebe25b18dd1c0827]::traits::select::OverflowError>>::{closure#0}, core[888d5284bcc5795e]::result::Result<rustc_middle[ebe25b18dd1c0827]::traits::select::EvaluationResult, rustc_middle[ebe25b18dd1c0827]::traits::select::OverflowError>>
  40:        0x121153b40 - <rustc_trait_selection[361dfe89ec7dcc93]::traits::select::SelectionContext>::evaluate_trait_predicate_recursively
  41:        0x1211523ec - <rustc_trait_selection[361dfe89ec7dcc93]::traits::select::SelectionContext>::evaluate_predicate_recursively
  42:        0x1210d7e87 - <rustc_infer[bd7782ecffaf2fb6]::infer::InferCtxt>::probe::<core[888d5284bcc5795e]::result::Result<rustc_middle[ebe25b18dd1c0827]::traits::select::EvaluationResult, rustc_middle[ebe25b18dd1c0827]::traits::select::OverflowError>, <rustc_trait_selection[361dfe89ec7dcc93]::traits::select::SelectionContext>::evaluation_probe<<rustc_trait_selection[361dfe89ec7dcc93]::traits::select::SelectionContext>::evaluate_root_obligation::{closure#0}>::{closure#0}>
  43:        0x1211436a0 - <rustc_trait_selection[361dfe89ec7dcc93]::traits::select::SelectionContext>::evaluate_root_obligation
  44:        0x1200b9a10 - rustc_traits[732533c0770d89a6]::evaluate_obligation::evaluate_obligation
  45:        0x12034b129 - rustc_query_system[e953eb575b1af2ed]::query::plumbing::try_execute_query::<rustc_query_impl[5215ea03a65f0d15]::plumbing::QueryCtxt, rustc_query_system[e953eb575b1af2ed]::query::caches::DefaultCache<rustc_middle[ebe25b18dd1c0827]::infer::canonical::Canonical<rustc_middle[ebe25b18dd1c0827]::ty::ParamEnvAnd<rustc_middle[ebe25b18dd1c0827]::ty::Predicate>>, core[888d5284bcc5795e]::result::Result<rustc_middle[ebe25b18dd1c0827]::traits::select::EvaluationResult, rustc_middle[ebe25b18dd1c0827]::traits::select::OverflowError>>>
  46:        0x1204977d2 - rustc_query_system[e953eb575b1af2ed]::query::plumbing::get_query::<rustc_query_impl[5215ea03a65f0d15]::queries::evaluate_obligation, rustc_query_impl[5215ea03a65f0d15]::plumbing::QueryCtxt>
  47:        0x120556cc9 - <rustc_query_impl[5215ea03a65f0d15]::Queries as rustc_middle[ebe25b18dd1c0827]::ty::query::QueryEngine>::evaluate_obligation
  48:        0x1210f862f - <rustc_infer[bd7782ecffaf2fb6]::infer::InferCtxt as rustc_trait_selection[361dfe89ec7dcc93]::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation
  49:        0x1210f872f - <rustc_infer[bd7782ecffaf2fb6]::infer::InferCtxt as rustc_trait_selection[361dfe89ec7dcc93]::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation_no_overflow
  50:        0x121193a9d - <rustc_trait_selection[361dfe89ec7dcc93]::traits::fulfill::FulfillProcessor>::process_trait_obligation
  51:        0x121192b96 - <rustc_trait_selection[361dfe89ec7dcc93]::traits::fulfill::FulfillProcessor as rustc_data_structures[d16cb5cdf3dc4b2a]::obligation_forest::ObligationProcessor>::process_obligation
  52:        0x1210982f0 - <rustc_data_structures[d16cb5cdf3dc4b2a]::obligation_forest::ObligationForest<rustc_trait_selection[361dfe89ec7dcc93]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[361dfe89ec7dcc93]::traits::fulfill::FulfillProcessor>
  53:        0x12118f458 - <rustc_trait_selection[361dfe89ec7dcc93]::traits::fulfill::FulfillmentContext as rustc_infer[bd7782ecffaf2fb6]::traits::engine::TraitEngine>::select_where_possible
  54:        0x11f32a423 - <rustc_hir_typeck[54d69da23aab2155]::fn_ctxt::FnCtxt>::check_argument_types
  55:        0x11f308d73 - <rustc_hir_typeck[54d69da23aab2155]::fn_ctxt::FnCtxt>::confirm_builtin_call
  56:        0x11f305da7 - <rustc_hir_typeck[54d69da23aab2155]::fn_ctxt::FnCtxt>::check_call
  57:        0x11f375f0e - <rustc_hir_typeck[54d69da23aab2155]::fn_ctxt::FnCtxt>::check_expr_kind
  58:        0x11f319cdf - <rustc_hir_typeck[54d69da23aab2155]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  59:        0x11f3323a5 - <rustc_hir_typeck[54d69da23aab2155]::fn_ctxt::FnCtxt>::check_stmt
  60:        0x11f332b2f - <rustc_hir_typeck[54d69da23aab2155]::fn_ctxt::FnCtxt>::check_block_with_expected
  61:        0x11f3762de - <rustc_hir_typeck[54d69da23aab2155]::fn_ctxt::FnCtxt>::check_expr_kind
  62:        0x11f319cdf - <rustc_hir_typeck[54d69da23aab2155]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  63:        0x11f31b420 - <rustc_hir_typeck[54d69da23aab2155]::fn_ctxt::FnCtxt>::check_return_expr
  64:        0x11f454ba0 - rustc_hir_typeck[54d69da23aab2155]::check::check_fn
  65:        0x11f415ef9 - rustc_hir_typeck[54d69da23aab2155]::typeck
  66:        0x12041db82 - rustc_query_system[e953eb575b1af2ed]::query::plumbing::try_execute_query::<rustc_query_impl[5215ea03a65f0d15]::plumbing::QueryCtxt, rustc_query_system[e953eb575b1af2ed]::query::caches::VecCache<rustc_span[fb6f3bfe63cfc4d8]::def_id::LocalDefId, &rustc_middle[ebe25b18dd1c0827]::ty::context::TypeckResults>>
  67:        0x1204a3e14 - rustc_query_system[e953eb575b1af2ed]::query::plumbing::get_query::<rustc_query_impl[5215ea03a65f0d15]::queries::typeck, rustc_query_impl[5215ea03a65f0d15]::plumbing::QueryCtxt>
  68:        0x11f5d8950 - rustc_hir_analysis[a5ba6f320bd8c4ca]::collect::infer_return_ty_for_fn_sig
  69:        0x11f5e359d - rustc_hir_analysis[a5ba6f320bd8c4ca]::collect::fn_sig
  70:        0x12037770d - rustc_query_system[e953eb575b1af2ed]::query::plumbing::try_execute_query::<rustc_query_impl[5215ea03a65f0d15]::plumbing::QueryCtxt, rustc_query_system[e953eb575b1af2ed]::query::caches::DefaultCache<rustc_span[fb6f3bfe63cfc4d8]::def_id::DefId, rustc_middle[ebe25b18dd1c0827]::ty::sty::Binder<rustc_middle[ebe25b18dd1c0827]::ty::sty::FnSig>>>
  71:        0x1204a3b22 - rustc_query_system[e953eb575b1af2ed]::query::plumbing::get_query::<rustc_query_impl[5215ea03a65f0d15]::queries::fn_sig, rustc_query_impl[5215ea03a65f0d15]::plumbing::QueryCtxt>
  72:        0x120554ef5 - <rustc_query_impl[5215ea03a65f0d15]::Queries as rustc_middle[ebe25b18dd1c0827]::ty::query::QueryEngine>::fn_sig
  73:        0x11f5d6080 - rustc_hir_analysis[a5ba6f320bd8c4ca]::collect::convert_item
  74:        0x11f5cd93c - <rustc_hir_analysis[a5ba6f320bd8c4ca]::collect::CollectItemTypesVisitor as rustc_hir[6fc034d4959f7c6c]::intravisit::Visitor>::visit_item
  75:        0x11f5039f9 - <rustc_middle[ebe25b18dd1c0827]::hir::map::Map>::visit_item_likes_in_module::<rustc_hir_analysis[a5ba6f320bd8c4ca]::collect::CollectItemTypesVisitor>
  76:        0x11f5ccf55 - rustc_hir_analysis[a5ba6f320bd8c4ca]::collect::collect_mod_item_types
  77:        0x120423282 - rustc_query_system[e953eb575b1af2ed]::query::plumbing::try_execute_query::<rustc_query_impl[5215ea03a65f0d15]::plumbing::QueryCtxt, rustc_query_system[e953eb575b1af2ed]::query::caches::VecCache<rustc_span[fb6f3bfe63cfc4d8]::def_id::LocalDefId, ()>>
  78:        0x12049c0f1 - rustc_query_system[e953eb575b1af2ed]::query::plumbing::get_query::<rustc_query_impl[5215ea03a65f0d15]::queries::collect_mod_item_types, rustc_query_impl[5215ea03a65f0d15]::plumbing::QueryCtxt>
  79:        0x11f5032ca - <rustc_middle[ebe25b18dd1c0827]::hir::map::Map>::for_each_module::<rustc_hir_analysis[a5ba6f320bd8c4ca]::check_crate::{closure#0}::{closure#0}::{closure#0}>
  80:        0x11f598051 - <rustc_session[c6782d7b3e3bb857]::session::Session>::track_errors::<rustc_hir_analysis[a5ba6f320bd8c4ca]::check_crate::{closure#0}, ()>
  81:        0x11f6a2168 - rustc_hir_analysis[a5ba6f320bd8c4ca]::check_crate
  82:        0x11cbd04ca - rustc_interface[857b37ce07fbf291]::passes::analysis
  83:        0x1203d9af4 - rustc_query_system[e953eb575b1af2ed]::query::plumbing::try_execute_query::<rustc_query_impl[5215ea03a65f0d15]::plumbing::QueryCtxt, rustc_query_system[e953eb575b1af2ed]::query::caches::DefaultCache<(), core[888d5284bcc5795e]::result::Result<(), rustc_errors[e5253effe2ad2635]::ErrorGuaranteed>>>
  84:        0x1204a41f1 - rustc_query_system[e953eb575b1af2ed]::query::plumbing::get_query::<rustc_query_impl[5215ea03a65f0d15]::queries::analysis, rustc_query_impl[5215ea03a65f0d15]::plumbing::QueryCtxt>
  85:        0x11cab92f7 - <rustc_interface[857b37ce07fbf291]::passes::QueryContext>::enter::<rustc_driver[c92f8c32e51f19c4]::run_compiler::{closure#1}::{closure#2}::{closure#2}, core[888d5284bcc5795e]::result::Result<(), rustc_errors[e5253effe2ad2635]::ErrorGuaranteed>>
  86:        0x11caffe25 - <rustc_interface[857b37ce07fbf291]::interface::Compiler>::enter::<rustc_driver[c92f8c32e51f19c4]::run_compiler::{closure#1}::{closure#2}, core[888d5284bcc5795e]::result::Result<core[888d5284bcc5795e]::option::Option<rustc_interface[857b37ce07fbf291]::queries::Linker>, rustc_errors[e5253effe2ad2635]::ErrorGuaranteed>>
  87:        0x11ca9a42d - rustc_span[fb6f3bfe63cfc4d8]::with_source_map::<core[888d5284bcc5795e]::result::Result<(), rustc_errors[e5253effe2ad2635]::ErrorGuaranteed>, rustc_interface[857b37ce07fbf291]::interface::run_compiler<core[888d5284bcc5795e]::result::Result<(), rustc_errors[e5253effe2ad2635]::ErrorGuaranteed>, rustc_driver[c92f8c32e51f19c4]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  88:        0x11caf2d5d - <scoped_tls[290510afb68802d4]::ScopedKey<rustc_span[fb6f3bfe63cfc4d8]::SessionGlobals>>::set::<rustc_interface[857b37ce07fbf291]::interface::run_compiler<core[888d5284bcc5795e]::result::Result<(), rustc_errors[e5253effe2ad2635]::ErrorGuaranteed>, rustc_driver[c92f8c32e51f19c4]::run_compiler::{closure#1}>::{closure#0}, core[888d5284bcc5795e]::result::Result<(), rustc_errors[e5253effe2ad2635]::ErrorGuaranteed>>
  89:        0x11cac224a - std[af48a373fa65f370]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[857b37ce07fbf291]::util::run_in_thread_pool_with_globals<rustc_interface[857b37ce07fbf291]::interface::run_compiler<core[888d5284bcc5795e]::result::Result<(), rustc_errors[e5253effe2ad2635]::ErrorGuaranteed>, rustc_driver[c92f8c32e51f19c4]::run_compiler::{closure#1}>::{closure#0}, core[888d5284bcc5795e]::result::Result<(), rustc_errors[e5253effe2ad2635]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[888d5284bcc5795e]::result::Result<(), rustc_errors[e5253effe2ad2635]::ErrorGuaranteed>>
  90:        0x11caa4165 - <<std[af48a373fa65f370]::thread::Builder>::spawn_unchecked_<rustc_interface[857b37ce07fbf291]::util::run_in_thread_pool_with_globals<rustc_interface[857b37ce07fbf291]::interface::run_compiler<core[888d5284bcc5795e]::result::Result<(), rustc_errors[e5253effe2ad2635]::ErrorGuaranteed>, rustc_driver[c92f8c32e51f19c4]::run_compiler::{closure#1}>::{closure#0}, core[888d5284bcc5795e]::result::Result<(), rustc_errors[e5253effe2ad2635]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[888d5284bcc5795e]::result::Result<(), rustc_errors[e5253effe2ad2635]::ErrorGuaranteed>>::{closure#1} as core[888d5284bcc5795e]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  91:        0x110221797 - std::sys::unix::thread::Thread::new::thread_start::h90404ce6cd9b7cbc
  92:     0x7ff8083354e1 - __pthread_start

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.67.0-nightly (53e4b9dd7 2022-12-04) running on x86_64-apple-darwin

query stack during panic:
end of query stack
error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error[E0391]: cycle detected when computing function signature of `f`
  --> oing.rs:7:1
   |
7  | fn f() -> _ {
   | ^^^^^^^^^^^
   |
note: ...which requires type-checking `f`...
  --> oing.rs:7:1
   |
7  | fn f() -> _ {
   | ^^^^^^^^^^^
   = note: ...which again requires computing function signature of `f`, completing the cycle
note: cycle used when collecting item types in top-level module
  --> oing.rs:1:1
   |
1  | / fn hof<F>(_: F)
2  | | where
3  | |     F: FnMut() -> (),
4  | | {
...  |
10 | |
11 | | fn main() {}
   | |____________^

error: internal compiler error: TyKind::Error constructed but no error reported
  |
  = note: delayed at compiler/rustc_middle/src/values.rs:36:23

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1610:13
stack backtrace:
   0:        0x110214b76 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h4fbf7f9506d0d7e9
   1:        0x1102735ba - core::fmt::write::h99e5c56cbde66a79
   2:        0x110206f4c - std::io::Write::write_fmt::h898a203805a2f0c7
   3:        0x11021495a - std::sys_common::backtrace::print::h9e2881390d902908
   4:        0x110217cc3 - std::panicking::default_hook::{{closure}}::h46869a929ac7ef1e
   5:        0x110217a18 - std::panicking::default_hook::h9fcd367a8b22b0ea
   6:        0x11cb2796d - rustc_driver[c92f8c32e51f19c4]::DEFAULT_HOOK::{closure#0}::{closure#0}
   7:        0x1102184a7 - std::panicking::rust_panic_with_hook::h8cbaa9a506f5110c
   8:        0x121609147 - std[af48a373fa65f370]::panicking::begin_panic::<rustc_errors[e5253effe2ad2635]::ExplicitBug>::{closure#0}
   9:        0x1216074c9 - std[af48a373fa65f370]::sys_common::backtrace::__rust_end_short_backtrace::<std[af48a373fa65f370]::panicking::begin_panic<rustc_errors[e5253effe2ad2635]::ExplicitBug>::{closure#0}, !>
  10:        0x121a2dae9 - std[af48a373fa65f370]::panicking::begin_panic::<rustc_errors[e5253effe2ad2635]::ExplicitBug>
  11:        0x1215f8a59 - std[af48a373fa65f370]::panic::panic_any::<rustc_errors[e5253effe2ad2635]::ExplicitBug>
  12:        0x1215ffe02 - <rustc_errors[e5253effe2ad2635]::HandlerInner>::flush_delayed::<alloc[4865febff135e1a2]::vec::Vec<rustc_errors[e5253effe2ad2635]::diagnostic::Diagnostic>, &str>
  13:        0x1215fb7a1 - <rustc_errors[e5253effe2ad2635]::HandlerInner as core[888d5284bcc5795e]::ops::drop::Drop>::drop
  14:        0x11caaea53 - core[888d5284bcc5795e]::ptr::drop_in_place::<rustc_session[c6782d7b3e3bb857]::parse::ParseSess>
  15:        0x11cab01b2 - core[888d5284bcc5795e]::ptr::drop_in_place::<rustc_session[c6782d7b3e3bb857]::session::Session>
  16:        0x11ca9dcb2 - core[888d5284bcc5795e]::ptr::drop_in_place::<rustc_interface[857b37ce07fbf291]::interface::Compiler>
  17:        0x11ca9a98c - rustc_span[fb6f3bfe63cfc4d8]::with_source_map::<core[888d5284bcc5795e]::result::Result<(), rustc_errors[e5253effe2ad2635]::ErrorGuaranteed>, rustc_interface[857b37ce07fbf291]::interface::run_compiler<core[888d5284bcc5795e]::result::Result<(), rustc_errors[e5253effe2ad2635]::ErrorGuaranteed>, rustc_driver[c92f8c32e51f19c4]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  18:        0x11caf2d5d - <scoped_tls[290510afb68802d4]::ScopedKey<rustc_span[fb6f3bfe63cfc4d8]::SessionGlobals>>::set::<rustc_interface[857b37ce07fbf291]::interface::run_compiler<core[888d5284bcc5795e]::result::Result<(), rustc_errors[e5253effe2ad2635]::ErrorGuaranteed>, rustc_driver[c92f8c32e51f19c4]::run_compiler::{closure#1}>::{closure#0}, core[888d5284bcc5795e]::result::Result<(), rustc_errors[e5253effe2ad2635]::ErrorGuaranteed>>
  19:        0x11cac224a - std[af48a373fa65f370]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[857b37ce07fbf291]::util::run_in_thread_pool_with_globals<rustc_interface[857b37ce07fbf291]::interface::run_compiler<core[888d5284bcc5795e]::result::Result<(), rustc_errors[e5253effe2ad2635]::ErrorGuaranteed>, rustc_driver[c92f8c32e51f19c4]::run_compiler::{closure#1}>::{closure#0}, core[888d5284bcc5795e]::result::Result<(), rustc_errors[e5253effe2ad2635]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[888d5284bcc5795e]::result::Result<(), rustc_errors[e5253effe2ad2635]::ErrorGuaranteed>>
  20:        0x11caa4165 - <<std[af48a373fa65f370]::thread::Builder>::spawn_unchecked_<rustc_interface[857b37ce07fbf291]::util::run_in_thread_pool_with_globals<rustc_interface[857b37ce07fbf291]::interface::run_compiler<core[888d5284bcc5795e]::result::Result<(), rustc_errors[e5253effe2ad2635]::ErrorGuaranteed>, rustc_driver[c92f8c32e51f19c4]::run_compiler::{closure#1}>::{closure#0}, core[888d5284bcc5795e]::result::Result<(), rustc_errors[e5253effe2ad2635]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[888d5284bcc5795e]::result::Result<(), rustc_errors[e5253effe2ad2635]::ErrorGuaranteed>>::{closure#1} as core[888d5284bcc5795e]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  21:        0x110221797 - std::sys::unix::thread::Thread::new::thread_start::h90404ce6cd9b7cbc
  22:     0x7ff8083354e1 - __pthread_start

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.67.0-nightly (53e4b9dd7 2022-12-04) running on x86_64-apple-darwin

query stack during panic:
end of query stack
thread panicked while panicking. aborting.
Abort trap: 6

Regression

Regression in nightly-2022-08-18, somewhere in rollup 9c20b2a. I suspect #100389 (@compiler-errors)

Version

rustc 1.67.0-nightly (53e4b9dd7 2022-12-04)
binary: rustc
commit-hash: 53e4b9dd74c29cc9308b8d0f10facac70bb101a7
commit-date: 2022-12-04
host: x86_64-apple-darwin
release: 1.67.0-nightly
LLVM version: 15.0.4
@jruderman jruderman 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 Dec 5, 2022
@TaKO8Ki
Copy link
Member

TaKO8Ki commented Dec 11, 2022

Regression in #100389

bors added a commit to rust-lang-ci/rust that referenced this issue Dec 17, 2022
Don't copy symbols from dylibs with `-Zdylib-lto`

When `rustc_driver` started being built with `-Zdylib-lto -Clto=thin`, some libstd symbols were copied by the LTO process into the dylib. That causes duplicate local symbols that are not present otherwise.

Depending on the situation (lib loading order apparently), the duplicated symbols could cause issues: `rustc_driver` overrode the panic hook, but it didn't apply to rustc main's hook (the default from libstd). This is the cause of rust-lang#105637, in some situations the panic hook installed by `rustc_driver` isn't executed, and only libstd's backtrace is shown (and a double panic). The query stack, as well as the various notes to open a GH about the ICE, don't appear.

It's not clear exactly what is needed to trigger the issue, but I have simulated a reproducer [here](https://github.com/lqd/issue-105637) with cargo involved, the incorrect panic hook is executed on my machine. It is hard to reproduce in a unit test: `cargo run` + `rustup` involves LD_LIBRARY_PATH, which is not the case for `compiletest`. cargo also adds unconditional flags that are then overridden in [`bootstrap` when building rustc with `rust.lto = thin`](https://github.com/rust-lang/rust/blob/9c07efe84f28a44f3044237696acc295aa407ee5/src/bootstrap/compile.rs#L702-L714) as done on CI).

All this to say the compilation and execution environment in `bootstrap` leading to the bug building `rustc_driver` is different from our UI tests, and I believe one of the reasons it's hard to make an exact reproducer test. Thankfully there's _still_ a difference in the behavior though: although in the unit test the correct panic hook seems to be executed compared to my repro and the current nightly, only the fix removes the double panic here.

The `7e8277aefa12f1469fb1df01418ff5846a7854a9` `try` build:
- fixes the reproducer repo linked above
- restores the ICE messages from rust-lang#105321 back to the state in its OP compared to the description in rust-lang#105637
- restores the ICE message and the query stack from rust-lang#105777 compared to nightly

While I believe this technically fixes the P-critical issue rust-lang#105637, I would not want to close it yet as we may want to backport to beta/stable (if a point release happens, it would fix the ICEs reported on 1.66.0, which is built with ThinLTO on linux). Once this PR lands, I'll also open another PR to re-enable ThinLTO on x64 darwin's dist builder.
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Dec 20, 2022
@Alexendoo
Copy link
Member

Fixed by #107585

@compiler-errors compiler-errors self-assigned this Mar 16, 2023
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. 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.
Projects
None yet
Development

No branches or pull requests

5 participants