ICE: unstable fingerprints for evaluate_obligation
mathstuf opened this issue · 6 comments
Compiling graphql-parser v0.3.0 (/home/boeckb/code/depot/lang-rust/rust-graphql-parser/src)
Compiling graphql_client_codegen v0.10.0 (/home/boeckb/code/depot/lang-rust/rust-graphql-client/src/graphql_client_codegen)
error: internal compiler error: encountered incremental compilation error with evaluate_obligation(774342b51f470b6c-5baeb40ee56ea2b3)
|
= help: This is a known issue with the compiler. Run `cargo clean -p graphql_client_codegen` or `cargo clean` to allow your project to compile
= note: Please follow the instructions below to create a bug report with the provided information
= note: See <https://github.com/rust-lang/rust/issues/84970> for more information
thread 'rustc' panicked at 'Found unstable fingerprints for evaluate_obligation(774342b51f470b6c-5baeb40ee56ea2b3): Ok(EvaluatedToOk)', /builddir/build/BUILD/rustc-1.56.1-src/compiler/rustc_query_system/src/query/plumbing.rs:644:13
note: run with `RUST_BACKTRACE=1` environment variable to display a 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.1 (Fedora 1.56.1-1.fc34) running on x86_64-unknown-linux-gnu
note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type lib
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `std::vec::Vec<graphql_parser::query::Directive<'static, std::string::String>>: std::marker::Send` | = note: this failure-note originates in the macro `__lazy_static_create`
(in Nightly builds, run with -Z macro-backtrace for more info)
#1 [check_item_well_formed] checking that `<impl at /home/boeckb/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-1.4.0/src/lib.rs:133:9: 146:10>::deref::__stability::LAZY` is well-formed
end of query stack
error: could not compile `graphql_client_codegen` due to previous error
warning: build failed, waiting for other jobs to finish...
error: build failed
I think this has to do with incremental compilation, so a minimal example is unlikely to work out well. Compiling the crate was fine. Once I went to cargo check some changes in a local checkout of graphql-parser and got that working, coming back to graphql_client_codegen ended up with an ICE until I cleaned the graphql_client_codegen crate.
I am using sccache if that matters.
We're also hitting an ICE with a similar error message using graphql_parser as a dependency.
I'm in the process of building a minimal example here: https://github.com/graphprotocol/graph-node/tree/filippo/ice-minimal-example EDIT: See here for a minimal reproducible example.
error: internal compiler error: encountered incremental compilation error with evaluate_obligation(e1a6313abfab534e-8cd4c8e5342a7496)
|
= help: This is a known issue with the compiler. Run `cargo clean -p graph` or `cargo clean` to allow your project to compile
= note: Please follow the instructions below to create a bug report with the provided information
= note: See <https://github.com/rust-lang/rust/issues/84970> for more information
thread 'rustc' panicked at 'Found unstable fingerprints for evaluate_obligation(e1a6313abfab534e-8cd4c8e5342a7496): Ok(EvaluatedToOkModuloRegions)', compiler/rustc_query_system/src/query/plumbing.rs:657:9
stack backtrace:
0: 0x10153f118 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h10cf06316d33e2a9
1: 0x10158b808 - core::fmt::write::h1faf18c959c3a8df
2: 0x101531104 - std::io::Write::write_fmt::h86ab231360bc97d2
3: 0x101542e44 - std::panicking::default_hook::{{closure}}::h36e628ffaf3cd44f
4: 0x101542abc - std::panicking::default_hook::h3ee1564a7544e58f
5: 0x1089185c4 - rustc_driver[3e35567b0507961a]::DEFAULT_HOOK::{closure#0}::{closure#0}
6: 0x101543634 - std::panicking::rust_panic_with_hook::h191339fbd2fe2360
7: 0x101543388 - std::panicking::begin_panic_handler::{{closure}}::h91c230befd9929e3
8: 0x10153f600 - std::sys_common::backtrace::__rust_end_short_backtrace::haaaeebb1d37476b3
9: 0x1015430c4 - _rust_begin_unwind
10: 0x1015b97fc - core::panicking::panic_fmt::h4fe1013b011ef602
11: 0x10c82c198 - rustc_query_system[91d58cadb6adb151]::query::plumbing::incremental_verify_ich_cold
12: 0x10b7149d8 - rustc_query_system[91d58cadb6adb151]::query::plumbing::incremental_verify_ich::<rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt, rustc_middle[48a4de8117124789]::infer::canonical::Canonical<rustc_middle[48a4de8117124789]::ty::ParamEnvAnd<rustc_middle[48a4de8117124789]::ty::Predicate>>, core[e180da0f2c78f25f]::result::Result<rustc_middle[48a4de8117124789]::traits::select::EvaluationResult, rustc_middle[48a4de8117124789]::traits::select::OverflowError>>
13: 0x10b6e890c - rustc_query_system[91d58cadb6adb151]::query::plumbing::try_load_from_disk_and_cache_in_memory::<rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt, rustc_middle[48a4de8117124789]::infer::canonical::Canonical<rustc_middle[48a4de8117124789]::ty::ParamEnvAnd<rustc_middle[48a4de8117124789]::ty::Predicate>>, core[e180da0f2c78f25f]::result::Result<rustc_middle[48a4de8117124789]::traits::select::EvaluationResult, rustc_middle[48a4de8117124789]::traits::select::OverflowError>>
14: 0x10b74cab4 - rustc_query_system[91d58cadb6adb151]::query::plumbing::get_query::<rustc_query_impl[9309ed91bf96ef41]::queries::evaluate_obligation, rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt>
15: 0x10b7b4498 - <rustc_query_impl[9309ed91bf96ef41]::Queries as rustc_middle[48a4de8117124789]::ty::query::QueryEngine>::evaluate_obligation
16: 0x10c0a8a78 - <rustc_infer[85aec4995fa1aeb4]::infer::InferCtxt as rustc_trait_selection[95de940f5ebd95bc]::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation
17: 0x10c0a8bbc - <rustc_infer[85aec4995fa1aeb4]::infer::InferCtxt as rustc_trait_selection[95de940f5ebd95bc]::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation_no_overflow
18: 0x10c11d134 - <rustc_trait_selection[95de940f5ebd95bc]::traits::fulfill::FulfillProcessor>::process_trait_obligation
19: 0x10c118fa4 - <rustc_trait_selection[95de940f5ebd95bc]::traits::fulfill::FulfillProcessor>::progress_changed_obligations
20: 0x10c135388 - <rustc_data_structures[6a7bec35f5e261c6]::obligation_forest::ObligationForest<rustc_trait_selection[95de940f5ebd95bc]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[95de940f5ebd95bc]::traits::fulfill::FulfillProcessor, rustc_data_structures[6a7bec35f5e261c6]::obligation_forest::Outcome<rustc_trait_selection[95de940f5ebd95bc]::traits::fulfill::PendingPredicateObligation, rustc_infer[85aec4995fa1aeb4]::traits::FulfillmentErrorCode>>
21: 0x10c1188ec - <rustc_trait_selection[95de940f5ebd95bc]::traits::fulfill::FulfillmentContext as rustc_infer[85aec4995fa1aeb4]::traits::engine::TraitEngine>::select_where_possible
22: 0x10b414fa4 - <rustc_infer[85aec4995fa1aeb4]::infer::InferCtxtBuilder as rustc_trait_selection[95de940f5ebd95bc]::infer::InferCtxtBuilderExt>::enter_canonical_trait_query::<rustc_middle[48a4de8117124789]::ty::ParamEnvAnd<rustc_middle[48a4de8117124789]::ty::sty::ProjectionTy>, rustc_middle[48a4de8117124789]::traits::query::NormalizationResult, rustc_traits[e69711638d0f3d8e]::normalize_projection_ty::normalize_projection_ty::{closure#0}>
23: 0x10b4498b8 - rustc_traits[e69711638d0f3d8e]::normalize_projection_ty::normalize_projection_ty
24: 0x10b98d4c0 - <rustc_middle[48a4de8117124789]::dep_graph::dep_node::DepKind as rustc_query_system[91d58cadb6adb151]::dep_graph::DepKind>::with_deps::<rustc_query_system[91d58cadb6adb151]::query::plumbing::try_load_from_disk_and_cache_in_memory<rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt, rustc_middle[48a4de8117124789]::infer::canonical::Canonical<rustc_middle[48a4de8117124789]::ty::ParamEnvAnd<rustc_middle[48a4de8117124789]::ty::sty::ProjectionTy>>, core[e180da0f2c78f25f]::result::Result<&rustc_middle[48a4de8117124789]::infer::canonical::Canonical<rustc_middle[48a4de8117124789]::infer::canonical::QueryResponse<rustc_middle[48a4de8117124789]::traits::query::NormalizationResult>>, rustc_middle[48a4de8117124789]::traits::query::NoSolution>>::{closure#1}, core[e180da0f2c78f25f]::result::Result<&rustc_middle[48a4de8117124789]::infer::canonical::Canonical<rustc_middle[48a4de8117124789]::infer::canonical::QueryResponse<rustc_middle[48a4de8117124789]::traits::query::NormalizationResult>>, rustc_middle[48a4de8117124789]::traits::query::NoSolution>>
25: 0x10b6e8d30 - rustc_query_system[91d58cadb6adb151]::query::plumbing::try_load_from_disk_and_cache_in_memory::<rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt, rustc_middle[48a4de8117124789]::infer::canonical::Canonical<rustc_middle[48a4de8117124789]::ty::ParamEnvAnd<rustc_middle[48a4de8117124789]::ty::sty::ProjectionTy>>, core[e180da0f2c78f25f]::result::Result<&rustc_middle[48a4de8117124789]::infer::canonical::Canonical<rustc_middle[48a4de8117124789]::infer::canonical::QueryResponse<rustc_middle[48a4de8117124789]::traits::query::NormalizationResult>>, rustc_middle[48a4de8117124789]::traits::query::NoSolution>>
26: 0x10b760368 - rustc_query_system[91d58cadb6adb151]::query::plumbing::get_query::<rustc_query_impl[9309ed91bf96ef41]::queries::normalize_projection_ty, rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt>
27: 0x10b7b4324 - <rustc_query_impl[9309ed91bf96ef41]::Queries as rustc_middle[48a4de8117124789]::ty::query::QueryEngine>::normalize_projection_ty
28: 0x10c15406c - <rustc_trait_selection[95de940f5ebd95bc]::traits::query::normalize::QueryNormalizer as rustc_middle[48a4de8117124789]::ty::fold::FallibleTypeFolder>::try_fold_ty
29: 0x10c16985c - rustc_middle[48a4de8117124789]::ty::util::fold_list::<rustc_trait_selection[95de940f5ebd95bc]::traits::query::normalize::QueryNormalizer, rustc_middle[48a4de8117124789]::ty::subst::GenericArg, <&rustc_middle[48a4de8117124789]::ty::list::List<rustc_middle[48a4de8117124789]::ty::subst::GenericArg> as rustc_middle[48a4de8117124789]::ty::fold::TypeFoldable>::try_super_fold_with<rustc_trait_selection[95de940f5ebd95bc]::traits::query::normalize::QueryNormalizer>::{closure#0}>
30: 0x10c17dcc8 - <rustc_middle[48a4de8117124789]::ty::Ty as rustc_middle[48a4de8117124789]::ty::fold::TypeFoldable>::try_super_fold_with::<rustc_trait_selection[95de940f5ebd95bc]::traits::query::normalize::QueryNormalizer>
31: 0x10c153d8c - <rustc_trait_selection[95de940f5ebd95bc]::traits::query::normalize::QueryNormalizer as rustc_middle[48a4de8117124789]::ty::fold::FallibleTypeFolder>::try_fold_ty
32: 0x10b4c7788 - <rustc_infer[85aec4995fa1aeb4]::infer::at::At as rustc_trait_selection[95de940f5ebd95bc]::traits::query::normalize::AtExt>::normalize::<rustc_middle[48a4de8117124789]::ty::subst::GenericArg>
33: 0x10b4192f4 - <rustc_infer[85aec4995fa1aeb4]::infer::InferCtxtBuilder>::enter::<core[e180da0f2c78f25f]::result::Result<rustc_middle[48a4de8117124789]::ty::subst::GenericArg, rustc_middle[48a4de8117124789]::traits::query::NoSolution>, rustc_traits[e69711638d0f3d8e]::normalize_erasing_regions::try_normalize_after_erasing_regions<rustc_middle[48a4de8117124789]::ty::subst::GenericArg>::{closure#0}>
34: 0x10b49af54 - <rustc_traits[e69711638d0f3d8e]::normalize_erasing_regions::provide::{closure#0} as core[e180da0f2c78f25f]::ops::function::FnOnce<(rustc_middle[48a4de8117124789]::ty::context::TyCtxt, rustc_middle[48a4de8117124789]::ty::ParamEnvAnd<rustc_middle[48a4de8117124789]::ty::subst::GenericArg>)>>::call_once
35: 0x10b6e39dc - rustc_query_system[91d58cadb6adb151]::query::plumbing::try_load_from_disk_and_cache_in_memory::<rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt, rustc_middle[48a4de8117124789]::ty::ParamEnvAnd<rustc_middle[48a4de8117124789]::ty::subst::GenericArg>, core[e180da0f2c78f25f]::result::Result<rustc_middle[48a4de8117124789]::ty::subst::GenericArg, rustc_middle[48a4de8117124789]::traits::query::NoSolution>>
36: 0x10b77795c - rustc_query_system[91d58cadb6adb151]::query::plumbing::get_query::<rustc_query_impl[9309ed91bf96ef41]::queries::try_normalize_generic_arg_after_erasing_regions, rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt>
37: 0x10c43b3b4 - <rustc_middle[48a4de8117124789]::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder>::normalize_generic_arg_after_erasing_regions
38: 0x10c439bdc - <rustc_middle[48a4de8117124789]::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder as rustc_middle[48a4de8117124789]::ty::fold::TypeFolder>::fold_ty
39: 0x10aaaddcc - <rustc_monomorphize[3785a0196d98cf40]::collector::MirNeighborCollector as rustc_middle[48a4de8117124789]::mir::visit::Visitor>::visit_terminator
40: 0x10aab054c - rustc_monomorphize[3785a0196d98cf40]::collector::collect_neighbours
41: 0x10aaab480 - rustc_monomorphize[3785a0196d98cf40]::collector::collect_items_rec
42: 0x10aaab634 - rustc_monomorphize[3785a0196d98cf40]::collector::collect_items_rec
43: 0x10aaab634 - rustc_monomorphize[3785a0196d98cf40]::collector::collect_items_rec
44: 0x10aaab634 - rustc_monomorphize[3785a0196d98cf40]::collector::collect_items_rec
45: 0x10aaab634 - rustc_monomorphize[3785a0196d98cf40]::collector::collect_items_rec
46: 0x10aaab634 - rustc_monomorphize[3785a0196d98cf40]::collector::collect_items_rec
47: 0x10aad087c - <rustc_session[d383daeae0c11292]::session::Session>::time::<(), rustc_monomorphize[3785a0196d98cf40]::collector::collect_crate_mono_items::{closure#1}>
48: 0x10aaaa200 - rustc_monomorphize[3785a0196d98cf40]::collector::collect_crate_mono_items
49: 0x10aab8760 - rustc_monomorphize[3785a0196d98cf40]::partitioning::collect_and_partition_mono_items
50: 0x10b8e89f0 - <rustc_query_system[91d58cadb6adb151]::dep_graph::graph::DepGraph<rustc_middle[48a4de8117124789]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[48a4de8117124789]::ty::context::TyCtxt, (), (&std[8541ff70ccfedbb0]::collections::hash::set::HashSet<rustc_span[dd8cd730fd24a84e]::def_id::DefId, core[e180da0f2c78f25f]::hash::BuildHasherDefault<rustc_hash[bebdc68dc01c084f]::FxHasher>>, &[rustc_middle[48a4de8117124789]::mir::mono::CodegenUnit])>
51: 0x10ba0ccb0 - rustc_data_structures[6a7bec35f5e261c6]::stack::ensure_sufficient_stack::<((&std[8541ff70ccfedbb0]::collections::hash::set::HashSet<rustc_span[dd8cd730fd24a84e]::def_id::DefId, core[e180da0f2c78f25f]::hash::BuildHasherDefault<rustc_hash[bebdc68dc01c084f]::FxHasher>>, &[rustc_middle[48a4de8117124789]::mir::mono::CodegenUnit]), rustc_query_system[91d58cadb6adb151]::dep_graph::graph::DepNodeIndex), rustc_query_system[91d58cadb6adb151]::query::plumbing::execute_job<rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt, (), (&std[8541ff70ccfedbb0]::collections::hash::set::HashSet<rustc_span[dd8cd730fd24a84e]::def_id::DefId, core[e180da0f2c78f25f]::hash::BuildHasherDefault<rustc_hash[bebdc68dc01c084f]::FxHasher>>, &[rustc_middle[48a4de8117124789]::mir::mono::CodegenUnit])>::{closure#3}>
52: 0x10b6e1a60 - rustc_query_system[91d58cadb6adb151]::query::plumbing::try_execute_query::<rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt, rustc_query_system[91d58cadb6adb151]::query::caches::DefaultCache<(), (&std[8541ff70ccfedbb0]::collections::hash::set::HashSet<rustc_span[dd8cd730fd24a84e]::def_id::DefId, core[e180da0f2c78f25f]::hash::BuildHasherDefault<rustc_hash[bebdc68dc01c084f]::FxHasher>>, &[rustc_middle[48a4de8117124789]::mir::mono::CodegenUnit])>>
53: 0x10b798f00 - rustc_query_system[91d58cadb6adb151]::query::plumbing::force_query::<rustc_query_impl[9309ed91bf96ef41]::queries::collect_and_partition_mono_items, rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt>
54: 0x10b806568 - rustc_query_impl[9309ed91bf96ef41]::query_callbacks::collect_and_partition_mono_items::force_from_dep_node
55: 0x10c312538 - <rustc_middle[48a4de8117124789]::ty::context::TyCtxt as rustc_query_system[91d58cadb6adb151]::dep_graph::DepContext>::try_force_from_dep_node
56: 0x10b918174 - <rustc_query_system[91d58cadb6adb151]::dep_graph::graph::DepGraph<rustc_middle[48a4de8117124789]::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt>
57: 0x10b7017ec - rustc_query_system[91d58cadb6adb151]::query::plumbing::try_load_from_disk_and_cache_in_memory::<rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt, rustc_span[dd8cd730fd24a84e]::def_id::CrateNum, &[(rustc_middle[48a4de8117124789]::middle::exported_symbols::ExportedSymbol, rustc_middle[48a4de8117124789]::middle::exported_symbols::SymbolExportLevel)]>
58: 0x10b6d6050 - rustc_query_system[91d58cadb6adb151]::query::plumbing::try_execute_query::<rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt, rustc_query_system[91d58cadb6adb151]::query::caches::DefaultCache<rustc_span[dd8cd730fd24a84e]::def_id::CrateNum, &[(rustc_middle[48a4de8117124789]::middle::exported_symbols::ExportedSymbol, rustc_middle[48a4de8117124789]::middle::exported_symbols::SymbolExportLevel)]>>
59: 0x10b74450c - rustc_query_system[91d58cadb6adb151]::query::plumbing::get_query::<rustc_query_impl[9309ed91bf96ef41]::queries::exported_symbols, rustc_query_impl[9309ed91bf96ef41]::plumbing::QueryCtxt>
60: 0x10bc2d1f0 - <rustc_metadata[b2f5c284d8a90058]::rmeta::encoder::EncodeContext>::encode_crate_root
61: 0x10bc3f878 - rustc_metadata[b2f5c284d8a90058]::rmeta::encoder::encode_metadata_impl
62: 0x10bc766d8 - rustc_data_structures[6a7bec35f5e261c6]::sync::join::<rustc_metadata[b2f5c284d8a90058]::rmeta::encoder::encode_metadata::{closure#0}, rustc_metadata[b2f5c284d8a90058]::rmeta::encoder::encode_metadata::{closure#1}, rustc_metadata[b2f5c284d8a90058]::rmeta::encoder::EncodedMetadata, ()>
63: 0x10bc3f284 - rustc_metadata[b2f5c284d8a90058]::rmeta::encoder::encode_metadata
64: 0x1089fcdf4 - <rustc_interface[2280aded15839b11]::passes::QueryContext>::enter::<<rustc_interface[2280aded15839b11]::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core[e180da0f2c78f25f]::result::Result<alloc[a4749b0ad82606d]::boxed::Box<dyn core[e180da0f2c78f25f]::any::Any>, rustc_errors[677d6d214e1093d1]::ErrorReported>>
65: 0x1089e3ce0 - <rustc_interface[2280aded15839b11]::queries::Queries>::ongoing_codegen
66: 0x1088bf494 - rustc_interface[2280aded15839b11]::interface::create_compiler_and_run::<core[e180da0f2c78f25f]::result::Result<(), rustc_errors[677d6d214e1093d1]::ErrorReported>, rustc_driver[3e35567b0507961a]::run_compiler::{closure#1}>
67: 0x1088a6cb0 - std[8541ff70ccfedbb0]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[2280aded15839b11]::util::run_in_thread_pool_with_globals<rustc_interface[2280aded15839b11]::interface::run_compiler<core[e180da0f2c78f25f]::result::Result<(), rustc_errors[677d6d214e1093d1]::ErrorReported>, rustc_driver[3e35567b0507961a]::run_compiler::{closure#1}>::{closure#0}, core[e180da0f2c78f25f]::result::Result<(), rustc_errors[677d6d214e1093d1]::ErrorReported>>::{closure#0}, core[e180da0f2c78f25f]::result::Result<(), rustc_errors[677d6d214e1093d1]::ErrorReported>>
68: 0x108920648 - <<std[8541ff70ccfedbb0]::thread::Builder>::spawn_unchecked_<rustc_interface[2280aded15839b11]::util::run_in_thread_pool_with_globals<rustc_interface[2280aded15839b11]::interface::run_compiler<core[e180da0f2c78f25f]::result::Result<(), rustc_errors[677d6d214e1093d1]::ErrorReported>, rustc_driver[3e35567b0507961a]::run_compiler::{closure#1}>::{closure#0}, core[e180da0f2c78f25f]::result::Result<(), rustc_errors[677d6d214e1093d1]::ErrorReported>>::{closure#0}, core[e180da0f2c78f25f]::result::Result<(), rustc_errors[677d6d214e1093d1]::ErrorReported>>::{closure#1} as core[e180da0f2c78f25f]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
69: 0x10154eb70 - std::sys::unix::thread::Thread::new::thread_start::h8ccdabc567c5eee0
70: 0x1b50da26c - __pthread_deallocate
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.60.0 (7737e0b5c 2022-04-04) running on aarch64-apple-darwin
note: compiler flags: --crate-type lib -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `core::result::Result<Value, q::ValueInner<'static, alloc::string::String>>: core::ops::try_trait::Try`
#1 [normalize_projection_ty] normalizing `Canonical { max_universe: U0, variables: [], value: ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: All, constness: NotConst }, value: ProjectionTy { substs: [core::iter::adapters::GenericShunt<core::iter::adapters::map::Map<alloc::vec::into_iter::IntoIter<q::ValueInner<alloc::string::String>>, fn(q::ValueInner<alloc::string::String>) -> core::result::Result<Value, <Value as core::convert::TryFrom<q::ValueInner<alloc::string::String>>>::Error> {<Value as core::convert::TryFrom<q::ValueInner<alloc::string::String>>>::try_from}>, core::result::Result<core::convert::Infallible, q::ValueInner<alloc::string::String>>>], item_def_id: DefId(2:7915 ~ core[e180]::iter::traits::iterator::Iterator::Item) } } }`
#2 [try_normalize_generic_arg_after_erasing_regions] normalizing `fn(core::iter::adapters::GenericShunt<core::iter::adapters::map::Map<alloc::vec::into_iter::IntoIter<q::ValueInner<alloc::string::String>>, fn(q::ValueInner<alloc::string::String>) -> core::result::Result<Value, <Value as core::convert::TryFrom<q::ValueInner<alloc::string::String>>>::Error> {<Value as core::convert::TryFrom<q::ValueInner<alloc::string::String>>>::try_from}>, core::result::Result<core::convert::Infallible, q::ValueInner<alloc::string::String>>>) -> alloc::vec::Vec<Value> {<alloc::vec::Vec<Value> as core::iter::traits::collect::FromIterator<<core::iter::adapters::GenericShunt<core::iter::adapters::map::Map<alloc::vec::into_iter::IntoIter<q::ValueInner<alloc::string::String>>, fn(q::ValueInner<alloc::string::String>) -> core::result::Result<Value, <Value as core::convert::TryFrom<q::ValueInner<alloc::string::String>>>::Error> {<Value as core::convert::TryFrom<q::ValueInner<alloc::string::String>>>::try_from}>, core::result::Result<core::convert::Infallible, q::ValueInner<alloc::string::String>>> as core::iter::traits::iterator::Iterator>::Item>>::from_iter::<core::iter::adapters::GenericShunt<core::iter::adapters::map::Map<alloc::vec::into_iter::IntoIter<q::ValueInner<alloc::string::String>>, fn(q::ValueInner<alloc::string::String>) -> core::result::Result<Value, <Value as core::convert::TryFrom<q::ValueInner<alloc::string::String>>>::Error> {<Value as core::convert::TryFrom<q::ValueInner<alloc::string::String>>>::try_from}>, core::result::Result<core::convert::Infallible, q::ValueInner<alloc::string::String>>>>}`
#3 [collect_and_partition_mono_items] collect_and_partition_mono_items
#4 [exported_symbols] exported_symbols
end of query stack
It's an evaluate_obligation(EvaluatedToOkModuloRegions) condition. Reproducible on 1.60.0. I narrowed it down to this (depends on anyhow 1.0.0):
use std::convert::TryFrom;
use std::error::Error;
use std::fmt::{self, Display};
#[derive(Default)]
pub struct App;
impl App {
pub fn run(&mut self) -> Result<(), anyhow::Error> {
Result::<(), Err>::Ok(())?;
Ok(())
}
}
#[derive(Debug)]
pub enum Err {
Err(q::Value),
}
impl Display for Err {
fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result {
Ok(())
}
}
impl Error for Err {}
impl From<anyhow::Error> for Err {
fn from(_: anyhow::Error) -> Self {
todo!()
}
}
#[derive(Debug, Clone, PartialEq)]
pub enum Value {
List(Vec<Value>),
}
impl TryFrom<q::Value> for Value {
type Error = q::Value;
fn try_from(value: q::Value) -> Result<Self, Self::Error> {
match value {
q::Value::List(vals) => vals
.into_iter()
.map(Value::try_from)
.collect::<Result<Vec<_>, _>>()
.map(Value::List),
_ => todo!(),
}
}
}
pub mod q {
use std::collections::BTreeMap;
pub type Value = ValueInner<'static, String>;
pub trait AsValue<'a> {
type Value;
}
impl<'a> AsValue<'a> for String {
type Value = String;
}
#[derive(Debug)]
pub enum ValueInner<'a, T: AsValue<'a>> {
Variable(T::Value),
List(Vec<ValueInner<'a, T>>),
Object(BTreeMap<T::Value, ValueInner<'a, T>>),
}
}Thanks @neysofu for reporting this and generating a repro!!
I was able to trim a few pieces off your latest version:
use std::convert::TryFrom;
use std::error::Error;
use std::fmt::{self, Display};
pub fn run() -> Result<(), anyhow::Error> {
Result::<(), Err>::Ok(())?;
Ok(())
}
#[derive(Debug)]
enum Err {
Err(q::Value),
}
impl Display for Err {
fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result {
Ok(())
}
}
impl Error for Err {}
impl From<anyhow::Error> for Err {
fn from(_: anyhow::Error) -> Self {
todo!()
}
}
enum Value {
List(Vec<Value>),
}
impl TryFrom<q::Value> for Value {
type Error = q::Value;
fn try_from(value: q::Value) -> Result<Self, Self::Error> {
match value {
q::Value::List(vals) => vals
.into_iter()
.map(Value::try_from)
.collect::<Result<Vec<_>, _>>()
.map(Value::List),
_ => todo!(),
}
}
}
pub mod q {
use std::collections::BTreeMap;
pub type Value = ValueInner<'static, String>;
pub trait AsValue<'a> {
type Value;
}
impl<'a> AsValue<'a> for String {
type Value = String;
}
#[derive(Debug)]
pub enum ValueInner<'a, T: AsValue<'a>> {
Variable(T::Value),
List(Vec<ValueInner<'a, T>>),
Object(BTreeMap<T::Value, ValueInner<'a, T>>),
}
}So the issue here is with the projection cache and the fact that it doesn't store outlives predicates in the nested obligations of a projection cache entry.
The issue starts when we try to evaluate core::result::Result<Value, q::ValueInner<'static, alloc::string::String>>: core::ops::try_trait::Try, which requires us to prove ValueInner<'static, String>: Sized. Proving the sized predicate requires us to prove that the last field in all of the enum variants are Sized as well. In the ValueInner::Variable variant, that specifically is <String as AsValue<'static>>::Value.
In order to normalize this projection type, we need to satisfy String: AsValue<'static>. The current logic to do this is by looking at all the impls, giving all the generic types fresh inference variables, and unifying. So we try to unify <String as AsValue<'static>> with the impl <String as AsValue<'_1>>, which causes us to do two things. (1.) Unify the region inference variable with 'static, and (2.) register a region Constraint that looks like like '_1: 'static.
Due to this region constraint being registered during the normalization of <String as AsValue<'static>>::Value, we end up caching the predicate ValueInner<'static, String>: Sized as EvaluatedToOkModuloRegions, due to this logic. This, in turn, makes all of the predicates that depend on this one to also be ok-mod-regions.
However, later on (and I'm not exactly sure of why? intercrate mode, perhaps?), we evaluate ValueInner<'static, String>: Sized again -- this time, though, we have the projection value <String as AsValue<'static>>::Value = String cached, and we replace it with String without registering any new region obligations.
This means that we evaluate ValueInner<'static, String>: Sized as EvaluatedToOk instead of EvaluatedToOkModuloRegions, meaning that core::result::Result<Value, q::ValueInner<'static, alloc::string::String>>: core::ops::try_trait::Try is also EvaluatedToOk. ... and this ends up being what we return in the top-level tcx query evaluate_obligation the first time we run this program.
However, when we do something like touch src.rs and then re-run with incremental cache, we only end up evaluating the same predicate core::result::Result<Value, q::ValueInner<'static, alloc::string::String>>: core::ops::try_trait::Try to EvaluatedToOkModuloRegions, leading to an ICE because EvaluatedToOk and EvaluatedToOkModuloRegions don't hash to the same value 😅
There are several issues here, I think.
Firstly, I think the ProjectionCacheKey is wrong -- why isn't it caching the ParamEnv that it's evaluated under? The selection cache does here, for example. However, this doesn't actually fix the issue, unfortunately.
Secondly, and I think this is the issue (but it's harder to test) -- I think the semantics of when we cache projection types is inconsistent with the selection caches. We should not be caching projection types when we're in intercrate mode, for example. I actually think this might be the reason why this repro requires two crates, and why the above suggestion doesn't fix the issue... actually, there is some logic that considers intercrate mode. Unclear what's going on here, then.
but idk, I'm not super familiar with the projection cache, so take my words with a large grain of salt.
I was wondering if @compiler-errors has any tips on how to tackle this and hopefully I can take a stab at it. My team would love to get this fixed.