Skip to content

regression when compiling substrate node with -Cinstrument-coverage #117211

Closed
@StackOverflowExcept1on

Description

@StackOverflowExcept1on

We just updated from nightly-2023-04-25 to nightly-2023-10-14 and we are getting

error[E0275]: overflow evaluating the requirement `<Runtime as pallet_grandpa::Config>::KeyOwnerProof == _`

According to backtrace, it seems the error appeared in #115801

Suspect line:

if !tcx.sess.opts.actually_rustdoc {
for error in &errors {
if let FulfillmentErrorCode::CodeCycle(cycle) = &error.code {
ocx.infcx.err_ctxt().report_overflow_obligation_cycle(cycle);
}
}
}
return Err(NoSolution);

I tried this code:

$ git clone https://github.com/gear-tech/gear.git
$ cd gear
$ git checkout 70f599c530f6a0bfd0a1627d2c45d7a8d77bc3ad

# compiles fine
$ cargo build --release --package vara-runtime --features std,dev

$ cat rust-toolchain.toml | grep channel
channel = "nightly-2023-10-14"

# does not compile with `-C instrument-coverage`
# also added `-Z treat-err-as-bug` to show backtrace
$ RUSTFLAGS="-Ztreat-err-as-bug -Cinstrument-coverage" cargo build --release --package vara-runtime --features std,dev

I expected to see this happen: code compiles with and without the -Cinstrument-coverage option.

Instead, this happened: error E0275 with -Cinstrument-coverage

Meta

rustc --version --verbose:

rustc 1.75.0-nightly (fcab24817 2023-10-13)
binary: rustc
commit-hash: fcab24817c72ffbd6ffb66d92b7ddc0d3ee4d2f0
commit-date: 2023-10-13
host: x86_64-unknown-linux-gnu
release: 1.75.0-nightly
LLVM version: 17.0.2
Backtrace

   Compiling vara-runtime v1.0.2 (/home/.../gear/runtime/vara)
error[E0275]: overflow evaluating the requirement `<Runtime as pallet_grandpa::Config>::KeyOwnerProof == _`

thread 'rustc' panicked at compiler/rustc_errors/src/lib.rs:1735:25:
aborting after 1 errors and 1 delayed bugs due to `-Z treat-err-as-bug=1`
stack backtrace:
   0:     0x7f0e9b3628fc - std::backtrace_rs::backtrace::libunwind::trace::h895decac6837a495
                               at /rustc/fcab24817c72ffbd6ffb66d92b7ddc0d3ee4d2f0/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f0e9b3628fc - std::backtrace_rs::backtrace::trace_unsynchronized::hcbdb001903b8da06
                               at /rustc/fcab24817c72ffbd6ffb66d92b7ddc0d3ee4d2f0/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f0e9b3628fc - std::sys_common::backtrace::_print_fmt::hbb4acc0429a0e855
                               at /rustc/fcab24817c72ffbd6ffb66d92b7ddc0d3ee4d2f0/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f0e9b3628fc - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hb131321ae2a401dd
                               at /rustc/fcab24817c72ffbd6ffb66d92b7ddc0d3ee4d2f0/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f0e9b3ca350 - core::fmt::rt::Argument::fmt::hd9aeb95c38745bc3
                               at /rustc/fcab24817c72ffbd6ffb66d92b7ddc0d3ee4d2f0/library/core/src/fmt/rt.rs:142:9
   5:     0x7f0e9b3ca350 - core::fmt::write::hc405bb79f2ac8cb8
                               at /rustc/fcab24817c72ffbd6ffb66d92b7ddc0d3ee4d2f0/library/core/src/fmt/mod.rs:1117:17
   6:     0x7f0e9b355bbf - std::io::Write::write_fmt::ha55bc380d2605627
                               at /rustc/fcab24817c72ffbd6ffb66d92b7ddc0d3ee4d2f0/library/std/src/io/mod.rs:1762:15
   7:     0x7f0e9b3626e4 - std::sys_common::backtrace::_print::he5b4ffb2f8b9aae2
                               at /rustc/fcab24817c72ffbd6ffb66d92b7ddc0d3ee4d2f0/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f0e9b3626e4 - std::sys_common::backtrace::print::h7dfa57d65fbc411a
                               at /rustc/fcab24817c72ffbd6ffb66d92b7ddc0d3ee4d2f0/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f0e9b3654f7 - std::panicking::default_hook::{{closure}}::h359697fee07a3691
  10:     0x7f0e9b36523a - std::panicking::default_hook::hbf7afbae604c2e97
                               at /rustc/fcab24817c72ffbd6ffb66d92b7ddc0d3ee4d2f0/library/std/src/panicking.rs:292:9
  11:     0x7f0e9df1a77a - std[c1824ed7e719b848]::panicking::update_hook::<alloc[3d6e957ba1ac4d74]::boxed::Box<rustc_driver_impl[d47efb37cd2f86c4]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f0e9b365c98 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h24810556076dec88
                               at /rustc/fcab24817c72ffbd6ffb66d92b7ddc0d3ee4d2f0/library/alloc/src/boxed.rs:2021:9
  13:     0x7f0e9b365c98 - std::panicking::rust_panic_with_hook::hd5cf40cf90f0da4f
                               at /rustc/fcab24817c72ffbd6ffb66d92b7ddc0d3ee4d2f0/library/std/src/panicking.rs:735:13
  14:     0x7f0e9b3659f1 - std::panicking::begin_panic_handler::{{closure}}::h7a7594a015de3c11
                               at /rustc/fcab24817c72ffbd6ffb66d92b7ddc0d3ee4d2f0/library/std/src/panicking.rs:609:13
  15:     0x7f0e9b362e16 - std::sys_common::backtrace::__rust_end_short_backtrace::h7bca82ae1dc2e605
                               at /rustc/fcab24817c72ffbd6ffb66d92b7ddc0d3ee4d2f0/library/std/src/sys_common/backtrace.rs:170:18
  16:     0x7f0e9b365722 - rust_begin_unwind
                               at /rustc/fcab24817c72ffbd6ffb66d92b7ddc0d3ee4d2f0/library/std/src/panicking.rs:597:5
  17:     0x7f0e9b3c6975 - core::panicking::panic_fmt::h50936ad2e0c759a9
                               at /rustc/fcab24817c72ffbd6ffb66d92b7ddc0d3ee4d2f0/library/core/src/panicking.rs:72:14
  18:     0x7f0e9d686ab3 - <rustc_errors[6edaa4bbd7b958d6]::HandlerInner>::panic_if_treat_err_as_bug
  19:     0x7f0e9d675c09 - <rustc_errors[6edaa4bbd7b958d6]::HandlerInner>::emit_diagnostic::{closure#2}
  20:     0x7f0e9d84790d - rustc_interface[15f2bcae4bc06d86]::callbacks::track_diagnostic
  21:     0x7f0e9ce9ddcc - <rustc_errors[6edaa4bbd7b958d6]::HandlerInner>::emit_diagnostic
  22:     0x7f0e9c4ef58b - <rustc_errors[6edaa4bbd7b958d6]::Handler>::emit_diagnostic
  23:     0x7f0e9cdfe2ca - <rustc_span[e04a3047034dd436]::ErrorGuaranteed as rustc_errors[6edaa4bbd7b958d6]::diagnostic_builder::EmissionGuarantee>::diagnostic_builder_emit_producing_guarantee
  24:     0x7f0e9e8c23c6 - <rustc_infer[cf3c7e8bcfc0395e]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[63173dee05984cb4]::traits::error_reporting::type_err_ctxt_ext::TypeErrCtxtExt>::report_overflow_error::<rustc_middle[5ec3528ea702113d]::ty::Predicate, <rustc_infer[cf3c7e8bcfc0395e]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[63173dee05984cb4]::traits::error_reporting::type_err_ctxt_ext::TypeErrCtxtExt>::report_overflow_obligation<rustc_middle[5ec3528ea702113d]::ty::Predicate>::{closure#0}>
  25:     0x7f0e9e8c3011 - <rustc_infer[cf3c7e8bcfc0395e]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[63173dee05984cb4]::traits::error_reporting::type_err_ctxt_ext::TypeErrCtxtExt>::report_overflow_obligation::<rustc_middle[5ec3528ea702113d]::ty::Predicate>
  26:     0x7f0e9e8c33c0 - <rustc_infer[cf3c7e8bcfc0395e]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[63173dee05984cb4]::traits::error_reporting::type_err_ctxt_ext::TypeErrCtxtExt>::report_overflow_obligation_cycle
  27:     0x7f0e9d1d18f4 - rustc_traits[a5facceb6599def0]::normalize_projection_ty::normalize_projection_ty
  28:     0x7f0e9d1d0c35 - rustc_query_impl[cbfd76682f824088]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[cbfd76682f824088]::query_impl::normalize_projection_ty::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5ec3528ea702113d]::query::erase::Erased<[u8; 8usize]>>
  29:     0x7f0e9d1d0911 - rustc_query_system[45ab6d026cac8713]::query::plumbing::try_execute_query::<rustc_query_impl[cbfd76682f824088]::DynamicConfig<rustc_query_system[45ab6d026cac8713]::query::caches::DefaultCache<rustc_middle[5ec3528ea702113d]::infer::canonical::Canonical<rustc_middle[5ec3528ea702113d]::ty::ParamEnvAnd<rustc_middle[5ec3528ea702113d]::ty::sty::AliasTy>>, rustc_middle[5ec3528ea702113d]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[cbfd76682f824088]::plumbing::QueryCtxt, false>
  30:     0x7f0e9d1d052d - rustc_query_impl[cbfd76682f824088]::query_impl::normalize_projection_ty::get_query_non_incr::__rust_end_short_backtrace
  31:     0x7f0e9ceabe5c - <rustc_trait_selection[63173dee05984cb4]::traits::query::normalize::QueryNormalizer as rustc_type_ir[9d57cf4994bcb6ab]::fold::FallibleTypeFolder<rustc_middle[5ec3528ea702113d]::ty::context::TyCtxt>>::try_fold_ty
  32:     0x7f0e9ceae18e - <&rustc_middle[5ec3528ea702113d]::ty::list::List<rustc_middle[5ec3528ea702113d]::ty::Ty> as rustc_type_ir[9d57cf4994bcb6ab]::fold::TypeFoldable<rustc_middle[5ec3528ea702113d]::ty::context::TyCtxt>>::try_fold_with::<rustc_trait_selection[63173dee05984cb4]::traits::query::normalize::QueryNormalizer>
  33:     0x7f0e9ceac4ae - <rustc_trait_selection[63173dee05984cb4]::traits::query::normalize::QueryNormalizer as rustc_type_ir[9d57cf4994bcb6ab]::fold::FallibleTypeFolder<rustc_middle[5ec3528ea702113d]::ty::context::TyCtxt>>::try_fold_ty
  34:     0x7f0e9cc3b712 - <rustc_traits[a5facceb6599def0]::normalize_erasing_regions::provide::{closure#0} as core[58e1e45e82356d94]::ops::function::FnOnce<(rustc_middle[5ec3528ea702113d]::ty::context::TyCtxt, rustc_middle[5ec3528ea702113d]::ty::ParamEnvAnd<rustc_middle[5ec3528ea702113d]::ty::generic_args::GenericArg>)>>::call_once
  35:     0x7f0e9cc3b329 - rustc_query_impl[cbfd76682f824088]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[cbfd76682f824088]::query_impl::try_normalize_generic_arg_after_erasing_regions::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5ec3528ea702113d]::query::erase::Erased<[u8; 8usize]>>
  36:     0x7f0e9cc3ad34 - rustc_query_system[45ab6d026cac8713]::query::plumbing::try_execute_query::<rustc_query_impl[cbfd76682f824088]::DynamicConfig<rustc_query_system[45ab6d026cac8713]::query::caches::DefaultCache<rustc_middle[5ec3528ea702113d]::ty::ParamEnvAnd<rustc_middle[5ec3528ea702113d]::ty::generic_args::GenericArg>, rustc_middle[5ec3528ea702113d]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[cbfd76682f824088]::plumbing::QueryCtxt, false>
  37:     0x7f0e9cc3aa42 - rustc_query_impl[cbfd76682f824088]::query_impl::try_normalize_generic_arg_after_erasing_regions::get_query_non_incr::__rust_end_short_backtrace
  38:     0x7f0e9caf03fb - <rustc_middle[5ec3528ea702113d]::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder as rustc_type_ir[9d57cf4994bcb6ab]::fold::TypeFolder<rustc_middle[5ec3528ea702113d]::ty::context::TyCtxt>>::fold_ty
  39:     0x7f0e9de1e408 - <rustc_middle[5ec3528ea702113d]::ty::generic_args::GenericArg as rustc_type_ir[9d57cf4994bcb6ab]::fold::TypeFoldable<rustc_middle[5ec3528ea702113d]::ty::context::TyCtxt>>::try_fold_with::<rustc_middle[5ec3528ea702113d]::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder>
  40:     0x7f0e9e736147 - <&rustc_middle[5ec3528ea702113d]::ty::list::List<rustc_middle[5ec3528ea702113d]::ty::generic_args::GenericArg> as rustc_type_ir[9d57cf4994bcb6ab]::fold::TypeFoldable<rustc_middle[5ec3528ea702113d]::ty::context::TyCtxt>>::try_fold_with::<rustc_middle[5ec3528ea702113d]::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder>
  41:     0x7f0e9e7468e4 - <&mut rustc_symbol_mangling[b1df143bd0171b84]::v0::SymbolMangler as rustc_middle[5ec3528ea702113d]::ty::print::Printer>::print_impl_path
  42:     0x7f0e9e745de0 - <&mut rustc_symbol_mangling[b1df143bd0171b84]::v0::SymbolMangler as rustc_middle[5ec3528ea702113d]::ty::print::Printer>::print_def_path
  43:     0x7f0e9e746135 - <&mut rustc_symbol_mangling[b1df143bd0171b84]::v0::SymbolMangler as rustc_middle[5ec3528ea702113d]::ty::print::Printer>::print_def_path
  44:     0x7f0e9e744ecf - rustc_symbol_mangling[b1df143bd0171b84]::v0::mangle
  45:     0x7f0e9cbbbefc - rustc_symbol_mangling[b1df143bd0171b84]::symbol_name_provider
  46:     0x7f0e9c5f85ba - rustc_query_impl[cbfd76682f824088]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[cbfd76682f824088]::query_impl::symbol_name::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5ec3528ea702113d]::query::erase::Erased<[u8; 16usize]>>
  47:     0x7f0e9c5f819a - rustc_query_system[45ab6d026cac8713]::query::plumbing::try_execute_query::<rustc_query_impl[cbfd76682f824088]::DynamicConfig<rustc_query_system[45ab6d026cac8713]::query::caches::DefaultCache<rustc_middle[5ec3528ea702113d]::ty::instance::Instance, rustc_middle[5ec3528ea702113d]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[cbfd76682f824088]::plumbing::QueryCtxt, false>
  48:     0x7f0e9c5f7e02 - rustc_query_impl[cbfd76682f824088]::query_impl::symbol_name::get_query_non_incr::__rust_end_short_backtrace
  49:     0x7f0e9d433902 - <rustc_middle[5ec3528ea702113d]::mir::mono::MonoItem>::symbol_name
  50:     0x7f0e9d43280e - rustc_monomorphize[c9254873f2a379eb]::partitioning::assert_symbols_are_distinct::<std[c1824ed7e719b848]::collections::hash::set::Iter<rustc_middle[5ec3528ea702113d]::mir::mono::MonoItem>>
  51:     0x7f0e9d42a961 - rustc_monomorphize[c9254873f2a379eb]::partitioning::collect_and_partition_mono_items
  52:     0x7f0e9d813946 - rustc_query_impl[cbfd76682f824088]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[cbfd76682f824088]::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5ec3528ea702113d]::query::erase::Erased<[u8; 24usize]>>
  53:     0x7f0e9d8138f9 - <rustc_query_impl[cbfd76682f824088]::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2} as core[58e1e45e82356d94]::ops::function::FnOnce<(rustc_middle[5ec3528ea702113d]::ty::context::TyCtxt, ())>>::call_once
  54:     0x7f0e9d8134c2 - rustc_query_system[45ab6d026cac8713]::query::plumbing::try_execute_query::<rustc_query_impl[cbfd76682f824088]::DynamicConfig<rustc_query_system[45ab6d026cac8713]::query::caches::SingleCache<rustc_middle[5ec3528ea702113d]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[cbfd76682f824088]::plumbing::QueryCtxt, false>
  55:     0x7f0e9d9f270d - rustc_query_impl[cbfd76682f824088]::query_impl::collect_and_partition_mono_items::get_query_non_incr::__rust_end_short_backtrace
  56:     0x7f0e9cab6158 - <rustc_codegen_llvm[bcadacfbbe9e432d]::LlvmCodegenBackend as rustc_codegen_ssa[647f39034991b790]::traits::backend::CodegenBackend>::codegen_crate
  57:     0x7f0e9d6f9125 - rustc_interface[15f2bcae4bc06d86]::passes::start_codegen
  58:     0x7f0e9d6f8776 - <rustc_interface[15f2bcae4bc06d86]::queries::Queries>::ongoing_codegen
  59:     0x7f0e9d6e73b2 - std[c1824ed7e719b848]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[15f2bcae4bc06d86]::util::run_in_thread_with_globals<rustc_interface[15f2bcae4bc06d86]::interface::run_compiler<core[58e1e45e82356d94]::result::Result<(), rustc_span[e04a3047034dd436]::ErrorGuaranteed>, rustc_driver_impl[d47efb37cd2f86c4]::run_compiler::{closure#1}>::{closure#0}, core[58e1e45e82356d94]::result::Result<(), rustc_span[e04a3047034dd436]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[58e1e45e82356d94]::result::Result<(), rustc_span[e04a3047034dd436]::ErrorGuaranteed>>
  60:     0x7f0e9d6e6633 - <<std[c1824ed7e719b848]::thread::Builder>::spawn_unchecked_<rustc_interface[15f2bcae4bc06d86]::util::run_in_thread_with_globals<rustc_interface[15f2bcae4bc06d86]::interface::run_compiler<core[58e1e45e82356d94]::result::Result<(), rustc_span[e04a3047034dd436]::ErrorGuaranteed>, rustc_driver_impl[d47efb37cd2f86c4]::run_compiler::{closure#1}>::{closure#0}, core[58e1e45e82356d94]::result::Result<(), rustc_span[e04a3047034dd436]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[58e1e45e82356d94]::result::Result<(), rustc_span[e04a3047034dd436]::ErrorGuaranteed>>::{closure#1} as core[58e1e45e82356d94]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  61:     0x7f0e9b370c05 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8fc874dae8f68c70
                               at /rustc/fcab24817c72ffbd6ffb66d92b7ddc0d3ee4d2f0/library/alloc/src/boxed.rs:2007:9
  62:     0x7f0e9b370c05 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hfa35fdaf7f71c116
                               at /rustc/fcab24817c72ffbd6ffb66d92b7ddc0d3ee4d2f0/library/alloc/src/boxed.rs:2007:9
  63:     0x7f0e9b370c05 - std::sys::unix::thread::Thread::new::thread_start::h09b948711ea93091
                               at /rustc/fcab24817c72ffbd6ffb66d92b7ddc0d3ee4d2f0/library/std/src/sys/unix/thread.rs:108:17
  64:     0x7f0e9b094ac3 - start_thread
                               at ./nptl/pthread_create.c:442:8
  65:     0x7f0e9b126a40 - clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
  66:                0x0 - <unknown>

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please attach the file at `/home/.../gear/rustc-ice-2023-10-26T10:22:35.364146241Z-131452.txt` to your bug report

note: compiler flags: --crate-type lib -C opt-level=3 -C embed-bitcode=no -Z treat-err-as-bug -C instrument-coverage

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [normalize_projection_ty] normalizing `<Runtime as pallet_grandpa::pallet::Config>::KeyOwnerProof`
#1 [try_normalize_generic_arg_after_erasing_regions] normalizing `(sp_consensus_grandpa::EquivocationProof<<Runtime as frame_system::pallet::Config>::Hash, <Runtime as frame_system::pallet::Config>::BlockNumber>, <Runtime as pallet_grandpa::pallet::Config>::KeyOwnerProof)`
#2 [symbol_name] computing the symbol for `<pallet_grandpa::equivocation::EquivocationReportSystem<Runtime, pallet_offences::pallet::Pallet<Runtime>, pallet_session::historical::pallet::Pallet<Runtime>, ReportLongevity> as sp_staking::offence::OffenceReportSystem<core::option::Option<<Runtime as frame_system::pallet::Config>::AccountId>, (sp_consensus_grandpa::EquivocationProof<<Runtime as frame_system::pallet::Config>::Hash, <Runtime as frame_system::pallet::Config>::BlockNumber>, <Runtime as pallet_grandpa::pallet::Config>::KeyOwnerProof)>>::process_evidence`
#3 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
error: could not compile `vara-runtime` (lib) due to previous error

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-code-coverageArea: Source-based code coverage (-Cinstrument-coverage)C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions