rust-lang / rust-lang/rust

Coverage on stable 1.79.0 fails with : maybe try to call `try_normalize_erasing_regions` instead

Open
#125,353 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-code-coverage C-bug E-needs-mcve I-ICE regression-from-stable-to-stable T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Code

Unfortunately I cannot provide a minimal example. I meet this issue while I'm trying to run coverage on nightly to experiment on coverage_attribute feature on an substrate based project.

I've experimented this issue with both nightly-2024-05-20 and nightly-2024-04-0`. I cannot bisect on it because the compilation time is too huge

cargo +nightly llvm-cov --workspace --lcov --output-path lcov.info

The good news is that botn cargo +nightly build cargo +nightly test work fine and the issue seams just related to the coverage stuff.

Meta

rustc --version --verbose:

rustc 1.80.0-nightly (b92758a9a 2024-05-20)
binary: rustc
commit-hash: b92758a9aef1cef7b79e2b72c3d8ba113e547f89
commit-date: 2024-05-20
host: x86_64-unknown-linux-gnu
release: 1.80.0-nightly
LLVM version: 18.1.6
Error output

rustc-ice-2024-05-21T08_17_56-165861.txt

error: internal compiler error: compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:167:90: Failed to normalize &'{erased} Alias(Projection, AliasTy { args: [sp_runtime::generic::Block<sp_runtime::generic::Header<u32, sp_runtime::traits::BlakeTwo256>, sp_runtime::generic::UncheckedExtrinsic<sp_runtime::MultiAddress<sp_runtime::AccountId32, ()>, nh_runtime::RuntimeCall, sp_runtime::MultiSignature, (frame_system::CheckNonZeroSender<nh_runtime::Runtime>, frame_system::CheckSpecVersion<nh_runtime::Runtime>, frame_system::CheckTxVersion<nh_runtime::Runtime>, frame_system::CheckGenesis<nh_runtime::Runtime>, frame_system::CheckMortality<nh_runtime::Runtime>, frame_system::CheckNonce<nh_runtime::Runtime>, frame_system::CheckWeight<nh_runtime::Runtime>, pallet_transaction_payment::ChargeTransactionPayment<nh_runtime::Runtime>)>>], def_id: DefId(267:1413 ~ sp_runtime[adb8]::traits::Block::Header) }), maybe try to call `try_normalize_erasing_regions` instead
Backtrace

stack backtrace:
   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
   1: <rustc_errors::diagnostic::BugAbort as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
   2: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>::{closure#0}
   3: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}
   4: rustc_middle::ty::context::tls::with_context_opt::<rustc_middle::ty::context::tls::with_opt<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
   5: rustc_middle::util::bug::bug_fmt
   6: <rustc_middle::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder as rustc_type_ir::fold::TypeFolder<rustc_middle::ty::context::TyCtxt>>::fold_ty
   7: <&rustc_middle::ty::list::RawList<(), rustc_middle::ty::generic_args::GenericArg> as rustc_type_ir::fold::TypeFoldable<rustc_middle::ty::context::TyCtxt>>::try_fold_with::<rustc_middle::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder>
   8: <rustc_symbol_mangling::v0::SymbolMangler as rustc_middle::ty::print::Printer>::print_impl_path
   9: <rustc_symbol_mangling::v0::SymbolMangler as rustc_middle::ty::print::Printer>::print_def_path
  10: <rustc_symbol_mangling::v0::SymbolMangler as rustc_middle::ty::print::Printer>::print_def_path
  11: rustc_symbol_mangling::v0::mangle
  12: rustc_symbol_mangling::symbol_name_provider
      [... omitted 1 frame ...]
  13: rustc_monomorphize::partitioning::assert_symbols_are_distinct::<std::collections::hash::set::Iter<rustc_middle::mir::mono::MonoItem>>
  14: rustc_monomorphize::partitioning::collect_and_partition_mono_items
      [... omitted 2 frames ...]
  15: rustc_codegen_ssa::base::codegen_crate::<rustc_codegen_llvm::LlvmCodegenBackend>
  16: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  17: rustc_interface::passes::start_codegen
  18: <rustc_interface::queries::Queries>::codegen_and_build_linker
  19: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED] -C instrument-coverage

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

query stack during panic:
#0 [symbol_name] computing the symbol for `<sp_blockchain::header_metadata::CachedHeaderMetadata<sp_runtime::generic::block::Block<sp_runtime::generic::header::Header<u32, sp_runtime::traits::BlakeTwo256>, sp_runtime::generic::unchecked_extrinsic::UncheckedExtrinsic<sp_runtime::multiaddress::MultiAddress<sp_core::crypto::AccountId32, ()>, nh_runtime::RuntimeCall, sp_runtime::MultiSignature, (frame_system::extensions::check_non_zero_sender::CheckNonZeroSender<nh_runtime::Runtime>, frame_system::extensions::check_spec_version::CheckSpecVersion<nh_runtime::Runtime>, frame_system::extensions::check_tx_version::CheckTxVersion<nh_runtime::Runtime>, frame_system::extensions::check_genesis::CheckGenesis<nh_runtime::Runtime>, frame_system::extensions::check_mortality::CheckMortality<nh_runtime::Runtime>, frame_system::extensions::check_nonce::CheckNonce<nh_runtime::Runtime>, frame_system::extensions::check_weight::CheckWeight<nh_runtime::Runtime>, pallet_transaction_payment::ChargeTransactionPayment<nh_runtime::Runtime>)>>> as core::convert::From<&<sp_runtime::generic::block::Block<sp_runtime::generic::header::Header<u32, sp_runtime::traits::BlakeTwo256>, sp_runtime::generic::unchecked_extrinsic::UncheckedExtrinsic<sp_runtime::multiaddress::MultiAddress<sp_core::crypto::AccountId32, ()>, nh_runtime::RuntimeCall, sp_runtime::MultiSignature, (frame_system::extensions::check_non_zero_sender::CheckNonZeroSender<nh_runtime::Runtime>, frame_system::extensions::check_spec_version::CheckSpecVersion<nh_runtime::Runtime>, frame_system::extensions::check_tx_version::CheckTxVersion<nh_runtime::Runtime>, frame_system::extensions::check_genesis::CheckGenesis<nh_runtime::Runtime>, frame_system::extensions::check_mortality::CheckMortality<nh_runtime::Runtime>, frame_system::extensions::check_nonce::CheckNonce<nh_runtime::Runtime>, frame_system::extensions::check_weight::CheckWeight<nh_runtime::Runtime>, pallet_transaction_payment::ChargeTransactionPayment<nh_runtime::Runtime>)>> as sp_runtime::traits::Block>::Header>>::from`
#1 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running cargo +nightly llvm-cov --workspace --lcov --output-path lcov.info with the reported coverage flags and review compiler/rustc_middle/src/ty/normalize_erasing_regions.rs alongside the symbol-mangling frames in the backtrace. Done means the reported coverage build no longer triggers this internal compiler error, with a regression check for the failure if a reproducible case can be reduced.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.