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: coverage: attempt to add a 'Counter' to a BCB target with existing incoming edge counters #122738

Closed
matthiaskrgr opened this issue Mar 19, 2024 · 5 comments · Fixed by #122764
Labels
A-code-coverage Area: Source-based code coverage (-Cinstrument-coverage) 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.

Comments

@matthiaskrgr
Copy link
Member

auto-reduced (treereduce-rust):

fn test<'a: 'a>(n: bool) -> impl Sized + 'a {
    let true = n else { loop {} };

    loop {}
}

original:

use std::convert::identity;

fn test<'a: 'a>(n: bool) -> impl Sized + 'a {
    //~^ ERROR concrete type differs from previous defining opaque type use
    let true = n else { loop {} };
    let _ = || {
        let _ = identity::<&'a ()>(test(false));
    };
    loop {}
}

fn main() {}

Version information

rustc 1.79.0-nightly (a385e5667 2024-03-19)
binary: rustc
commit-hash: a385e5667c11098a01368c06e7c0c9236cd477cc
commit-date: 2024-03-19
host: x86_64-unknown-linux-gnu
release: 1.79.0-nightly
LLVM version: 18.1.2

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Cinstrument-coverage

Program output

error[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.7IlRFVTMd9Hc/rustc_testrunner_tmpdir_reporting.CuttrTUIRmte/mvce.rs:5:2
  |
5 | }
  |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.7IlRFVTMd9Hc/rustc_testrunner_tmpdir_reporting.CuttrTUIRmte/mvce.rs`

thread 'rustc' panicked at compiler/rustc_mir_transform/src/coverage/counters.rs:125:9:
attempt to add a `Counter` to a BCB target with existing incoming edge counters
stack backtrace:
   0:     0x72da1e807fa5 - std::backtrace_rs::backtrace::libunwind::trace::h663163b1406319df
                               at /rustc/a385e5667c11098a01368c06e7c0c9236cd477cc/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
   1:     0x72da1e807fa5 - std::backtrace_rs::backtrace::trace_unsynchronized::hb98458c0d221a1d2
                               at /rustc/a385e5667c11098a01368c06e7c0c9236cd477cc/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x72da1e807fa5 - std::sys_common::backtrace::_print_fmt::hfd766dc9518113a4
                               at /rustc/a385e5667c11098a01368c06e7c0c9236cd477cc/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x72da1e807fa5 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc6cd87bcd67d69a9
                               at /rustc/a385e5667c11098a01368c06e7c0c9236cd477cc/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x72da1e858feb - core::fmt::rt::Argument::fmt::hf5b735098c1f998e
                               at /rustc/a385e5667c11098a01368c06e7c0c9236cd477cc/library/core/src/fmt/rt.rs:142:9
   5:     0x72da1e858feb - core::fmt::write::h4b9ff19af3135272
                               at /rustc/a385e5667c11098a01368c06e7c0c9236cd477cc/library/core/src/fmt/mod.rs:1153:17
   6:     0x72da1e7fccbf - std::io::Write::write_fmt::h34d11d08e78b6c42
                               at /rustc/a385e5667c11098a01368c06e7c0c9236cd477cc/library/std/src/io/mod.rs:1843:15
   7:     0x72da1e807d7e - std::sys_common::backtrace::_print::h3bee6832a4022ced
                               at /rustc/a385e5667c11098a01368c06e7c0c9236cd477cc/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x72da1e807d7e - std::sys_common::backtrace::print::hc5073bb2e7688706
                               at /rustc/a385e5667c11098a01368c06e7c0c9236cd477cc/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x72da1e80a9f9 - std::panicking::default_hook::{{closure}}::hf1764864114d23cb
  10:     0x72da1e80a763 - std::panicking::default_hook::h34c466ca2272a795
                               at /rustc/a385e5667c11098a01368c06e7c0c9236cd477cc/library/std/src/panicking.rs:292:9
  11:     0x72da1b3bf0ef - std[806f4cc65fe479e6]::panicking::update_hook::<alloc[ccda606a89b8c1c7]::boxed::Box<rustc_driver_impl[674c6efebf1505bc]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x72da1e80b150 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hc566869933b3317f
                               at /rustc/a385e5667c11098a01368c06e7c0c9236cd477cc/library/alloc/src/boxed.rs:2029:9
  13:     0x72da1e80b150 - std::panicking::rust_panic_with_hook::hbb52b7d77653304f
                               at /rustc/a385e5667c11098a01368c06e7c0c9236cd477cc/library/std/src/panicking.rs:783:13
  14:     0x72da1e80ae6d - std::panicking::begin_panic_handler::{{closure}}::hccee28a87d0405b4
                               at /rustc/a385e5667c11098a01368c06e7c0c9236cd477cc/library/std/src/panicking.rs:649:13
  15:     0x72da1e808469 - std::sys_common::backtrace::__rust_end_short_backtrace::hddc11ac6ccb21feb
                               at /rustc/a385e5667c11098a01368c06e7c0c9236cd477cc/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x72da1e80abd7 - rust_begin_unwind
                               at /rustc/a385e5667c11098a01368c06e7c0c9236cd477cc/library/std/src/panicking.rs:645:5
  17:     0x72da1e855486 - core::panicking::panic_fmt::h0a581737015ab49a
                               at /rustc/a385e5667c11098a01368c06e7c0c9236cd477cc/library/core/src/panicking.rs:72:14
  18:     0x72da1b9e3c76 - <rustc_mir_transform[1307ec64b32b2baf]::coverage::counters::CoverageCounters>::set_bcb_counter
  19:     0x72da1ba1cf6a - <rustc_mir_transform[1307ec64b32b2baf]::coverage::counters::MakeBcbCounters>::get_or_make_counter_operand
  20:     0x72da1b9ebe64 - <rustc_mir_transform[1307ec64b32b2baf]::coverage::InstrumentCoverage as rustc_middle[d868e850dbd6021a]::mir::MirPass>::run_pass
  21:     0x72da1c60198d - rustc_mir_transform[1307ec64b32b2baf]::pass_manager::run_passes_inner
  22:     0x72da1a0211a8 - rustc_mir_transform[1307ec64b32b2baf]::mir_promoted
  23:     0x72da1cad6a9a - rustc_query_impl[c21e40cbcd779a75]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c21e40cbcd779a75]::query_impl::mir_promoted::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d868e850dbd6021a]::query::erase::Erased<[u8; 16usize]>>
  24:     0x72da1cad6d58 - rustc_query_system[139fc1bc295e0919]::query::plumbing::try_execute_query::<rustc_query_impl[c21e40cbcd779a75]::DynamicConfig<rustc_query_system[139fc1bc295e0919]::query::caches::VecCache<rustc_span[f124091ac140f0eb]::def_id::LocalDefId, rustc_middle[d868e850dbd6021a]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[c21e40cbcd779a75]::plumbing::QueryCtxt, false>
  25:     0x72da1cad69a3 - rustc_query_impl[c21e40cbcd779a75]::query_impl::mir_promoted::get_query_non_incr::__rust_end_short_backtrace
  26:     0x72da1c908072 - rustc_borrowck[1bfd479efec9d870]::mir_borrowck
  27:     0x72da1c907fa7 - rustc_query_impl[c21e40cbcd779a75]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c21e40cbcd779a75]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d868e850dbd6021a]::query::erase::Erased<[u8; 8usize]>>
  28:     0x72da1c909fae - rustc_query_system[139fc1bc295e0919]::query::plumbing::try_execute_query::<rustc_query_impl[c21e40cbcd779a75]::DynamicConfig<rustc_query_system[139fc1bc295e0919]::query::caches::VecCache<rustc_span[f124091ac140f0eb]::def_id::LocalDefId, rustc_middle[d868e850dbd6021a]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[c21e40cbcd779a75]::plumbing::QueryCtxt, false>
  29:     0x72da1c909acc - rustc_query_impl[c21e40cbcd779a75]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
  30:     0x72da1d0b1d4b - rustc_middle[d868e850dbd6021a]::query::plumbing::query_get_at::<rustc_query_system[139fc1bc295e0919]::query::caches::VecCache<rustc_span[f124091ac140f0eb]::def_id::LocalDefId, rustc_middle[d868e850dbd6021a]::query::erase::Erased<[u8; 8usize]>>>
  31:     0x72da1d0abfad - rustc_hir_analysis[cdf5a959bdcd3d71]::collect::type_of::type_of_opaque
  32:     0x72da1d0abe37 - rustc_query_impl[c21e40cbcd779a75]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c21e40cbcd779a75]::query_impl::type_of_opaque::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d868e850dbd6021a]::query::erase::Erased<[u8; 8usize]>>
  33:     0x72da1c6f035c - rustc_query_system[139fc1bc295e0919]::query::plumbing::try_execute_query::<rustc_query_impl[c21e40cbcd779a75]::DynamicConfig<rustc_query_system[139fc1bc295e0919]::query::caches::DefIdCache<rustc_middle[d868e850dbd6021a]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[c21e40cbcd779a75]::plumbing::QueryCtxt, false>
  34:     0x72da1d5bbd5e - rustc_query_impl[c21e40cbcd779a75]::query_impl::type_of_opaque::get_query_non_incr::__rust_end_short_backtrace
  35:     0x72da1cca0416 - rustc_middle[d868e850dbd6021a]::query::plumbing::query_get_at::<rustc_query_system[139fc1bc295e0919]::query::caches::DefIdCache<rustc_middle[d868e850dbd6021a]::query::erase::Erased<[u8; 8usize]>>>
  36:     0x72da1a47585a - rustc_hir_analysis[cdf5a959bdcd3d71]::collect::type_of::type_of
  37:     0x72da1c6f1762 - rustc_query_impl[c21e40cbcd779a75]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c21e40cbcd779a75]::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d868e850dbd6021a]::query::erase::Erased<[u8; 8usize]>>
  38:     0x72da1c6f035c - rustc_query_system[139fc1bc295e0919]::query::plumbing::try_execute_query::<rustc_query_impl[c21e40cbcd779a75]::DynamicConfig<rustc_query_system[139fc1bc295e0919]::query::caches::DefIdCache<rustc_middle[d868e850dbd6021a]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[c21e40cbcd779a75]::plumbing::QueryCtxt, false>
  39:     0x72da1c6efe5b - rustc_query_impl[c21e40cbcd779a75]::query_impl::type_of::get_query_non_incr::__rust_end_short_backtrace
  40:     0x72da1cca0416 - rustc_middle[d868e850dbd6021a]::query::plumbing::query_get_at::<rustc_query_system[139fc1bc295e0919]::query::caches::DefIdCache<rustc_middle[d868e850dbd6021a]::query::erase::Erased<[u8; 8usize]>>>
  41:     0x72da1cca6672 - rustc_hir_analysis[cdf5a959bdcd3d71]::check::check::check_item_type
  42:     0x72da1cccc7aa - rustc_hir_analysis[cdf5a959bdcd3d71]::check::wfcheck::check_well_formed
  43:     0x72da1cccb287 - rustc_query_impl[c21e40cbcd779a75]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c21e40cbcd779a75]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d868e850dbd6021a]::query::erase::Erased<[u8; 1usize]>>
  44:     0x72da1cccaa00 - rustc_query_system[139fc1bc295e0919]::query::plumbing::try_execute_query::<rustc_query_impl[c21e40cbcd779a75]::DynamicConfig<rustc_query_system[139fc1bc295e0919]::query::caches::VecCache<rustc_hir[3e94e721b9148021]::hir_id::OwnerId, rustc_middle[d868e850dbd6021a]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[c21e40cbcd779a75]::plumbing::QueryCtxt, false>
  45:     0x72da1ccca77f - rustc_query_impl[c21e40cbcd779a75]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  46:     0x72da1ccc86ba - rustc_hir_analysis[cdf5a959bdcd3d71]::check::wfcheck::check_mod_type_wf
  47:     0x72da1ccc84e1 - rustc_query_impl[c21e40cbcd779a75]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c21e40cbcd779a75]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d868e850dbd6021a]::query::erase::Erased<[u8; 1usize]>>
  48:     0x72da1d0e2430 - rustc_query_system[139fc1bc295e0919]::query::plumbing::try_execute_query::<rustc_query_impl[c21e40cbcd779a75]::DynamicConfig<rustc_query_system[139fc1bc295e0919]::query::caches::DefaultCache<rustc_span[f124091ac140f0eb]::def_id::LocalModDefId, rustc_middle[d868e850dbd6021a]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[c21e40cbcd779a75]::plumbing::QueryCtxt, false>
  49:     0x72da1d0e21db - rustc_query_impl[c21e40cbcd779a75]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  50:     0x72da1c9056cb - rustc_hir_analysis[cdf5a959bdcd3d71]::check_crate
  51:     0x72da1caa2f2a - rustc_interface[c9d53b999d14d195]::passes::analysis
  52:     0x72da1caa2a99 - rustc_query_impl[c21e40cbcd779a75]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c21e40cbcd779a75]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d868e850dbd6021a]::query::erase::Erased<[u8; 1usize]>>
  53:     0x72da1d42f503 - rustc_query_system[139fc1bc295e0919]::query::plumbing::try_execute_query::<rustc_query_impl[c21e40cbcd779a75]::DynamicConfig<rustc_query_system[139fc1bc295e0919]::query::caches::SingleCache<rustc_middle[d868e850dbd6021a]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[c21e40cbcd779a75]::plumbing::QueryCtxt, false>
  54:     0x72da1d42f27f - rustc_query_impl[c21e40cbcd779a75]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  55:     0x72da1d285244 - rustc_interface[c9d53b999d14d195]::interface::run_compiler::<core[55495f5072aa6ef1]::result::Result<(), rustc_span[f124091ac140f0eb]::ErrorGuaranteed>, rustc_driver_impl[674c6efebf1505bc]::run_compiler::{closure#0}>::{closure#0}
  56:     0x72da1d38c945 - std[806f4cc65fe479e6]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[c9d53b999d14d195]::util::run_in_thread_with_globals<rustc_interface[c9d53b999d14d195]::util::run_in_thread_pool_with_globals<rustc_interface[c9d53b999d14d195]::interface::run_compiler<core[55495f5072aa6ef1]::result::Result<(), rustc_span[f124091ac140f0eb]::ErrorGuaranteed>, rustc_driver_impl[674c6efebf1505bc]::run_compiler::{closure#0}>::{closure#0}, core[55495f5072aa6ef1]::result::Result<(), rustc_span[f124091ac140f0eb]::ErrorGuaranteed>>::{closure#0}, core[55495f5072aa6ef1]::result::Result<(), rustc_span[f124091ac140f0eb]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[55495f5072aa6ef1]::result::Result<(), rustc_span[f124091ac140f0eb]::ErrorGuaranteed>>
  57:     0x72da1d38c772 - <<std[806f4cc65fe479e6]::thread::Builder>::spawn_unchecked_<rustc_interface[c9d53b999d14d195]::util::run_in_thread_with_globals<rustc_interface[c9d53b999d14d195]::util::run_in_thread_pool_with_globals<rustc_interface[c9d53b999d14d195]::interface::run_compiler<core[55495f5072aa6ef1]::result::Result<(), rustc_span[f124091ac140f0eb]::ErrorGuaranteed>, rustc_driver_impl[674c6efebf1505bc]::run_compiler::{closure#0}>::{closure#0}, core[55495f5072aa6ef1]::result::Result<(), rustc_span[f124091ac140f0eb]::ErrorGuaranteed>>::{closure#0}, core[55495f5072aa6ef1]::result::Result<(), rustc_span[f124091ac140f0eb]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[55495f5072aa6ef1]::result::Result<(), rustc_span[f124091ac140f0eb]::ErrorGuaranteed>>::{closure#1} as core[55495f5072aa6ef1]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  58:     0x72da1e814919 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::ha82e45e83c882ddf
                               at /rustc/a385e5667c11098a01368c06e7c0c9236cd477cc/library/alloc/src/boxed.rs:2015:9
  59:     0x72da1e814919 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h14806e179a475d27
                               at /rustc/a385e5667c11098a01368c06e7c0c9236cd477cc/library/alloc/src/boxed.rs:2015:9
  60:     0x72da1e814919 - std::sys::pal::unix::thread::Thread::new::thread_start::hb8f0207dba0ec3b7
                               at /rustc/a385e5667c11098a01368c06e7c0c9236cd477cc/library/std/src/sys/pal/unix/thread.rs:108:17
  61:     0x72da182a955a - <unknown>
  62:     0x72da18326a3c - <unknown>
  63:                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: rustc 1.79.0-nightly (a385e5667 2024-03-19) running on x86_64-unknown-linux-gnu

note: compiler flags: -C instrument-coverage -Z dump-mir-dir=dir

query stack during panic:
#0 [mir_promoted] promoting constants in MIR for `test`
#1 [mir_borrowck] borrow-checking `test`
#2 [type_of_opaque] computing type of opaque `test::{opaque#0}`
#3 [type_of] computing type of `test::{opaque#0}`
#4 [check_well_formed] checking that `test::{opaque#0}` is well-formed
#5 [check_mod_type_wf] checking that types are well-formed in top-level module
#6 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0601`.

@matthiaskrgr matthiaskrgr added 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. C-bug Category: This is a bug. A-code-coverage Area: Source-based code coverage (-Cinstrument-coverage) labels Mar 19, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 19, 2024
@matthiaskrgr matthiaskrgr changed the title ICE: coverage: attempt to add a 'Counter' to a BCB target with existing incoming edge countersICE: coverage ICE: coverage: attempt to add a 'Counter' to a BCB target with existing incoming edge Mar 19, 2024
@matthiaskrgr matthiaskrgr changed the title ICE: coverage: attempt to add a 'Counter' to a BCB target with existing incoming edge ICE: coverage: attempt to add a 'Counter' to a BCB target with existing incoming edge counters Mar 19, 2024
@matthiaskrgr
Copy link
Member Author

#117421 cc @Zalathar ^_^

@Zalathar
Copy link
Contributor

Further reduced:

fn _test(n: bool) {
    let true = n else { loop {} };
}

@Zalathar
Copy link
Contributor

(Also note that even before #117421 this presumably would have still ICEd, because the only thing we did with that error was unwrap it.)

@Zalathar
Copy link
Contributor

I think the assertion is just incorrect in this case.

Normally a BCB will only have a physical counter if it has exactly one in-edge. If it has multiple in-edges, it will get an expression that sums up all of its in-edges, most of which will have physical counters. That's what the assertion is verifying.

However, if a BCB has an out-edge back to itself (i.e. loop {}), it gets a physical counter regardless. The assertion doesn't account for this, and fails.

Perhaps the reason we haven't seen this before is that the other in-edge to the loop node usually happens to be the one chosen to get an expression, so the assertion never sees the two-counters case.

@Zalathar
Copy link
Contributor

I tried to fix the assertion itself, but that ended up being pretty complicated. The information we'd need isn't readily available in the place that we need it, and there's also a related assertion in set_bcb_edge_counter that has the same problem.

Given that these assertions aren't load-bearing (the code should work fine even if it's violated), I'm inclined to just rip them out. They only exist as a holdover from the original implementation anyway.

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Mar 20, 2024
coverage: Remove incorrect assertions from counter allocation

These assertions detect situations where a BCB node (in the coverage graph) would have both a physical counter and one or more in-edge counters/expressions.

For most BCBs that situation would indicate an implementation bug. However, it's perfectly fine in the case of a BCB having an edge that loops back to itself.

Given the complexity and risk involved in fixing the assertions, and the fact that nothing relies on them actually being true, this patch just removes them instead.

Fixes rust-lang#122738.

`@rustbot` label +A-code-coverage
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Mar 20, 2024
coverage: Remove incorrect assertions from counter allocation

These assertions detect situations where a BCB node (in the coverage graph) would have both a physical counter and one or more in-edge counters/expressions.

For most BCBs that situation would indicate an implementation bug. However, it's perfectly fine in the case of a BCB having an edge that loops back to itself.

Given the complexity and risk involved in fixing the assertions, and the fact that nothing relies on them actually being true, this patch just removes them instead.

Fixes rust-lang#122738.

``@rustbot`` label +A-code-coverage
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Mar 20, 2024
coverage: Remove incorrect assertions from counter allocation

These assertions detect situations where a BCB node (in the coverage graph) would have both a physical counter and one or more in-edge counters/expressions.

For most BCBs that situation would indicate an implementation bug. However, it's perfectly fine in the case of a BCB having an edge that loops back to itself.

Given the complexity and risk involved in fixing the assertions, and the fact that nothing relies on them actually being true, this patch just removes them instead.

Fixes rust-lang#122738.

```@rustbot``` label +A-code-coverage
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 20, 2024
coverage: Remove incorrect assertions from counter allocation

These assertions detect situations where a BCB node (in the coverage graph) would have both a physical counter and one or more in-edge counters/expressions.

For most BCBs that situation would indicate an implementation bug. However, it's perfectly fine in the case of a BCB having an edge that loops back to itself.

Given the complexity and risk involved in fixing the assertions, and the fact that nothing relies on them actually being true, this patch just removes them instead.

Fixes rust-lang#122738.

````@rustbot```` label +A-code-coverage
@bors bors closed this as completed in c6a4922 Mar 21, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Mar 21, 2024
Rollup merge of rust-lang#122764 - Zalathar:loopy, r=oli-obk

coverage: Remove incorrect assertions from counter allocation

These assertions detect situations where a BCB node (in the coverage graph) would have both a physical counter and one or more in-edge counters/expressions.

For most BCBs that situation would indicate an implementation bug. However, it's perfectly fine in the case of a BCB having an edge that loops back to itself.

Given the complexity and risk involved in fixing the assertions, and the fact that nothing relies on them actually being true, this patch just removes them instead.

Fixes rust-lang#122738.

`````@rustbot````` label +A-code-coverage
@jieyouxu jieyouxu removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 21, 2024
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. 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

Successfully merging a pull request may close this issue.

4 participants