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

Impossible case reached: src/librustc_ty/needs_drop.rs:111

Closed
Thomasdezeeuw opened this issue May 28, 2020 · 16 comments
Closed

Impossible case reached: src/librustc_ty/needs_drop.rs:111 #72685

Thomasdezeeuw opened this issue May 28, 2020 · 16 comments
Assignees
Labels
A-async-await A-generators AsyncAwait-Triaged C-bug E-easy E-help-wanted E-needs-mcve I-ICE T-compiler

Comments

@Thomasdezeeuw
Copy link
Contributor

Thomasdezeeuw commented May 28, 2020

I can't share the code, but I have a commit at which problem surfaced in case I need to check it again.

With rustc 1.45.0-nightly (664fcd3 2020-05-27):

error: internal compiler error: src/librustc_ty/needs_drop.rs:110: impossible case reached

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:907:9
stack backtrace:
   0:        0x1158b7e5e - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::haddd67525bfc5efd
   1:        0x1158f14ac - core::fmt::write::h26bd57c1fd6e9c98
   2:        0x1158a9367 - std::io::Write::write_fmt::he98312d4cdda2998
   3:        0x1158bc995 - std::panicking::default_hook::{{closure}}::h972739288f683b01
   4:        0x1158bc6d2 - std::panicking::default_hook::hb37535587742c590
   5:        0x10ea6c318 - rustc_driver::report_ice::h7e82cb45a804e7ac
   6:        0x1158bcfe5 - std::panicking::rust_panic_with_hook::h282a3815a0dbd960
   7:        0x112e22836 - std::panicking::begin_panic::h3347aa79e2bd0001
   8:        0x112a2bb47 - rustc_errors::HandlerInner::bug::hdd3d3d4df8ecc812
   9:        0x112a2a587 - rustc_errors::Handler::bug::hfdb40f11e1ec6375
  10:        0x11268b8d9 - rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}::h672ee7bf29d2e585
  11:        0x112683856 - rustc_middle::ty::context::tls::with_opt::{{closure}}::h180e0d128cf5a691
  12:        0x1126837db - rustc_middle::ty::context::tls::with_opt::h3dd865e1673fd5c3
  13:        0x11268b7e8 - rustc_middle::util::bug::opt_span_bug_fmt::h11c4561b989ea294
  14:        0x112e0a25b - rustc_middle::util::bug::bug_fmt::heb0671f45a3fced7
  15:        0x110b86245 - rustc_ty::needs_drop::needs_drop_raw::h5f1b2d46b1fe1310
  16:        0x1115197e2 - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::needs_drop_raw>::compute::hfebf1463447e93e9
  17:        0x11146e167 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::h408ef90e215ff458
  18:        0x1117d23eb - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h6ad91f3c6bd1184b
  19:        0x111748941 - rustc_query_system::query::plumbing::get_query_impl::{{closure}}::h78d6d7ad62a98123
  20:        0x1116f6f6c - rustc_query_system::query::plumbing::get_query_impl::hb404b598357f155e
  21:        0x11151913f - rustc_middle::ty::util::<impl rustc_middle::ty::TyS>::needs_drop::hec2a1d98b017a984
  22:        0x11153e633 - rustc_mir::dataflow::drop_flag_effects::on_all_children_bits::on_all_children_bits::h945d86a5f582fc5a
  23:        0x111893af1 - <rustc_mir::transform::elaborate_drops::ElaborateDrops as rustc_mir::transform::MirPass>::run_pass::h6ddb718a55e42b2e
  24:        0x11189cdf6 - rustc_mir::transform::run_passes::hae0f8213abc898bd
  25:        0x11189e4a8 - rustc_mir::transform::run_optimization_passes::h8d4e073ac16d4b4a
  26:        0x11189e797 - rustc_mir::transform::optimized_mir::hed469a7ecc9c2f75
  27:        0x111b4d5db - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::optimized_mir>::compute::h8fda8cd262fe2387
  28:        0x111c34e94 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::h9e4689433b3bec8a
  29:        0x111cdba42 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::he4a31e2f27add82c
  30:        0x111ce4614 - rustc_data_structures::stack::ensure_sufficient_stack::hc6d3d3b43db324d6
  31:        0x111ca880e - rustc_query_system::query::plumbing::get_query_impl::haec7a438c772d019
  32:        0x111b5ea39 - rustc_metadata::rmeta::encoder::EncodeContext::encode_optimized_mir::h36ec3fe0bfcce890
  33:        0x111b5f7d9 - <rustc_metadata::rmeta::encoder::EncodeContext as rustc_hir::intravisit::Visitor>::visit_expr::hfcf00eaa21e37df6
  34:        0x111d0a04f - rustc_hir::intravisit::walk_expr::he05489e90d3f9167
  35:        0x111b5f4ca - <rustc_metadata::rmeta::encoder::EncodeContext as rustc_hir::intravisit::Visitor>::visit_expr::hfcf00eaa21e37df6
  36:        0x111d099d5 - rustc_hir::intravisit::walk_fn::hdba1b43e9f186e02
  37:        0x111d0a7f2 - rustc_hir::intravisit::walk_item::h671e77f4156655d5
  38:        0x111b5fd8f - <rustc_metadata::rmeta::encoder::EncodeContext as rustc_hir::intravisit::Visitor>::visit_item::h16757bad83b9ba4c
  39:        0x111c55706 - rustc_hir::hir::Crate::visit_all_item_likes::h06250e40e6b25714
  40:        0x111b679d5 - rustc_metadata::rmeta::encoder::encode_metadata_impl::hf580f14b5e5ed365
  41:        0x111c4b7b9 - rustc_data_structures::sync::join::he6c503409ba48db1
  42:        0x111b9ba93 - rustc_metadata::rmeta::decoder::cstore_impl::<impl rustc_middle::middle::cstore::CrateStore for rustc_metadata::creader::CStore>::encode_metadata::h2a4dc82724a70bb8
  43:        0x112682254 - rustc_middle::ty::context::TyCtxt::encode_metadata::hcbc9b148077f4a74
  44:        0x10ebbfcb4 - rustc_interface::passes::start_codegen::h566b590c93aad30d
  45:        0x10ebceae8 - rustc_middle::ty::context::tls::enter_global::h3137fb999bf26770
  46:        0x10ebc9b1b - rustc_interface::queries::Queries::ongoing_codegen::h1a6016b31f7ff214
  47:        0x10ea36752 - rustc_interface::interface::run_compiler_in_existing_thread_pool::h5e937ba6fd9f8f01
  48:        0x10ea7c9a5 - rustc_ast::attr::with_globals::hcdba3f2dccfd96ec
  49:        0x10ea7db89 - std::sys_common::backtrace::__rust_begin_short_backtrace::h530da67482db7b0b
  50:        0x10ea3951c - core::ops::function::FnOnce::call_once{{vtable.shim}}::hdb3c595dbde36cc1
  51:        0x1158cb0dd - std::sys::unix::thread::Thread::new::thread_start::h7f9271978e0efa0c
  52:     0x7fff70077109 - _ZL12preoptimized

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.45.0-nightly (664fcd3f0 2020-05-27) running on x86_64-apple-darwin

note: compiler flags: -C panic=abort -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [needs_drop_raw] computing whether `std::future::from_generator::GenFuture<[static generator@src/peer/coordinator.rs:129:21: 161:2 ctx:[type error], stream:[type error], buf:[type error], peers:[type error], server:[type error] [type error]]>` needs drop
#1 [optimized_mir] processing `peer::coordinator::relay::{{closure}}#0`
end of query stack
error: aborting due to previous error

error: could not compile `MY_CRATE`.

To learn more, run the command again with --verbose.
@jonas-schievink jonas-schievink added C-bug E-needs-mcve I-ICE T-compiler A-async-await A-generators labels May 28, 2020
@estebank
Copy link
Contributor

estebank commented May 28, 2020

It seems like it might be this code

ty::Generator(_, substs, _) => {
let substs = substs.as_generator();
for upvar_ty in substs.upvar_tys() {
queue_type(self, upvar_ty);
}
let witness = substs.witness();
let interior_tys = match &witness.kind {
ty::GeneratorWitness(tys) => tcx.erase_late_bound_regions(tys),
_ => bug!(),
};
for interior_ty in interior_tys {
queue_type(self, interior_ty);
}
}

@jonas-schievink do you think this might have been introduced in #70015? (Particularly given the comment https://github.com/rust-lang/rust/pull/70015/files#r392633710.)

@Thomasdezeeuw could you try running the nightly from April 18th and tell us what the output is?

@jonas-schievink
Copy link
Member

jonas-schievink commented May 29, 2020

Yeah, probably introduced there. Though the erase_late_bound_regions is probably not involved as the ICE is in the line below.

I'll take a look. I thought that only a GeneratorWitness would be expected there, but according to the query stack there's a [type error] there? I guess we need a delay_span_bug instead of a bug!() then.

@jonas-schievink jonas-schievink self-assigned this May 29, 2020
@Thomasdezeeuw
Copy link
Contributor Author

Thomasdezeeuw commented May 29, 2020

@estebank April 18th compiler has the same problem:

error: internal compiler error: src/librustc_mir/transform/generator.rs:1244: impossible case reached

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:904:9
stack backtrace:
   0:        0x1085a0f0f - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h5f94faac0175417e
   1:        0x1085dacfe - core::fmt::write::h6df182023d9a3b95
   2:        0x108591ed7 - std::io::Write::write_fmt::h01d91a9263b8b567
   3:        0x1085a5a2a - std::panicking::default_hook::{{closure}}::h224eeb9bf4f57784
   4:        0x1085a576c - std::panicking::default_hook::h075ef9f55ab1c87b
   5:        0x1020119d8 - rustc_driver::report_ice::h839668b6f6ee766f
   6:        0x1085a6145 - std::panicking::rust_panic_with_hook::h073aa5d47393da95
   7:        0x106090596 - std::panicking::begin_panic::hd440e6b088740f3c
   8:        0x105c85547 - rustc_errors::HandlerInner::bug::h9e8ac091d8db35b5
   9:        0x105c83f37 - rustc_errors::Handler::bug::h36ed9541a04885fc
  10:        0x105713570 - rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}::hbddccb624994634d
  11:        0x105708076 - rustc_middle::ty::context::tls::with_opt::{{closure}}::ha492a72378e6816b
  12:        0x105707ffc - rustc_middle::ty::context::tls::with_opt::he38cce9a6e4c498c
  13:        0x105713478 - rustc_middle::util::bug::opt_span_bug_fmt::he731295bda299d43
  14:        0x10607120b - rustc_middle::util::bug::bug_fmt::h7ff1313c812cc524
  15:        0x104aef609 - <rustc_mir::transform::generator::StateTransform as rustc_mir::transform::MirPass>::run_pass::ha35fc414cb2df94a
  16:        0x104bf082e - rustc_mir::transform::run_passes::hd827a4539f07877a
  17:        0x104bf18aa - rustc_mir::transform::run_optimization_passes::h2ce109868df11098
  18:        0x104bf1ab3 - rustc_mir::transform::optimized_mir::h35bf6652bd5a6764
  19:        0x104f57393 - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::optimized_mir>::compute::h3cc19ec9d9ea6a15
  20:        0x104eacc39 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::h64cb36ddad128472
  21:        0x104fb1548 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::hf1ebe5defb932a5c
  22:        0x104f7458c - rustc_query_system::query::plumbing::get_query::h6671a0528e0184a0
  23:        0x104f4c892 - rustc_metadata::rmeta::encoder::EncodeContext::encode_optimized_mir::h7c0bfeb60ffe9485
  24:        0x104f4d3ba - <rustc_metadata::rmeta::encoder::EncodeContext as rustc_hir::intravisit::Visitor>::visit_expr::h17a738155897d005
  25:        0x104fbc0ef - rustc_hir::intravisit::walk_expr::h5c5d575bc47a8b59
  26:        0x104f4d19c - <rustc_metadata::rmeta::encoder::EncodeContext as rustc_hir::intravisit::Visitor>::visit_expr::h17a738155897d005
  27:        0x104fbba45 - rustc_hir::intravisit::walk_fn::hbfa2c41a46c256db
  28:        0x104fbc82e - rustc_hir::intravisit::walk_item::h37fc828aa3395968
  29:        0x104f4d88f - <rustc_metadata::rmeta::encoder::EncodeContext as rustc_hir::intravisit::Visitor>::visit_item::h42b42f8ddccf1e2a
  30:        0x104f0bce6 - rustc_hir::hir::Crate::visit_all_item_likes::h142036d1dede4a40
  31:        0x104f53a9b - rustc_metadata::rmeta::encoder::encode_metadata_impl::h36ec3570fac288ed
  32:        0x104fd6461 - rustc_data_structures::sync::join::h1884a05288217c60
  33:        0x104febec3 - rustc_metadata::rmeta::decoder::cstore_impl::<impl rustc_middle::middle::cstore::CrateStore for rustc_metadata::creader::CStore>::encode_metadata::hae3a892f144578cd
  34:        0x1057bc554 - rustc_middle::ty::context::TyCtxt::encode_metadata::h753a833bb8acea4f
  35:        0x1023174cc - rustc_interface::passes::start_codegen::h2cca674743f6e9f4
  36:        0x1022803eb - rustc_middle::ty::context::tls::enter_global::h6a39e126a61c050f
  37:        0x1023621c3 - rustc_interface::queries::Queries::ongoing_codegen::h16dfba2279957de2
  38:        0x10216cdcf - rustc_interface::interface::run_compiler_in_existing_thread_pool::h28920202dc32f459
  39:        0x10201a229 - scoped_tls::ScopedKey<T>::set::h72ccfda3e4bc20d9
  40:        0x102017125 - rustc_ast::attr::with_globals::hb7cd589acd2b132f
  41:        0x10201f6e0 - std::sys_common::backtrace::__rust_begin_short_backtrace::h8439916d1c647f2e
  42:        0x10216f66c - core::ops::function::FnOnce::call_once{{vtable.shim}}::hd9041fd5dcffbd35
  43:        0x10858236e - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::hca40cbe33b61149d
  44:        0x1085b4776 - std::sys::unix::thread::Thread::new::thread_start::hbe6d5a098d8adb9e
  45:     0x7fff70077109 - _ZL12preoptimized

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.44.0-nightly (52fa23add 2020-04-18) running on x86_64-apple-darwin

note: compiler flags: -C panic=abort -C debuginfo=2 -C incremental --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [optimized_mir] processing `peer::coordinator::read_known_peers::{{closure}}#0`
end of query stack
error: aborting due to previous error

error: could not compile `MY_CRATE`.

April 17th:

error: internal compiler error: src/librustc_mir/transform/generator.rs:1244: impossible case reached

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:904:9
stack backtrace:
   0:        0x10b15ff1f - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h8e33e558833d1956
   1:        0x10b199d0e - core::fmt::write::h9d197fdfdd3a8aba
   2:        0x10b150ee7 - std::io::Write::write_fmt::h489d814bafdb2fc0
   3:        0x10b164a3a - std::panicking::default_hook::{{closure}}::hd5cc0ed2514a340f
   4:        0x10b16477c - std::panicking::default_hook::h7e2bc667d2c8e4db
   5:        0x104bd5588 - rustc_driver::report_ice::hda8844815682ab6b
   6:        0x10b165155 - std::panicking::rust_panic_with_hook::h88adf9321de60790
   7:        0x108c628a6 - std::panicking::begin_panic::h40a3b10abbe0b486
   8:        0x108855147 - rustc_errors::HandlerInner::bug::h5510f64ec98175e7
   9:        0x108853b37 - rustc_errors::Handler::bug::h70245619acd154d8
  10:        0x1082e2a89 - rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}::hf97180823c881ffc
  11:        0x1082d76b6 - rustc_middle::ty::context::tls::with_opt::{{closure}}::hee471a2db74159be
  12:        0x1082d763c - rustc_middle::ty::context::tls::with_opt::ha1f589eb9df81f6e
  13:        0x1082e2998 - rustc_middle::util::bug::opt_span_bug_fmt::hd6250c66736c06a0
  14:        0x108c4115b - rustc_middle::util::bug::bug_fmt::hf584f902a66a7db2
  15:        0x1076bac09 - <rustc_mir::transform::generator::StateTransform as rustc_mir::transform::MirPass>::run_pass::hdfea4658ad32071f
  16:        0x1077ba1ce - rustc_mir::transform::run_passes::hf0a88394d36da281
  17:        0x1077bb70a - rustc_mir::transform::run_optimization_passes::h8914b8bf00cb929a
  18:        0x1077bbaad - rustc_mir::transform::optimized_mir::ha7de39a4cf9f4a5b
  19:        0x107b21373 - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::optimized_mir>::compute::h42faf9beb2921343
  20:        0x107a79149 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::had2b2adaaca5ae3e
  21:        0x107b7ac08 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::hdb5c7e7885571969
  22:        0x107b4f5bc - rustc_query_system::query::plumbing::get_query::h7ee3cf724a5d148d
  23:        0x107b16872 - rustc_metadata::rmeta::encoder::EncodeContext::encode_optimized_mir::he774ebbbf385ac39
  24:        0x107b1739a - <rustc_metadata::rmeta::encoder::EncodeContext as rustc_hir::intravisit::Visitor>::visit_expr::h1d09417378a8e4e0
  25:        0x107b860cf - rustc_hir::intravisit::walk_expr::h37385670f6547fc0
  26:        0x107b1717c - <rustc_metadata::rmeta::encoder::EncodeContext as rustc_hir::intravisit::Visitor>::visit_expr::h1d09417378a8e4e0
  27:        0x107b85a25 - rustc_hir::intravisit::walk_fn::h935265b2fbb3e35a
  28:        0x107b8680e - rustc_hir::intravisit::walk_item::ha1cfa26dbfa4ca6f
  29:        0x107b1786f - <rustc_metadata::rmeta::encoder::EncodeContext as rustc_hir::intravisit::Visitor>::visit_item::h8fa511149a8b9845
  30:        0x107ad7046 - rustc_hir::hir::Crate::visit_all_item_likes::hb510a1643aca4d80
  31:        0x107b1da7b - rustc_metadata::rmeta::encoder::encode_metadata_impl::hd10c91e6f0356ac2
  32:        0x107b9fc41 - rustc_data_structures::sync::join::he7dd775e0f210822
  33:        0x107bb54f3 - rustc_metadata::rmeta::decoder::cstore_impl::<impl rustc_middle::middle::cstore::CrateStore for rustc_metadata::creader::CStore>::encode_metadata::hade3754e7cd7f82e
  34:        0x10838bca4 - rustc_middle::ty::context::TyCtxt::encode_metadata::ha4b006894b0490da
  35:        0x104eef0ad - rustc_interface::passes::start_codegen::h883662f922a42a2b
  36:        0x104e4840b - rustc_middle::ty::context::tls::enter_global::heca5eb3952d054ea
  37:        0x104f25873 - rustc_interface::queries::Queries::ongoing_codegen::h7dce60ab7d36285f
  38:        0x104d310ef - rustc_interface::interface::run_compiler_in_existing_thread_pool::h941b4802c24f9c9f
  39:        0x104bdd499 - scoped_tls::ScopedKey<T>::set::h19bc66da3554c573
  40:        0x104bdabf5 - rustc_ast::attr::with_globals::hc6f50c98b5adfc21
  41:        0x104be3490 - std::sys_common::backtrace::__rust_begin_short_backtrace::hbdd06d733493d2c5
  42:        0x104d32e9c - core::ops::function::FnOnce::call_once{{vtable.shim}}::hbf0703c87d11ebad
  43:        0x10b14137e - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h63df79cdef197011
  44:        0x10b173786 - std::sys::unix::thread::Thread::new::thread_start::ha540b6bb74f6bd73
  45:     0x7fff70077109 - _ZL12preoptimized

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.44.0-nightly (ce93331e2 2020-04-17) running on x86_64-apple-darwin

note: compiler flags: -C panic=abort -C debuginfo=2 -C incremental --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [optimized_mir] processing `peer::coordinator::read_known_peers::{{closure}}#0`
end of query stack
error: aborting due to previous error

error: could not compile `MY_CRATE`.

@jonas-schievink
Copy link
Member

jonas-schievink commented May 29, 2020

Because of this:

let allowed = match interior.kind {
ty::GeneratorWitness(s) => tcx.erase_late_bound_regions(&s),
_ => bug!(),
};

@estebank
Copy link
Contributor

estebank commented May 29, 2020

Ok, so this is a pre-existing bug, not introduced in the PR I linked.

@estebank
Copy link
Contributor

estebank commented May 29, 2020

I thought that only a GeneratorWitness would be expected there, but according to the query stack there's a [type error] there? I guess we need a delay_span_bug instead of a bug!() then.

Sadly we need to account for TyErr everywhere where you fail if you expect something else. delay_span_bug is appropriate because an error will have been emitted already.

@tmandry tmandry added this to On deck in wg-async work via automation Jun 2, 2020
@tmandry tmandry added the AsyncAwait-Triaged label Jun 2, 2020
@tmandry tmandry moved this from On deck to In progress in wg-async work Jun 2, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Jun 5, 2020
…stebank

Be more careful around ty::Error in generators

cc rust-lang#72685

(doesn't close it because it's missing a reproduction to use as a test case)

r? @estebank
RalfJung added a commit to RalfJung/rust that referenced this issue Jun 6, 2020
…stebank

Be more careful around ty::Error in generators

cc rust-lang#72685

(doesn't close it because it's missing a reproduction to use as a test case)

r? @estebank
RalfJung added a commit to RalfJung/rust that referenced this issue Jun 6, 2020
…stebank

Be more careful around ty::Error in generators

cc rust-lang#72685

(doesn't close it because it's missing a reproduction to use as a test case)

r? @estebank
RalfJung added a commit to RalfJung/rust that referenced this issue Jun 6, 2020
…stebank

Be more careful around ty::Error in generators

cc rust-lang#72685

(doesn't close it because it's missing a reproduction to use as a test case)

r? @estebank
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Jun 7, 2020
…stebank

Be more careful around ty::Error in generators

cc rust-lang#72685

(doesn't close it because it's missing a reproduction to use as a test case)

r? @estebank
@jonas-schievink
Copy link
Member

jonas-schievink commented Jun 13, 2020

@Thomasdezeeuw can you check this again on a current nightly? It should be fixed.

@Thomasdezeeuw
Copy link
Contributor Author

Thomasdezeeuw commented Jun 14, 2020

@jonas-schievink Not sure if its the same problem but I got another impossible case:

error: internal compiler error: src/librustc_mir/transform/generator.rs:1225: impossible case reached

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:907:9
stack backtrace:
   0:        0x10b0da7ae - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h663935c3ade921d4
   1:        0x10b113f0c - core::fmt::write::h45a9bd04db15c24f
   2:        0x10b0cc2a7 - std::io::Write::write_fmt::h0e6cabb1f767eb66
   3:        0x10b0df2e5 - std::panicking::default_hook::{{closure}}::h45f8ee2074ad82b4
   4:        0x10b0df022 - std::panicking::default_hook::hd48caf78d696bd9a
   5:        0x10b80d9c8 - rustc_driver::report_ice::h20209cc7d5e9b721
   6:        0x10b0df935 - std::panicking::rust_panic_with_hook::h468218923d76a6d7
   7:        0x10fc37886 - std::panicking::begin_panic::h6f663bec8c63636d
   8:        0x10f8459f7 - rustc_errors::HandlerInner::bug::hcf0983b48acbbacf
   9:        0x10f844337 - rustc_errors::Handler::bug::h2d11699c9caf6729
  10:        0x10f4801f9 - rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}::h6df69a2a3dd903a9
  11:        0x10f4781e6 - rustc_middle::ty::context::tls::with_opt::{{closure}}::h08953dcab9277843
  12:        0x10f47816b - rustc_middle::ty::context::tls::with_opt::h3ea04b0ab6091eff
  13:        0x10f480108 - rustc_middle::util::bug::opt_span_bug_fmt::h5a2e586f8e52e067
  14:        0x10fc2130b - rustc_middle::util::bug::bug_fmt::h0e03d94765b73e41
  15:        0x10e4c0bcc - <rustc_mir::transform::generator::StateTransform as rustc_mir::transform::MirPass>::run_pass::h3ef22c1710d372cd
  16:        0x10e66e996 - rustc_mir::transform::run_passes::hd42a628b56c379fa
  17:        0x10e670048 - rustc_mir::transform::run_optimization_passes::h7aaac24e50e622f9
  18:        0x10e670337 - rustc_mir::transform::optimized_mir::h42c99d0a316f684f
  19:        0x10e9348fb - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::optimized_mir>::compute::ha47e246c174bdb06
  20:        0x10ea182c8 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::h6415c816156b8a28
  21:        0x10eabb2f2 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::hc594217cb7a84d83
  22:        0x10eae3254 - rustc_data_structures::stack::ensure_sufficient_stack::h127eb72d4b2f7a5e
  23:        0x10eaa0dfe - rustc_query_system::query::plumbing::get_query_impl::hf23da1e9f1218c25
  24:        0x10e945f99 - rustc_metadata::rmeta::encoder::EncodeContext::encode_optimized_mir::h1f1755936c71f94a
  25:        0x10e946d39 - <rustc_metadata::rmeta::encoder::EncodeContext as rustc_hir::intravisit::Visitor>::visit_expr::h930b558cca40452a
  26:        0x10eafbf9f - rustc_hir::intravisit::walk_expr::h61856d0f7e90f3d9
  27:        0x10e946a2a - <rustc_metadata::rmeta::encoder::EncodeContext as rustc_hir::intravisit::Visitor>::visit_expr::h930b558cca40452a
  28:        0x10eafb7b5 - rustc_hir::intravisit::walk_fn::h16f7cd7c49739edc
  29:        0x10eafc754 - rustc_hir::intravisit::walk_item::h5c459e923d44349a
  30:        0x10e9472ef - <rustc_metadata::rmeta::encoder::EncodeContext as rustc_hir::intravisit::Visitor>::visit_item::h677f6dc9c4004353
  31:        0x10eafd546 - rustc_hir::hir::Crate::visit_all_item_likes::h804ca1112e64a269
  32:        0x10e94eee5 - rustc_metadata::rmeta::encoder::encode_metadata_impl::he7196de0938d43b1
  33:        0x10ea2de0f - rustc_data_structures::sync::join::h4f6a3d1460736199
  34:        0x10e97bb54 - rustc_metadata::rmeta::decoder::cstore_impl::<impl rustc_middle::middle::cstore::CrateStore for rustc_metadata::creader::CStore>::encode_metadata::h9b154f4f413b549a
  35:        0x10f476c24 - rustc_middle::ty::context::TyCtxt::encode_metadata::h9900cc31cdbd1748
  36:        0x10b98528a - rustc_interface::passes::start_codegen::he1887f2bb9a360fe
  37:        0x10b9a3648 - rustc_middle::ty::context::tls::enter_global::h5234796652c04bbe
  38:        0x10b98f2ab - rustc_interface::queries::Queries::ongoing_codegen::h8127070cc894d6fb
  39:        0x10b81693d - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::hb63f149f7d127d23
  40:        0x10b877c91 - rustc_span::with_source_map::hff02123913f3c9fc
  41:        0x10b818b17 - rustc_interface::interface::run_compiler_in_existing_thread_pool::hfade9e67fe3dc88a
  42:        0x10b80f499 - scoped_tls::ScopedKey<T>::set::ha23c73df790e47d2
  43:        0x10b819bbd - std::sys_common::backtrace::__rust_begin_short_backtrace::hebfd2a8940a25d1c
  44:        0x10b7f9f3c - core::ops::function::FnOnce::call_once{{vtable.shim}}::h302f2854e9369da4
  45:        0x10b0edb0d - std::sys::unix::thread::Thread::new::thread_start::h15652ee16771ed61
  46:     0x7fff67dba109 - _ZL12preoptimized

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.46.0-nightly (feb3536eb 2020-06-09) running on x86_64-apple-darwin

note: compiler flags: -C panic=abort -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [optimized_mir] optimizing MIR for `module::{{closure}}#0`
end of query stack
error: aborting due to previous error

error: could not compile `MY_CRATE`.

To learn more, run the command again with --verbose.

Rust version: rustc 1.46.0-nightly (feb3536eb 2020-06-09).

@jonas-schievink
Copy link
Member

jonas-schievink commented Jun 14, 2020

Thanks, opened #73339 to try to fix this one too.

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Jun 15, 2020
Don't run generator transform when there's a TyErr

Not sure if this might cause any problems later on, but we shouldn't be hitting codegen or const eval for the produced MIR anyways, so it should be fine.

cc rust-lang#72685 (comment)
Manishearth added a commit to Manishearth/rust that referenced this issue Jun 16, 2020
Don't run generator transform when there's a TyErr

Not sure if this might cause any problems later on, but we shouldn't be hitting codegen or const eval for the produced MIR anyways, so it should be fine.

cc rust-lang#72685 (comment)
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Jun 16, 2020
Don't run generator transform when there's a TyErr

Not sure if this might cause any problems later on, but we shouldn't be hitting codegen or const eval for the produced MIR anyways, so it should be fine.

cc rust-lang#72685 (comment)
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Jun 16, 2020
Don't run generator transform when there's a TyErr

Not sure if this might cause any problems later on, but we shouldn't be hitting codegen or const eval for the produced MIR anyways, so it should be fine.

cc rust-lang#72685 (comment)
@jonas-schievink
Copy link
Member

jonas-schievink commented Jun 22, 2020

@Thomasdezeeuw Now that #73339 has landed, could you check this again?

@Thomasdezeeuw
Copy link
Contributor Author

Thomasdezeeuw commented Jun 26, 2020

@jonas-schievink The compiler now outputs a bit more information, but still panics. However I think I have a reproducer now:

fn main() {
    println!("Hello, world!");
}

const FN_PTR: fn(_, _) -> _ = my_fn as fn(_, _) -> _;

async fn my_fn(_a: usize, _b: usize) -> Result<(), ()> {
    Ok(())
}

Note that I'm not 100% this triggered the original ICEs, but this at least triggers the following one:

error: internal compiler error: bad_placeholder_type
 --> src/main.rs:7:27
  |
7 | const FN_PTR: fn(_, _) -> _ = my_fn as fn(_, _) -> _;
  |                           ^
  |
  = note: delayed at /rustc/50fc24d8a172a853b5dfe40702d6550e3b8562ba/src/librustc_session/session.rs:436:27

error: internal compiler error: bad_placeholder_type
 --> src/main.rs:7:18
  |
7 | const FN_PTR: fn(_, _) -> _ = my_fn as fn(_, _) -> _;
  |                  ^
  |
  = note: delayed at /rustc/50fc24d8a172a853b5dfe40702d6550e3b8562ba/src/librustc_session/session.rs:436:27

error: internal compiler error: bad_placeholder_type
 --> src/main.rs:7:21
  |
7 | const FN_PTR: fn(_, _) -> _ = my_fn as fn(_, _) -> _;
  |                     ^
  |
  = note: delayed at /rustc/50fc24d8a172a853b5dfe40702d6550e3b8562ba/src/librustc_session/session.rs:436:27

error: internal compiler error: TyKind::Error constructed but no error reported
  |
  = note: delayed at /rustc/50fc24d8a172a853b5dfe40702d6550e3b8562ba/src/librustc_session/session.rs:436:27

error: internal compiler error: cat_expr Errd
 --> src/main.rs:7:31
  |
7 | const FN_PTR: fn(_, _) -> _ = my_fn as fn(_, _) -> _;
  |                               ^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: delayed at /rustc/50fc24d8a172a853b5dfe40702d6550e3b8562ba/src/librustc_session/session.rs:436:27

error: internal compiler error: cat_expr Errd
 --> src/main.rs:1:11
  |
1 |   fn main() {
  |  ___________^
2 | |     println!("Hello, world!");
3 | |     drop(FN_PTR);
4 | |     drop(my_fn);
5 | | }
  | |_^
  |
  = note: delayed at /rustc/50fc24d8a172a853b5dfe40702d6550e3b8562ba/src/librustc_session/session.rs:436:27

error: internal compiler error: cat_expr Errd
 --> src/main.rs:3:5
  |
3 |     drop(FN_PTR);
  |     ^^^^
  |
  = note: delayed at /rustc/50fc24d8a172a853b5dfe40702d6550e3b8562ba/src/librustc_session/session.rs:436:27

error: internal compiler error: cat_expr Errd
 --> src/main.rs:3:10
  |
3 |     drop(FN_PTR);
  |          ^^^^^^
  |
  = note: delayed at /rustc/50fc24d8a172a853b5dfe40702d6550e3b8562ba/src/librustc_session/session.rs:436:27

error: internal compiler error: PromoteTemps: MIR had errors
 --> src/main.rs:1:1
  |
1 | / fn main() {
2 | |     println!("Hello, world!");
3 | |     drop(FN_PTR);
4 | |     drop(my_fn);
5 | | }
  | |_^
  |
  = note: delayed at /rustc/50fc24d8a172a853b5dfe40702d6550e3b8562ba/src/librustc_session/session.rs:436:27

error: internal compiler error: broken MIR in DefId(0:3 ~ test[e008]::main[0]) ("return type"): bad type [type error]
 --> src/main.rs:1:1
  |
1 | / fn main() {
2 | |     println!("Hello, world!");
3 | |     drop(FN_PTR);
4 | |     drop(my_fn);
5 | | }
  | |_^
  |
  = note: delayed at src/librustc_mir/borrow_check/type_check/mod.rs:258:27

error: internal compiler error: broken MIR in DefId(0:3 ~ test[e008]::main[0]) (LocalDecl { mutability: Mut, local_info: None, internal: false, is_block_tail: None, ty: [type error], user_ty: None, source_info: SourceInfo { span: src/main.rs:1:1: 5:2 (#0), scope: scope[0] } }): bad type [type error]
 --> src/main.rs:1:1
  |
1 | / fn main() {
2 | |     println!("Hello, world!");
3 | |     drop(FN_PTR);
4 | |     drop(my_fn);
5 | | }
  | |_^
  |
  = note: delayed at src/librustc_mir/borrow_check/type_check/mod.rs:258:27

error: internal compiler error: mir_const_qualif: MIR had errors
 --> src/main.rs:7:1
  |
7 | const FN_PTR: fn(_, _) -> _ = my_fn as fn(_, _) -> _;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: delayed at /rustc/50fc24d8a172a853b5dfe40702d6550e3b8562ba/src/librustc_session/session.rs:436:27

error: internal compiler error: PromoteTemps: MIR had errors
 --> src/main.rs:7:1
  |
7 | const FN_PTR: fn(_, _) -> _ = my_fn as fn(_, _) -> _;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: delayed at /rustc/50fc24d8a172a853b5dfe40702d6550e3b8562ba/src/librustc_session/session.rs:436:27

error: internal compiler error: broken MIR in DefId(0:4 ~ test[e008]::FN_PTR[0]) ("return type"): bad type [type error]
 --> src/main.rs:7:1
  |
7 | const FN_PTR: fn(_, _) -> _ = my_fn as fn(_, _) -> _;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: delayed at src/librustc_mir/borrow_check/type_check/mod.rs:258:27

error: internal compiler error: broken MIR in DefId(0:4 ~ test[e008]::FN_PTR[0]) (LocalDecl { mutability: Mut, local_info: None, internal: false, is_block_tail: None, ty: [type error], user_ty: None, source_info: SourceInfo { span: src/main.rs:7:1: 7:54 (#0), scope: scope[0] } }): bad type [type error]
 --> src/main.rs:7:1
  |
7 | const FN_PTR: fn(_, _) -> _ = my_fn as fn(_, _) -> _;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: delayed at src/librustc_mir/borrow_check/type_check/mod.rs:258:27

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:367:17
stack backtrace:
   0:        0x10834cd4e - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h13e6f26430148ff2
   1:        0x10838632c - core::fmt::write::h45a9bd04db15c24f
   2:        0x10833e567 - std::io::Write::write_fmt::h8ae61696f13218d5
   3:        0x108351885 - std::panicking::default_hook::{{closure}}::hc98fe2390b6284e5
   4:        0x1083515c2 - std::panicking::default_hook::h9a63cea866a4c14a
   5:        0x10139c988 - rustc_driver::report_ice::h6811b1f05e3fd746
   6:        0x108351ed5 - std::panicking::rust_panic_with_hook::h4d446ca45c8e1faa
   7:        0x105822abd - std::panicking::begin_panic::hba65cd1eb2ce6d69
   8:        0x105429e3f - <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop::h3a03d7831429fa48
   9:        0x1013d92ca - core::ptr::drop_in_place::he612e23a92ff1daf
  10:        0x1013dd728 - <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop::h86e165f15f416390
  11:        0x1013f3532 - core::ptr::drop_in_place::h6c089220cd3fa404
  12:        0x1013e92be - rustc_span::with_source_map::hcb5ea084b59b822f
  13:        0x101363d1a - rustc_interface::interface::run_compiler_in_existing_thread_pool::h4842a91ac763f9d6
  14:        0x101389479 - scoped_tls::ScopedKey<T>::set::haf496b5dd75c374f
  15:        0x1013a0cc2 - std::sys_common::backtrace::__rust_begin_short_backtrace::hac103380d443010e
  16:        0x10136acac - core::ops::function::FnOnce::call_once{{vtable.shim}}::hce68202ad15837a7
  17:        0x10835ff2d - std::sys::unix::thread::Thread::new::thread_start::h545d31fdf79b3d9e
  18:     0x7fff72d67109 - _ZL12preoptimized

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/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.46.0-nightly (50fc24d8a 2020-06-25) running on x86_64-apple-darwin

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `test`.

To learn more, run the command again with --verbose.

@jonas-schievink jonas-schievink removed their assignment Jun 28, 2020
@tmandry tmandry moved this from In progress to On deck in wg-async work Jul 28, 2020
@tmandry
Copy link
Contributor

tmandry commented Oct 20, 2020

The reproducer above doesn't ICE anymore. Leaving this open to track adding a regression test.

@rustbot modify labels: +E-easy +E-help-wanted

@rustbot rustbot added E-easy E-help-wanted labels Oct 20, 2020
@0yoyoyo
Copy link
Contributor

0yoyoyo commented Jan 28, 2021

Is the task of this issue addition of a regression test? If so, I'll try it. I found a simpler reproducer.
Does the regression test just check outputting the current error message?

pub const FOO: fn() -> _ = 1;

fn main() {}
1.46.0 Output
error: internal compiler error: bad_placeholder_type
 --> main.rs:1:24
  |
1 | pub const FOO: fn() -> _ = 1;
  |                        ^
  |
  = note: delayed at /rustc/04488afe34512aa4c33566eb16d8c912a3ae04f9/src/librustc_session/session.rs:436:27

error: internal compiler error: TyKind::Error constructed but no error reported
  |
  = note: delayed at /rustc/04488afe34512aa4c33566eb16d8c912a3ae04f9/src/librustc_session/session.rs:436:27

error: internal compiler error: mir_const_qualif: MIR had errors
 --> main.rs:1:1
  |
1 | pub const FOO: fn() -> _ = 1;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: delayed at /rustc/04488afe34512aa4c33566eb16d8c912a3ae04f9/src/librustc_session/session.rs:436:27

error: internal compiler error: PromoteTemps: MIR had errors
 --> main.rs:1:1
  |
1 | pub const FOO: fn() -> _ = 1;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: delayed at /rustc/04488afe34512aa4c33566eb16d8c912a3ae04f9/src/librustc_session/session.rs:436:27

error: internal compiler error: broken MIR in DefId(0:3 ~ main[317d]::FOO[0]) ("return type"): bad type [type error]
 --> main.rs:1:1
  |
1 | pub const FOO: fn() -> _ = 1;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: delayed at src/librustc_mir/borrow_check/type_check/mod.rs:258:27

error: internal compiler error: broken MIR in DefId(0:3 ~ main[317d]::FOO[0]) (LocalDecl { mutability: Mut, local_info: None, internal: false, is_block_tail: None, ty: [type error], user_ty: None, source_info: SourceInfo { span: main.rs:1:1: 1:30 (#0), scope: scope[0] } }): bad type [type error]
 --> main.rs:1:1
  |
1 | pub const FOO: fn() -> _ = 1;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: delayed at src/librustc_mir/borrow_check/type_check/mod.rs:258:27

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:367:17
stack backtrace:
   0:     0x7f8122b8c925 - backtrace::backtrace::libunwind::trace::h14d338b30b3ea0a7
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
   1:     0x7f8122b8c925 - backtrace::backtrace::trace_unsynchronized::h73ea91d74a3fd67f
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
   2:     0x7f8122b8c925 - std::sys_common::backtrace::_print_fmt::hd42948c952866e12
                               at src/libstd/sys_common/backtrace.rs:78
   3:     0x7f8122b8c925 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::ha8f928866ff7571e
                               at src/libstd/sys_common/backtrace.rs:59
   4:     0x7f8122bc93ac - core::fmt::write::he0c1e5f7426d2718
                               at src/libcore/fmt/mod.rs:1076
   5:     0x7f8122b7e6a2 - std::io::Write::write_fmt::hf3afc6cfd57d0033
                               at src/libstd/io/mod.rs:1537
   6:     0x7f8122b917c0 - std::sys_common::backtrace::_print::hfc0110703f3696fd
                               at src/libstd/sys_common/backtrace.rs:62
   7:     0x7f8122b917c0 - std::sys_common::backtrace::print::h3f77c6990ddfaa22
                               at src/libstd/sys_common/backtrace.rs:49
   8:     0x7f8122b917c0 - std::panicking::default_hook::{{closure}}::heae49580a8d62d75
                               at src/libstd/panicking.rs:198
   9:     0x7f8122b9150c - std::panicking::default_hook::hecc34e3f729e213c
                               at src/libstd/panicking.rs:217
  10:     0x7f81232fc2e9 - rustc_driver::report_ice::h3be30985e3a52e6d
  11:     0x7f8122b91f38 - std::panicking::rust_panic_with_hook::he82f5d0644692441
                               at src/libstd/panicking.rs:530
  12:     0x7f8125e4d49e - std::panicking::begin_panic::h58c374fa2c754653
  13:     0x7f8125e811f2 - <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop::hd1d9bbded6f728fa
  14:     0x7f812333e4f6 - core::ptr::drop_in_place::h9f5d87bb2860130d
  15:     0x7f81233451a6 - <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop::h4621d3ee5e7200ec
  16:     0x7f812335a56d - core::ptr::drop_in_place::h475f04886ae24548
  17:     0x7f8123355abb - rustc_span::with_source_map::h8932c000c7b08879
  18:     0x7f81232b7826 - rustc_interface::interface::create_compiler_and_run::h442b6cbb52362b36
  19:     0x7f81232e1f1d - scoped_tls::ScopedKey<T>::set::h8938bb49c90cd057
  20:     0x7f8123308272 - std::sys_common::backtrace::__rust_begin_short_backtrace::hde285eb3c6f4aaa5
  21:     0x7f81232c570e - core::ops::function::FnOnce::call_once{{vtable.shim}}::hbbf6021168227a97
  22:     0x7f8122ba0cfa - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::hd2b3bc04af94a84f
                               at /rustc/04488afe34512aa4c33566eb16d8c912a3ae04f9/src/liballoc/boxed.rs:1081
  23:     0x7f8122ba0cfa - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h1044417e186e567a
                               at /rustc/04488afe34512aa4c33566eb16d8c912a3ae04f9/src/liballoc/boxed.rs:1081
  24:     0x7f8122ba0cfa - std::sys::unix::thread::Thread::new::thread_start::h276e6ca033938925
                               at src/libstd/sys/unix/thread.rs:87
  25:     0x7f8122ae1fa3 - start_thread
                               at /build/glibc-vjB4T1/glibc-2.28/nptl/pthread_create.c:486
  26:     0x7f8122a034cf - clone
                               at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
  27:                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/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.46.0 (04488afe3 2020-08-24) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
Current stable (1.49.0) Output
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
 --> main.rs:1:24
  |
1 | pub const FOO: fn() -> _ = 1;
  |                        ^
  |                        |
  |                        not allowed in type signatures
  |                        help: use type parameters instead: `T`

error: aborting due to previous error

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

@0yoyoyo
Copy link
Contributor

0yoyoyo commented Jan 29, 2021

@rustbot claim

@estebank
Copy link
Contributor

estebank commented Jan 29, 2021

Does the regression test just check outputting the current error message?

Yes.

jonas-schievink added a commit to jonas-schievink/rust that referenced this issue Jan 31, 2021
…-place, r=estebank

Add a regression test for ICE of bad_placeholder_type

Add a regression test for rust-lang#72685. Check the error message is output instead of ICE.
@Thomasdezeeuw
Copy link
Contributor Author

Thomasdezeeuw commented Feb 6, 2021

Considering #81509 is merged, I think this can be closed.

wg-async work automation moved this from On deck to Done Feb 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-async-await A-generators AsyncAwait-Triaged C-bug E-easy E-help-wanted E-needs-mcve I-ICE T-compiler
Projects
Development

No branches or pull requests

6 participants