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

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

Open
la10736 opened this issue May 21, 2024 · 11 comments
Labels
A-code-coverage Area: Source-based code coverage (-Cinstrument-coverage) C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@la10736
Copy link
Contributor

la10736 commented May 21, 2024

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

@la10736 la10736 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 May 21, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label May 21, 2024
@jieyouxu jieyouxu added the S-needs-repro Status: This issue has no reproduction and needs a reproduction to make progress. label May 22, 2024
@jieyouxu jieyouxu added A-code-coverage Area: Source-based code coverage (-Cinstrument-coverage) and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jun 4, 2024
@la10736
Copy link
Contributor Author

la10736 commented Jun 21, 2024

Ok, I have some bad and some good news.

The bad one is that this bug is landed in stable 1.79.0 😢

The good one is that I can give you a repo to reproduce it:

Clone https://github.com/HorizenLabs/zkVerify , here the follow command reproduce the issue:

cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info

That's a regression on stable from 1.78 to 1.79

I'm sorry, I know that's a huge but I don't know how to narrow it.

@la10736 la10736 changed the title Coverage on nightly generate : maybe try to call try_normalize_erasing_regions instead Coverage on stable 1.79.0 fails with : maybe try to call try_normalize_erasing_regions instead Jun 21, 2024
@la10736
Copy link
Contributor Author

la10736 commented Jun 25, 2024

@jieyouxu Now that this bug is landed on stable shall not be better to take another look on it? If there's something that I can do let me know.

@jieyouxu jieyouxu added E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example and removed S-needs-repro Status: This issue has no reproduction and needs a reproduction to make progress. labels Jun 25, 2024
@ozgb
Copy link

ozgb commented Sep 5, 2024

I've run into this issue too, exactly the same setup (substrate project, build and test works fine, but coverage build fails with this error)

@jieyouxu
Copy link
Member

jieyouxu commented Sep 5, 2024

cc @Zalathar maybe you have any ideas on how to make the example smaller?

@Zalathar
Copy link
Contributor

Zalathar commented Sep 5, 2024

Does the same issue occur when you do a non-coverage build with -Csymbol-mangling-version=v0?

Coverage enables that as a side-effect, so this might be a symbol-mangling issue rather than a coverage issue (e.g. see also #116303).

@ozgb
Copy link

ozgb commented Sep 5, 2024

Does the same issue occur when you do a non-coverage build with -Csymbol-mangling-version=v0?

Yes! If I run with RUSTFLAGS="-Csymbol-mangling-version=v0" I get the same error

@la10736
Copy link
Contributor Author

la10736 commented Sep 5, 2024

I can confirm it too:

RUSTFLAGS="-Csymbol-mangling-version=v0" cargo build --release

meet the same issue.

@BoxyUwU BoxyUwU added the regression-from-stable-to-stable Performance or correctness regression from one stable version to another. label Sep 19, 2024
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Sep 19, 2024
@BoxyUwU
Copy link
Member

BoxyUwU commented Sep 19, 2024

If this is reproducible with -Csymbol-mangling-version=v0 then this doesnt require nightly and is a real regression

@apiraino
Copy link
Contributor

apiraino commented Oct 7, 2024

IIUC related to our tracking issue for v0 symbol mangling: #60705

@rustbot label -I-prioritize

@rustbot rustbot removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Oct 7, 2024
@djendara
Copy link

Facing the same issue here, in rustc:1.81.0. Build and test works, only coverage fails with the same ICE : Failed to normalize Alias(Projection, AliasTy {

@gilescope
Copy link
Contributor

gilescope commented Oct 22, 2024

Could it be #127351 ? - appeared around the same time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-code-coverage Area: Source-based code coverage (-Cinstrument-coverage) C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-stable Performance or correctness regression from one stable version to another. 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

9 participants