rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
97.1k stars 12.55k forks source link

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

Closed matthiaskrgr closed 3 years ago

matthiaskrgr commented 3 years ago

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 - ::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 - ::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:: for rustc_middle::ty::query::queries::mir_promoted>::compute::hd22b0a9058b7bb65 22: 0x7f9f9e88fb53 - rustc_query_system::dep_graph::graph::DepGraph::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:: for rustc_middle::ty::query::queries::mir_borrowck>::compute::hd320f4ca41a47c0c 28: 0x7f9f9ddfbd8b - rustc_query_system::dep_graph::graph::DepGraph::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:: for rustc_middle::ty::query::queries::type_of>::compute::hbd3126cecae236d0 35: 0x7f9f9ddfd43d - rustc_query_system::dep_graph::graph::DepGraph::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:: for rustc_middle::ty::query::queries::check_mod_item_types>::compute::h84e989a4d938b565 42: 0x7f9f9de01844 - rustc_query_system::dep_graph::graph::DepGraph::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:: for rustc_middle::ty::query::queries::analysis>::compute::h95ff81a8a73eaff3 49: 0x7f9f9d1ffc06 - rustc_query_system::dep_graph::graph::DepGraph::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::::enter::hcfd2504bb4e8d292 54: 0x7f9f9d1dad37 - rustc_span::with_source_map::hdf17fa3a4d8fe35b 55: 0x7f9f9d208e8c - scoped_tls::ScopedKey::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 - as core::ops::function::FnOnce>::call_once::hea1090dbdcecbf5a at /rustc/b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18/library/alloc/src/boxed.rs:1327:9 59: 0x7f9f9c93062a - as core::ops::function::FnOnce>::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 - 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 commented 3 years ago

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

matthiaskrgr commented 3 years ago

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