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/63279.rs with -Zinstrument-coverage: "at least one span" #79566

Closed
matthiaskrgr opened this issue Nov 30, 2020 · 2 comments · Fixed by #79958
Closed

ICE: glacier fixed/63279.rs with -Zinstrument-coverage: "at least one span" #79566

matthiaskrgr opened this issue Nov 30, 2020 · 2 comments · Fixed by #79958
Labels
A-code-coverage Area: Source-based code coverage (-Cinstrument-coverage) C-bug Category: This is a bug. 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

code from glacier fixed/63279.rs

#![feature(type_alias_impl_trait)]

type Closure = impl FnOnce();

fn c() -> Closure {
    || -> Closure { || () }
}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.50.0-nightly (b7ebc6b0c 2020-11-30)
binary: rustc
commit-hash: b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18
commit-date: 2020-11-30
host: x86_64-unknown-linux-gnu
release: 1.50.0-nightly

Error output

error[E0271]: type mismatch resolving `<[closure@./63279.rs:6:5: 6:28] as FnOnce<()>>::Output == ()`
 --> ./63279.rs:3:16
  |
3 | type Closure = impl FnOnce();
  |                ^^^^^^^^^^^^^ expected opaque type, found `()`
  |
  = note: expected opaque type `impl FnOnce<()>`
               found unit type `()`

thread 'rustc' panicked at 'at least one span', compiler/rustc_mir/src/transform/coverage/spans.rs:240:47
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

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 [mir_promoted] processing `c`
#1 [mir_borrowck] borrow-checking `c`
end of query stack
error: aborting due to previous error

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

error[E0271]: type mismatch resolving `<[closure@./63279.rs:6:5: 6:28] as FnOnce<()>>::Output == ()`
 --> ./63279.rs:3:16
  |
3 | type Closure = impl FnOnce();
  |                ^^^^^^^^^^^^^ expected opaque type, found `()`
  |
  = note: expected opaque type `impl FnOnce<()>`
               found unit type `()`

thread 'rustc' panicked at 'at least one span', compiler/rustc_mir/src/transform/coverage/spans.rs:240:47
stack backtrace:
   0:     0x7f9f9c91ce00 - std::backtrace_rs::backtrace::libunwind::trace::h746c3e9529d524bc
                               at /rustc/b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7f9f9c91ce00 - std::backtrace_rs::backtrace::trace_unsynchronized::h86340908ff889faa
                               at /rustc/b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f9f9c91ce00 - std::sys_common::backtrace::_print_fmt::h43f85f9b18230404
                               at /rustc/b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f9f9c91ce00 - <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:     0x7f9f9c98fb9c - core::fmt::write::hdf023a0036d2a25f
                               at /rustc/b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18/library/core/src/fmt/mod.rs:1078:17
   5:     0x7f9f9c90e972 - std::io::Write::write_fmt::h8580846154bcb66a
                               at /rustc/b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18/library/std/src/io/mod.rs:1519:15
   6:     0x7f9f9c920a65 - std::sys_common::backtrace::_print::h7ee55fed88d107a3
                               at /rustc/b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7f9f9c920a65 - std::sys_common::backtrace::print::h54a7d3e52a524177
                               at /rustc/b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7f9f9c920a65 - std::panicking::default_hook::{{closure}}::h60921e857bf55a40
                               at /rustc/b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18/library/std/src/panicking.rs:208:50
   9:     0x7f9f9c9205ba - std::panicking::default_hook::hf0f9afb1017317fc
                               at /rustc/b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18/library/std/src/panicking.rs:225:9
  10:     0x7f9f9d1b2428 - rustc_driver::report_ice::ha25ae86a5858acc3
  11:     0x7f9f9c921366 - std::panicking::rust_panic_with_hook::h8d66bf42b407aaea
                               at /rustc/b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18/library/std/src/panicking.rs:595:17
  12:     0x7f9f9c920e87 - std::panicking::begin_panic_handler::{{closure}}::hde71edcd925d0c5e
                               at /rustc/b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18/library/std/src/panicking.rs:497:13
  13:     0x7f9f9c91d2bc - std::sys_common::backtrace::__rust_end_short_backtrace::h8a3c7d6cea578919
                               at /rustc/b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18/library/std/src/sys_common/backtrace.rs:141:18
  14:     0x7f9f9c920de9 - rust_begin_unwind
                               at /rustc/b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18/library/std/src/panicking.rs:493:5
  15:     0x7f9f9c98bfb1 - core::panicking::panic_fmt::h20225113c4a2f8fd
                               at /rustc/b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18/library/core/src/panicking.rs:92:14
  16:     0x7f9f9c98bb93 - core::option::expect_failed::h8be1ca96ca0d69ca
                               at /rustc/b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18/library/core/src/option.rs:1260:5
  17:     0x7f9f9e580074 - rustc_mir::transform::coverage::spans::CoverageSpans::generate_coverage_spans::hcece797668b17080
  18:     0x7f9f9eaa83bd - <rustc_mir::transform::coverage::InstrumentCoverage as rustc_mir::transform::MirPass>::run_pass::h63163fe939ee6941
  19:     0x7f9f9ea101ad - rustc_mir::transform::run_passes::hde85252c218e451d
  20:     0x7f9f9ea10ff9 - rustc_mir::transform::mir_promoted::hbf030df47a64ef91
  21:     0x7f9f9ea619b1 - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::mir_promoted>::compute::hd22b0a9058b7bb65
  22:     0x7f9f9e88fb53 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task::hff3904454383c89e
  23:     0x7f9f9e9367c8 - rustc_data_structures::stack::ensure_sufficient_stack::he581a4f69947db11
  24:     0x7f9f9e671be1 - rustc_query_system::query::plumbing::get_query_impl::h20d9617555a285f4
  25:     0x7f9f9ea97024 - rustc_mir::borrow_check::mir_borrowck::h8fcfde9d3bc3965f
  26:     0x7f9f9ea69845 - core::ops::function::FnOnce::call_once::hda8d7f4d3e0163df
  27:     0x7f9f9df0871e - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::mir_borrowck>::compute::hd320f4ca41a47c0c
  28:     0x7f9f9ddfbd8b - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task::h7bb286f896f87eb1
  29:     0x7f9f9de08b6b - rustc_data_structures::stack::ensure_sufficient_stack::h065fe39becabf0c8
  30:     0x7f9f9df9ce94 - rustc_query_system::query::plumbing::get_query_impl::hce760a80e897a4cd
  31:     0x7f9f9df2b3f5 - rustc_typeck::collect::type_of::find_opaque_ty_constraints::ConstraintLocator::check::h0cb80a824c4819c8
  32:     0x7f9f9df1a908 - rustc_hir::intravisit::Visitor::visit_nested_item::hed7c8c156cf4fcc3
  33:     0x7f9f9df2aa26 - rustc_typeck::collect::type_of::type_of::h682626abe1bfac66
  34:     0x7f9f9dc91c7f - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::type_of>::compute::hbd3126cecae236d0
  35:     0x7f9f9ddfd43d - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task::h92e4440372797f42
  36:     0x7f9f9de0df14 - rustc_data_structures::stack::ensure_sufficient_stack::h60075674c5db35a7
  37:     0x7f9f9df4a9b9 - rustc_query_system::query::plumbing::get_query_impl::h2ad9c960400d3ef4
  38:     0x7f9f9dcc8ce1 - rustc_typeck::check::check::check_item_type::hcc9f9443120a7976
  39:     0x7f9f9dcf4f79 - rustc_middle::hir::map::Map::visit_item_likes_in_module::h31e465be68af3fae
  40:     0x7f9f9dccc4fd - rustc_typeck::check::check::check_mod_item_types::h2044a3471193590e
  41:     0x7f9f9de38f6e - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::check_mod_item_types>::compute::h84e989a4d938b565
  42:     0x7f9f9de01844 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task::hb775ad5fbe2007be
  43:     0x7f9f9de09ed6 - rustc_data_structures::stack::ensure_sufficient_stack::h169f6da446a255f9
  44:     0x7f9f9df8589a - rustc_query_system::query::plumbing::get_query_impl::h98dfa03e3aa1a6ea
  45:     0x7f9f9dfae68e - rustc_query_system::query::plumbing::ensure_query_impl::h8ac6e8d7fa871941
  46:     0x7f9f9de63d3f - rustc_typeck::check_crate::hab874d5f99f602e6
  47:     0x7f9f9d410502 - rustc_interface::passes::analysis::h342855b4d8ce9897
  48:     0x7f9f9d16ef2b - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute::h95ff81a8a73eaff3
  49:     0x7f9f9d1ffc06 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_eval_always_task::h71fd6f4f43205659
  50:     0x7f9f9d20eee6 - rustc_data_structures::stack::ensure_sufficient_stack::h426420634e295fa0
  51:     0x7f9f9d19cb44 - rustc_query_system::query::plumbing::get_query_impl::h59cb47161047ab66
  52:     0x7f9f9d1715fb - rustc_interface::passes::QueryContext::enter::heace2ac35bf577de
  53:     0x7f9f9d20ca65 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::hcfd2504bb4e8d292
  54:     0x7f9f9d1dad37 - rustc_span::with_source_map::hdf17fa3a4d8fe35b
  55:     0x7f9f9d208e8c - scoped_tls::ScopedKey<T>::set::h5dca480b178bbfab
  56:     0x7f9f9d20ffa5 - std::sys_common::backtrace::__rust_begin_short_backtrace::ha4cbf96baa7e4912
  57:     0x7f9f9d178b4a - core::ops::function::FnOnce::call_once{{vtable.shim}}::he2d69591c700ddc8
  58:     0x7f9f9c93062a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hea1090dbdcecbf5a
                               at /rustc/b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18/library/alloc/src/boxed.rs:1327:9
  59:     0x7f9f9c93062a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8d5723d3912bd325
                               at /rustc/b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18/library/alloc/src/boxed.rs:1327:9
  60:     0x7f9f9c93062a - std::sys::unix::thread::Thread::new::thread_start::hc17a425ca2995724
                               at /rustc/b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18/library/std/src/sys/unix/thread.rs:71:17
  61:     0x7f9f9c8263e9 - start_thread
  62:     0x7f9f9c743293 - __GI___clone
  63:                0x0 - <unknown>

error: internal compiler error: unexpected panic

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 [mir_promoted] processing `c`
#1 [mir_borrowck] borrow-checking `c`
#2 [type_of] computing type of `Closure::{opaque#0}`
#3 [check_mod_item_types] checking item types in top-level module
#4 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error

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

@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
@matthiaskrgr
Copy link
Member Author

This ICE also triggers on ~200 files inside the rustc repo.

@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
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. 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.

3 participants