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: glacier fixed/71348.rs with -Zinstrument-coverage: symbol_names: unsupported constant of type #79565

Closed
matthiaskrgr opened this issue Nov 30, 2020 · 13 comments · Fixed by #79958
Labels
A-code-coverage Area: Source-based code coverage (-Cinstrument-coverage) C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

Code

file is from glacier fixed/71348.rs

#![feature(const_generics)]
#![allow(incomplete_features)]

struct Foo {
    i: i32,
}

trait Get<'a, const N: &'static str> {
    type Target: 'a;

    fn get(&'a self) -> &'a Self::Target;
}

impl Foo {
    fn ask<'a, const N: &'static str>(&'a self) -> &'a <Self as Get<N>>::Target
    where
        Self: Get<'a, N>,
    {
        self.get()
    }
}

impl<'a> Get<'a, "int"> for Foo {
    type Target = i32;

    fn get(&'a self) -> &'a Self::Target {
        &self.i
    }
}

fn main() {
    let foo = Foo { i: 123 };

    //println!("{}", foo.ask()); // okay
    println!("{}", foo.ask::<"int">()); // ICE
}

Meta

rustc --version --verbose:

rustc 1.50.0-nightly (1c389ffef 2020-11-24)
binary: rustc
commit-hash: 1c389ffeff814726dec325f0f2b0c99107df2673
commit-date: 2020-11-24
host: x86_64-unknown-linux-gnu
release: 1.50.0-nightly

Error output

rustc -Zinstrument-coverage ./71348.rs

error: internal compiler error: compiler/rustc_symbol_mangling/src/v0.rs:537:17: symbol_names: unsupported constant of type `&str` (Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [105, 110, 116], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [7], len: Size { raw: 3 } }, size: Size { raw: 3 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 3 }) })

thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:958:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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.50.0-nightly (b7ebc6b0c 2020-11-30) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z instrument-coverage

query stack during panic:
#0 [symbol_name] computing the symbol for `<Foo as Get<"int">>::get`
#1 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
error: aborting due to previous error
Backtrace

error: internal compiler error: compiler/rustc_symbol_mangling/src/v0.rs:537:17: symbol_names: unsupported constant of type `&str` (Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [105, 110, 116], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [7], len: Size { raw: 3 } }, size: Size { raw: 3 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 3 }) })

thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:958:9
stack backtrace:
   0:     0x7fa8fe2fee00 - std::backtrace_rs::backtrace::libunwind::trace::h746c3e9529d524bc
                               at /rustc/b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7fa8fe2fee00 - std::backtrace_rs::backtrace::trace_unsynchronized::h86340908ff889faa
                               at /rustc/b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fa8fe2fee00 - std::sys_common::backtrace::_print_fmt::h43f85f9b18230404
                               at /rustc/b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7fa8fe2fee00 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc132ae1a5b5aa7cd
                               at /rustc/b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7fa8fe371b9c - core::fmt::write::hdf023a0036d2a25f
                               at /rustc/b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18/library/core/src/fmt/mod.rs:1078:17
   5:     0x7fa8fe2f0972 - std::io::Write::write_fmt::h8580846154bcb66a
                               at /rustc/b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18/library/std/src/io/mod.rs:1519:15
   6:     0x7fa8fe302a65 - std::sys_common::backtrace::_print::h7ee55fed88d107a3
                               at /rustc/b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7fa8fe302a65 - std::sys_common::backtrace::print::h54a7d3e52a524177
                               at /rustc/b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7fa8fe302a65 - std::panicking::default_hook::{{closure}}::h60921e857bf55a40
                               at /rustc/b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18/library/std/src/panicking.rs:208:50
   9:     0x7fa8fe3025ba - std::panicking::default_hook::hf0f9afb1017317fc
                               at /rustc/b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18/library/std/src/panicking.rs:225:9
  10:     0x7fa8feb94428 - rustc_driver::report_ice::ha25ae86a5858acc3
  11:     0x7fa8fe303366 - std::panicking::rust_panic_with_hook::h8d66bf42b407aaea
                               at /rustc/b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18/library/std/src/panicking.rs:595:17
  12:     0x7fa901d0f93d - std::panicking::begin_panic::{{closure}}::he3ac55d11a883a10
  13:     0x7fa901d0f646 - std::sys_common::backtrace::__rust_end_short_backtrace::h4402bc3ed558879b
  14:     0x7fa901d0f8df - std::panicking::begin_panic::hd2137c659c375844
  15:     0x7fa901d49e5c - rustc_errors::HandlerInner::bug::hbfb11e3c8ba1475f
  16:     0x7fa901d48570 - rustc_errors::Handler::bug::ha00f48e1291906a1
  17:     0x7fa9015d3354 - rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}::h121c3336b55e047b
  18:     0x7fa9015d1f6b - rustc_middle::ty::context::tls::with_opt::{{closure}}::h61e852c60289ba39
  19:     0x7fa9015d1f12 - rustc_middle::ty::context::tls::with_opt::h7523943876fa0859
  20:     0x7fa9015d3279 - rustc_middle::util::bug::opt_span_bug_fmt::h131d336df190dd17
  21:     0x7fa9015d31ee - rustc_middle::util::bug::bug_fmt::hd70ee7a62354ffb4
  22:     0x7fa90075e61a - <rustc_symbol_mangling::v0::SymbolMangler as rustc_middle::ty::print::Printer>::print_const::hd153fa7ea45e9ebf
  23:     0x7fa90075a413 - <rustc_symbol_mangling::v0::SymbolMangler as rustc_middle::ty::print::Printer>::print_def_path::h8f68437b39871fcf
  24:     0x7fa90075b6a8 - <rustc_symbol_mangling::v0::SymbolMangler as rustc_middle::ty::print::Printer>::print_impl_path::h1e1f208310e68c84
  25:     0x7fa90075a118 - <rustc_symbol_mangling::v0::SymbolMangler as rustc_middle::ty::print::Printer>::print_def_path::h8f68437b39871fcf
  26:     0x7fa90075a9cf - <rustc_symbol_mangling::v0::SymbolMangler as rustc_middle::ty::print::Printer>::print_def_path::h8f68437b39871fcf
  27:     0x7fa900758ca0 - rustc_symbol_mangling::v0::mangle::h75957b7520c3cbb0
  28:     0x7fa9007b0c74 - rustc_symbol_mangling::symbol_name_provider::h4fb4b9a3e1584346
  29:     0x7fa90195c51d - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::symbol_name>::compute::hd7bd4603d4dd113f
  30:     0x7fa901a4de03 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task::haa130b76e2277a12
  31:     0x7fa9017b9c9e - rustc_data_structures::stack::ensure_sufficient_stack::hceb067d2653d5bdc
  32:     0x7fa901aeefce - rustc_query_system::query::plumbing::get_query_impl::ha02dc043a8704091
  33:     0x7fa901945273 - rustc_middle::mir::mono::MonoItem::symbol_name::ha0e4dc838b635800
  34:     0x7fa9001328d1 - <alloc::vec::Vec<T> as alloc::vec::SpecFromIter<T,I>>::from_iter::hbee104624de7cff0
  35:     0x7fa9003543d6 - rustc_mir::monomorphize::partitioning::assert_symbols_are_distinct::hd086879bcefccb07
  36:     0x7fa9003fec49 - rustc_session::utils::<impl rustc_session::session::Session>::time::hdf68b219b771afda
  37:     0x7fa900354be7 - rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items::h226257a3cee4be40
  38:     0x7fa8fefeee12 - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::collect_and_partition_mono_items>::compute::hde78aee6b8d9daf5
  39:     0x7fa8fef6391e - rustc_query_system::dep_graph::graph::DepGraph<K>::with_eval_always_task::hba5fde1f8c495685
  40:     0x7fa8fefb3769 - rustc_data_structures::stack::ensure_sufficient_stack::hcdf352d855cd3c57
  41:     0x7fa8feebad7c - rustc_query_system::query::plumbing::get_query_impl::h3d4812047a177271
  42:     0x7fa8fefefcac - rustc_codegen_ssa::base::codegen_crate::h4ca0c07e9283eb44
  43:     0x7fa8ff0213c5 - <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate::h067fffb3870bc5b0
  44:     0x7fa8fedfcc99 - rustc_interface::queries::Queries::ongoing_codegen::h1d025e9038b6dd3f
  45:     0x7fa8febeeaa8 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::hcfd2504bb4e8d292
  46:     0x7fa8febbcd37 - rustc_span::with_source_map::hdf17fa3a4d8fe35b
  47:     0x7fa8febeae8c - scoped_tls::ScopedKey<T>::set::h5dca480b178bbfab
  48:     0x7fa8febf1fa5 - std::sys_common::backtrace::__rust_begin_short_backtrace::ha4cbf96baa7e4912
  49:     0x7fa8feb5ab4a - core::ops::function::FnOnce::call_once{{vtable.shim}}::he2d69591c700ddc8
  50:     0x7fa8fe31262a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hea1090dbdcecbf5a
                               at /rustc/b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18/library/alloc/src/boxed.rs:1327:9
  51:     0x7fa8fe31262a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8d5723d3912bd325
                               at /rustc/b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18/library/alloc/src/boxed.rs:1327:9
  52:     0x7fa8fe31262a - std::sys::unix::thread::Thread::new::thread_start::hc17a425ca2995724
                               at /rustc/b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18/library/std/src/sys/unix/thread.rs:71:17
  53:     0x7fa8fe2083e9 - start_thread
  54:     0x7fa8fe125293 - __GI___clone
  55:                0x0 - <unknown>

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.50.0-nightly (b7ebc6b0c 2020-11-30) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z instrument-coverage

query stack during panic:
#0 [symbol_name] computing the symbol for `<Foo as Get<"int">>::get`
#1 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
error: aborting due to previous error

@matthiaskrgr matthiaskrgr 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 Nov 30, 2020
@matthiaskrgr
Copy link
Member Author

@rustbot label: +A-code-coverage +requires-nightly

@rustbot rustbot added A-code-coverage Area: Source-based code coverage (-Cinstrument-coverage) requires-nightly This issue requires a nightly compiler in some way. labels Nov 30, 2020
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Dec 12, 2020
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Dec 15, 2020
…2.0, r=tmandry

Fixes reported bugs in Rust Coverage

Fixes: rust-lang#79569

Fixes: rust-lang#79566
Fixes: rust-lang#79565

For the first issue (rust-lang#79569), I got hit a `debug_assert!()` before
encountering the reported error message (because I have `debug = true`
enabled in my config.toml).

The assertion showed me that some `SwitchInt`s can have more than one
target pointing to the same `BasicBlock`.

I had thought that was invalid, but since it seems to be possible, I'm
allowing this now.

I added a new test for this.

----

In the last two cases above, both tests (intentionally) fail to compile,
but the `InstrumentCoverage` pass is invoked anyway.

The MIR starts with an `Unreachable` `BasicBlock`, which I hadn't
encountered before. (I had assumed the `InstrumentCoverage` pass
would only be invoked with MIRs from successful compilations.)

I don't have test infrastructure set up to test coverage on files that
fail to compile, so I didn't add a new test.

r? `@tmandry`
FYI: `@wesleywiser`
@bors bors closed this as completed in eb963ff Dec 15, 2020
@matthiaskrgr
Copy link
Member Author

Can someone please reopen this? the issue is still reproducible:

rustc 1.50.0-nightly (e15ec667c 2020-12-15)
binary: rustc
commit-hash: e15ec667cee92d47c64fc903227b2fdb81f9e530
commit-date: 2020-12-15
host: x86_64-unknown-linux-gnu
release: 1.50.0-nightly
$rustc -Zinstrument-coverage ./71348.rs
error: internal compiler error: compiler/rustc_symbol_mangling/src/v0.rs:537:17: symbol_names: unsupported constant of type `&str` (Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [105, 110, 116], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [7], len: Size { raw: 3 } }, size: Size { raw: 3 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 3 }) })

thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:958:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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.50.0-nightly (e15ec667c 2020-12-15) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z instrument-coverage

query stack during panic:
#0 [symbol_name] computing the symbol for `<Foo as Get<"int">>::get`
#1 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
error: aborting due to previous error

error: internal compiler error: compiler/rustc_symbol_mangling/src/v0.rs:537:17: symbol_names: unsupported constant of type `&str` (Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [105, 110, 116], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [7], len: Size { raw: 3 } }, size: Size { raw: 3 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 3 }) })

thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:958:9
stack backtrace:
   0:     0x7f284253b527 - std::backtrace_rs::backtrace::libunwind::trace::h746c3e9529d524bc
                               at /rustc/e15ec667cee92d47c64fc903227b2fdb81f9e530/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7f284253b527 - std::backtrace_rs::backtrace::trace_unsynchronized::h84373278bfb39e0c
                               at /rustc/e15ec667cee92d47c64fc903227b2fdb81f9e530/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f284253b527 - std::sys_common::backtrace::_print_fmt::h517324efde750597
                               at /rustc/e15ec667cee92d47c64fc903227b2fdb81f9e530/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f284253b527 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf594ab77fac89284
                               at /rustc/e15ec667cee92d47c64fc903227b2fdb81f9e530/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7f28425ac0ec - core::fmt::write::h3868db8542c90941
                               at /rustc/e15ec667cee92d47c64fc903227b2fdb81f9e530/library/core/src/fmt/mod.rs:1078:17
   5:     0x7f284252d3f2 - std::io::Write::write_fmt::h3f6656f045fa877f
                               at /rustc/e15ec667cee92d47c64fc903227b2fdb81f9e530/library/std/src/io/mod.rs:1519:15
   6:     0x7f284253f215 - std::sys_common::backtrace::_print::hda7655c057c24dcc
                               at /rustc/e15ec667cee92d47c64fc903227b2fdb81f9e530/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7f284253f215 - std::sys_common::backtrace::print::h546a6c8431d46287
                               at /rustc/e15ec667cee92d47c64fc903227b2fdb81f9e530/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7f284253f215 - std::panicking::default_hook::{{closure}}::h006dd083853faf51
                               at /rustc/e15ec667cee92d47c64fc903227b2fdb81f9e530/library/std/src/panicking.rs:208:50
   9:     0x7f284253ed6a - std::panicking::default_hook::hf0f9afb1017317fc
                               at /rustc/e15ec667cee92d47c64fc903227b2fdb81f9e530/library/std/src/panicking.rs:225:9
  10:     0x7f2842df4cd8 - rustc_driver::report_ice::h745efc047fa5f80b
  11:     0x7f284253fb16 - std::panicking::rust_panic_with_hook::hb7a19826c029b1d6
                               at /rustc/e15ec667cee92d47c64fc903227b2fdb81f9e530/library/std/src/panicking.rs:595:17
  12:     0x7f2845fb050d - std::panicking::begin_panic::{{closure}}::he3ac55d11a883a10
  13:     0x7f2845fb03c6 - std::sys_common::backtrace::__rust_end_short_backtrace::h4402bc3ed558879b
  14:     0x7f2845fb04af - std::panicking::begin_panic::hd2137c659c375844
  15:     0x7f2845febe2c - rustc_errors::HandlerInner::bug::hbfb11e3c8ba1475f
  16:     0x7f2845fea540 - rustc_errors::Handler::bug::ha00f48e1291906a1
  17:     0x7f28458a9744 - rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}::h08c1bd52850a380c
  18:     0x7f28458a43bb - rustc_middle::ty::context::tls::with_opt::{{closure}}::h82c056b7e0ea907f
  19:     0x7f28458a4362 - rustc_middle::ty::context::tls::with_opt::h001ea91e9a6c9bc0
  20:     0x7f28458a9663 - rustc_middle::util::bug::opt_span_bug_fmt::h033dd7c3ae8939b2
  21:     0x7f28458a95d5 - rustc_middle::util::bug::bug_fmt::hededfcfaf49f2715
  22:     0x7f28449dc23a - <rustc_symbol_mangling::v0::SymbolMangler as rustc_middle::ty::print::Printer>::print_const::hb4db9f7658de19c3
  23:     0x7f28449d824c - <rustc_symbol_mangling::v0::SymbolMangler as rustc_middle::ty::print::Printer>::print_def_path::h532851c326efa497
  24:     0x7f28449d94d7 - <rustc_symbol_mangling::v0::SymbolMangler as rustc_middle::ty::print::Printer>::print_impl_path::habaffdd820484912
  25:     0x7f28449d7f4d - <rustc_symbol_mangling::v0::SymbolMangler as rustc_middle::ty::print::Printer>::print_def_path::h532851c326efa497
  26:     0x7f28449d87fc - <rustc_symbol_mangling::v0::SymbolMangler as rustc_middle::ty::print::Printer>::print_def_path::h532851c326efa497
  27:     0x7f28449d6b69 - rustc_symbol_mangling::v0::mangle::h0a8cac0b6256ab14
  28:     0x7f28449c7fda - rustc_symbol_mangling::symbol_name_provider::hbed96fd29036464b
  29:     0x7f2845c062cd - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::symbol_name>::compute::hed8d1ce9b7bdb5d0
  30:     0x7f2845e9c863 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task::h87c5e7129ab7c736
  31:     0x7f284597e0be - rustc_data_structures::stack::ensure_sufficient_stack::hd27156d5d08320de
  32:     0x7f2845cd560f - rustc_query_system::query::plumbing::get_query_impl::hae92309e9ab35d1a
  33:     0x7f2845beb9dd - rustc_middle::mir::mono::MonoItem::symbol_name::h4e1d33cdccb70a70
  34:     0x7f28442c79b1 - <alloc::vec::Vec<T> as alloc::vec::SpecFromIter<T,I>>::from_iter::h156d84d0271736c5
  35:     0x7f284454d4b3 - rustc_mir::monomorphize::partitioning::assert_symbols_are_distinct::h310c033f832b90f1
  36:     0x7f28445e0625 - rustc_data_structures::sync::join::h984f166973574fde
  37:     0x7f284454dac6 - rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items::h4f6973e15951cf11
  38:     0x7f28432765d2 - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::collect_and_partition_mono_items>::compute::hc67938a3c3133947
  39:     0x7f28431b179e - rustc_query_system::dep_graph::graph::DepGraph<K>::with_eval_always_task::h2ca6615b86509346
  40:     0x7f28431e7f19 - rustc_data_structures::stack::ensure_sufficient_stack::h4535a53c7273efc1
  41:     0x7f284312593c - rustc_query_system::query::plumbing::get_query_impl::hecc9be70aeb29bd5
  42:     0x7f28432903cc - <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate::h84729c6a9074acd9
  43:     0x7f284301684e - rustc_session::utils::<impl rustc_session::session::Session>::time::he9da96abd57eec9b
  44:     0x7f28430580bc - rustc_interface::passes::QueryContext::enter::hf96a740ef8e4de64
  45:     0x7f28430b2383 - rustc_interface::queries::Queries::ongoing_codegen::h8469c6700fd7a0f4
  46:     0x7f2842d9dae9 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::hed31e089d4b6eb55
  47:     0x7f2842e1e557 - rustc_span::with_source_map::h179240a3f032f8c8
  48:     0x7f2842d9f1fb - rustc_interface::interface::create_compiler_and_run::hb67b5170c4ead91b
  49:     0x7f2842e4b650 - scoped_tls::ScopedKey<T>::set::h3794ca08c112be1c
  50:     0x7f2842e52516 - std::sys_common::backtrace::__rust_begin_short_backtrace::he3bd2885a25fc3ec
  51:     0x7f2842da67ca - core::ops::function::FnOnce::call_once{{vtable.shim}}::he39fdb958d398dc2
  52:     0x7f284254f61a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hea1090dbdcecbf5a
                               at /rustc/e15ec667cee92d47c64fc903227b2fdb81f9e530/library/alloc/src/boxed.rs:1328:9
  53:     0x7f284254f61a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8d5723d3912bd325
                               at /rustc/e15ec667cee92d47c64fc903227b2fdb81f9e530/library/alloc/src/boxed.rs:1328:9
  54:     0x7f284254f61a - std::sys::unix::thread::Thread::new::thread_start::hc17a425ca2995724
                               at /rustc/e15ec667cee92d47c64fc903227b2fdb81f9e530/library/std/src/sys/unix/thread.rs:71:17
  55:     0x7f28424403e9 - start_thread
  56:     0x7f284235d293 - __GI___clone
  57:                0x0 - <unknown>

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.50.0-nightly (e15ec667c 2020-12-15) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z instrument-coverage

query stack during panic:
#0 [symbol_name] computing the symbol for `<Foo as Get<"int">>::get`
#1 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
error: aborting due to previous error

@matthiaskrgr

This comment has been minimized.

@richkadel
Copy link
Contributor

My mistake for marking this Fixed in #79958. What I actually did in that PR was to make it possible to enable -Z instrument-coverage AND to force the symbol-mangling-version to legacy.

This gives the following result, and successfully compiles:

$ rustc fixed/72348.rs -Zinstrument-coverage -Zsymbol-mangling-version=legacy
warning: -Z instrument-coverage requires symbol mangling version `v0`, but `-Z symbol-mangling-version=legacy` was specified

Legacy symbol mangling is not expected to work correctly when generating coverage reports, but at least this option shows the ICE is coming from the v0 mangler.

Yes, something in the -Zinstrument-coverage implementation also requires mangling a symbol that v0 does not yet support, but I believe the root cause of this ICE is related to a limitation of the experimental v0 mangler.

@eddyb - Any thoughts/suggestions?

@richkadel
Copy link
Contributor

cc: @wesleywiser @tmandry

@tmandry
Copy link
Member

tmandry commented Jan 9, 2021

Agreed with @richkadel. This looks to be a result of using a number of incomplete/unstable features in combination, and not really coverage related.

@matthiaskrgr
Copy link
Member Author

smaller example from glacier/fixed/74255.rs

#![feature(const_generics)]
#![allow(dead_code, incomplete_features)]

#[derive(PartialEq, Eq)]
enum IceEnum {
    Variant,
}

struct IceStruct;

impl IceStruct {
    fn ice_struct_fn<const I: IceEnum>() {}
}

fn ice_fn() {
    IceStruct::ice_struct_fn::<{ IceEnum::Variant }>();
}

fn main() {}

@eddyb
Copy link
Member

eddyb commented Apr 30, 2021

but I believe the root cause of this ICE is related to a limitation of the experimental v0 mangler.

cc @oli-obk It's just that value mangling isn't implemented, legacy only happens to work because it doesn't mangle generics at all. See also #61486.

@oli-obk
Copy link
Contributor

oli-obk commented Apr 30, 2021

#83234 makes it possible to fix this

@Alexendoo
Copy link
Member

No longer ICEs since #87194

@Alexendoo Alexendoo added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Aug 29, 2021
@workingjubilee
Copy link
Member

The regression tests mentioned above appear to already exist in the codebase?

@Alexendoo
Copy link
Member

The same rust code is shared between the examples in this issue and #71348/#74255, but for this one there's an extra flag -Zinstrument-coverage which isn't present in the tests yet

@tmiasko
Copy link
Contributor

tmiasko commented Feb 13, 2022

The existing test cases should be sufficient. The instrumentation coverage was affected because it defaults to v0 mangling scheme.

@tmiasko tmiasko closed this as completed Feb 13, 2022
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-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. 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.