Skip to content

Unexpected panic in rustc with async_stream #69355

Closed
@swilcox3

Description

@swilcox3

I got this rustc panic when trying to compile:

thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: DistinctSources(DistinctSources { begin: (Real("operations\\test-ops-client\\src\\main.rs"), BytePos(0)), end: (Macros("::async_stream::stream"), BytePos(9989972)) })', src\libcore\result.rs:1165:5
stack backtrace:
   0:     0x7ffaf8df5609 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h3466f2fd722d78c7
   1:     0x7ffaf8e2391b - core::fmt::write::h2e5f3c8207405fe6
   2:     0x7ffaf8de8b24 - <std::io::IoSliceMut as core::fmt::Debug>::fmt::hd136e41cddf77af8
   3:     0x7ffaf8df9c19 - std::panicking::take_hook::h5e35238a75e1277c
   4:     0x7ffaf8df986c - std::panicking::take_hook::h5e35238a75e1277c
   5:     0x7ffacd3324a4 - rustc_driver::report_ice::h60b444f19204d6f2
   6:     0x7ffaf8dfa491 - std::panicking::rust_panic_with_hook::hf321b2839bff13c6
   7:     0x7ffaf8df9fe0 - std::panicking::begin_panic_fmt::h21e799b306cf0414
   8:     0x7ffaf8df9ec9 - rust_begin_unwind
   9:     0x7ffaf8e1cdad - core::panicking::panic_fmt::hf55c59c691ea5230
  10:     0x7ffaf8e1cfff - core::result::unwrap_failed::hb4c9c636ae774cad
  11:     0x7ffacef762fe - rustc_errors::emitter::is_case_difference::h091da5cba1b96b51
  12:     0x7ffacef68c70 - rustc_errors::emitter::HumanReadableErrorType::new_emitter::hca9c55c355516f51
  13:     0x7ffacef6a395 - <rustc_errors::emitter::EmitterWriter as rustc_errors::emitter::Emitter>::emit_diagnostic::h808a35aa83193d2a
  14:     0x7ffaced6d7a3 - <syntax::json::JsonEmitter as rustc_errors::emitter::Emitter>::emit_diagnostic::h351ab0a60aa6a89e
  15:     0x7ffacef647ea - rustc_errors::HandlerInner::emit_diagnostic::h1a8d795d29bc338e
  16:     0x7ffacef66695 - rustc_errors::diagnostic_builder::DiagnosticBuilder::emit::h3428ff13eb123a61
  17:     0x7ffacd9b5448 - rustc_typeck::check::demand::<impl rustc_typeck::check::FnCtxt>::demand_coerce::h43d05335ebaf7db6
  18:     0x7ffacd9c06da - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::ha50a9bce1da0e041
  19:     0x7ffacd9bac4e - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::ha50a9bce1da0e041
  20:     0x7ffacd9f8ab3 - rustc_typeck::check::FnCtxt::self_type_matches_expected_vid::h7fe56008994db4e9
  21:     0x7ffacd9dee07 - rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::check_call::h5564bd803335aae4
  22:     0x7ffacd9dce25 - rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::check_call::h5564bd803335aae4
  23:     0x7ffacd9bb75b - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::ha50a9bce1da0e041
  24:     0x7ffacd9bac4e - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::ha50a9bce1da0e041
  25:     0x7ffacd9c06c3 - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::ha50a9bce1da0e041
  26:     0x7ffacd9bac4e - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::ha50a9bce1da0e041
  27:     0x7ffacd9f8ab3 - rustc_typeck::check::FnCtxt::self_type_matches_expected_vid::h7fe56008994db4e9
  28:     0x7ffacd9f6dfc - rustc_typeck::check::FnCtxt::field_ty::h7ef132d44fc79116
  29:     0x7ffacd9beeff - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::ha50a9bce1da0e041
  30:     0x7ffacd9bac4e - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::ha50a9bce1da0e041
  31:     0x7ffacd9a5332 - rustc_typeck::check::_match::<impl rustc_typeck::check::FnCtxt>::check_match::h3d8321df124299a8
  32:     0x7ffacd9bbca5 - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::ha50a9bce1da0e041
  33:     0x7ffacd9bac4e - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::ha50a9bce1da0e041
  34:     0x7ffacd9fbfe9 - rustc_typeck::check::FnCtxt::check_stmt::hcff3dc6a1015e719
  35:     0x7ffacd9fc726 - rustc_typeck::check::FnCtxt::check_block_no_value::h30619d76466cd3f8
  36:     0x7ffacd9bb772 - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::ha50a9bce1da0e041
  37:     0x7ffacd9bac4e - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::ha50a9bce1da0e041
  38:     0x7ffacd9fc764 - rustc_typeck::check::FnCtxt::check_block_no_value::h30619d76466cd3f8
  39:     0x7ffacd9bb772 - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::ha50a9bce1da0e041
  40:     0x7ffacd9bac4e - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::ha50a9bce1da0e041
  41:     0x7ffacd9c8b8e - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::ha50a9bce1da0e041
  42:     0x7ffacd9e68bf - <rustc_typeck::check::GatherLocalsVisitor as rustc::hir::intravisit::Visitor>::visit_pat::h4c7251dcac30d4e1
  43:     0x7ffacd9da694 - rustc_typeck::check::closure::<impl rustc_typeck::check::FnCtxt>::check_expr_closure::h0fea02b47d7c163f
  44:     0x7ffacd9bb392 - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::ha50a9bce1da0e041
  45:     0x7ffacd9bac4e - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::ha50a9bce1da0e041
  46:     0x7ffacd9f8ab3 - rustc_typeck::check::FnCtxt::self_type_matches_expected_vid::h7fe56008994db4e9
  47:     0x7ffacd9dee07 - rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::check_call::h5564bd803335aae4
  48:     0x7ffacd9dce25 - rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::check_call::h5564bd803335aae4
  49:     0x7ffacd9bb75b - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::ha50a9bce1da0e041
  50:     0x7ffacd9bac4e - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::ha50a9bce1da0e041
  51:     0x7ffacd9f8ab3 - rustc_typeck::check::FnCtxt::self_type_matches_expected_vid::h7fe56008994db4e9
  52:     0x7ffacd9dee07 - rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::check_call::h5564bd803335aae4
  53:     0x7ffacd9dce25 - rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::check_call::h5564bd803335aae4
  54:     0x7ffacd9bb75b - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::ha50a9bce1da0e041
  55:     0x7ffacd9bac4e - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::ha50a9bce1da0e041
  56:     0x7ffacd9fc764 - rustc_typeck::check::FnCtxt::check_block_no_value::h30619d76466cd3f8
  57:     0x7ffacd9bb772 - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::ha50a9bce1da0e041
  58:     0x7ffacd9bac4e - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::ha50a9bce1da0e041
  59:     0x7ffacd9fb943 - rustc_typeck::check::FnCtxt::check_decl_initializer::h0ca814ce9278e422
  60:     0x7ffacd9fb9ec - rustc_typeck::check::FnCtxt::check_decl_local::he78cc21692c86e5b
  61:     0x7ffacd9fbe03 - rustc_typeck::check::FnCtxt::check_stmt::hcff3dc6a1015e719
  62:     0x7ffacd9fc726 - rustc_typeck::check::FnCtxt::check_block_no_value::h30619d76466cd3f8
  63:     0x7ffacd9bb772 - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::ha50a9bce1da0e041
  64:     0x7ffacd9bac4e - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::ha50a9bce1da0e041
  65:     0x7ffacd9bb3ae - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::ha50a9bce1da0e041
  66:     0x7ffacd9bac4e - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::ha50a9bce1da0e041
  67:     0x7ffacd9fc764 - rustc_typeck::check::FnCtxt::check_block_no_value::h30619d76466cd3f8
  68:     0x7ffacd9bb772 - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::ha50a9bce1da0e041
  69:     0x7ffacd9bac4e - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::ha50a9bce1da0e041
  70:     0x7ffacd9c8b8e - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::ha50a9bce1da0e041
  71:     0x7ffacd9e68bf - <rustc_typeck::check::GatherLocalsVisitor as rustc::hir::intravisit::Visitor>::visit_pat::h4c7251dcac30d4e1
  72:     0x7ffacd9da694 - rustc_typeck::check::closure::<impl rustc_typeck::check::FnCtxt>::check_expr_closure::h0fea02b47d7c163f
  73:     0x7ffacd9bb392 - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::ha50a9bce1da0e041
  74:     0x7ffacd9bac4e - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::ha50a9bce1da0e041
  75:     0x7ffacd9f8ab3 - rustc_typeck::check::FnCtxt::self_type_matches_expected_vid::h7fe56008994db4e9
  76:     0x7ffacd9dee07 - rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::check_call::h5564bd803335aae4
  77:     0x7ffacd9dce25 - rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::check_call::h5564bd803335aae4
  78:     0x7ffacd9bb75b - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::ha50a9bce1da0e041
  79:     0x7ffacd9bac4e - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::ha50a9bce1da0e041
  80:     0x7ffacd9c8b8e - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::ha50a9bce1da0e041
  81:     0x7ffacd9e68bf - <rustc_typeck::check::GatherLocalsVisitor as rustc::hir::intravisit::Visitor>::visit_pat::h4c7251dcac30d4e1
  82:     0x7ffacd93caae - <rustc_typeck::outlives::explicit::ExplicitPredicatesMap as core::fmt::Debug>::fmt::he86427c31a261a0c
  83:     0x7ffacd9e561f - <rustc_typeck::check::CheckItemTypesVisitor as rustc::hir::itemlikevisit::ItemLikeVisitor>::visit_item::h68ee94f62923f0ab
  84:     0x7ffacd87251f - <rustc_typeck::check::autoderef::AutoderefKind as core::fmt::Debug>::fmt::h30c18b8ae1ae903e
  85:     0x7ffacd89b23c - <rustc_typeck::outlives::explicit::ExplicitPredicatesMap as core::fmt::Debug>::fmt::he86427c31a261a0c
  86:     0x7ffacda90920 - <rustc_typeck::variance::test::VarianceTest as rustc::hir::itemlikevisit::ItemLikeVisitor>::visit_item::hfd5a16d343a6a78f
  87:     0x7ffacd8d30d3 - <rustc_typeck::outlives::explicit::ExplicitPredicatesMap as core::fmt::Debug>::fmt::he86427c31a261a0c
  88:     0x7ffacd87251f - <rustc_typeck::check::autoderef::AutoderefKind as core::fmt::Debug>::fmt::h30c18b8ae1ae903e
  89:     0x7ffacd89b23c - <rustc_typeck::outlives::explicit::ExplicitPredicatesMap as core::fmt::Debug>::fmt::he86427c31a261a0c
  90:     0x7ffacda90920 - <rustc_typeck::variance::test::VarianceTest as rustc::hir::itemlikevisit::ItemLikeVisitor>::visit_item::hfd5a16d343a6a78f
  91:     0x7ffacd8d30d3 - <rustc_typeck::outlives::explicit::ExplicitPredicatesMap as core::fmt::Debug>::fmt::he86427c31a261a0c
  92:     0x7ffacd974283 - rustc_typeck::collect::checked_type_of::hdca92e0dbef378db
  93:     0x7ffacd9733fc - <rustc_typeck::collect::has_late_bound_regions::LateBoundRegionsDetector as rustc::hir::intravisit::Visitor>::visit_lifetime::h3e50b77d783b7191
  94:     0x7ffacd8741fc - <rustc_typeck::check::autoderef::AutoderefKind as core::fmt::Debug>::fmt::h30c18b8ae1ae903e
  95:     0x7ffacd89ae3c - <rustc_typeck::outlives::explicit::ExplicitPredicatesMap as core::fmt::Debug>::fmt::he86427c31a261a0c
  96:     0x7ffacda99b20 - <rustc_typeck::variance::test::VarianceTest as rustc::hir::itemlikevisit::ItemLikeVisitor>::visit_item::hfd5a16d343a6a78f
  97:     0x7ffacd9048e4 - <rustc_typeck::outlives::explicit::ExplicitPredicatesMap as core::fmt::Debug>::fmt::he86427c31a261a0c
  98:     0x7ffacda80322 - <rustc_typeck::variance::test::VarianceTest as rustc::hir::itemlikevisit::ItemLikeVisitor>::visit_item::hfd5a16d343a6a78f
  99:     0x7ffacd9541c3 - <rustc_typeck::outlives::explicit::ExplicitPredicatesMap as core::fmt::Debug>::fmt::he86427c31a261a0c
 100:     0x7ffacda87728 - <rustc_typeck::variance::test::VarianceTest as rustc::hir::itemlikevisit::ItemLikeVisitor>::visit_item::hfd5a16d343a6a78f
 101:     0x7ffacd96f661 - <rustc_typeck::collect::CollectItemTypesVisitor as rustc::hir::intravisit::Visitor>::visit_item::h083fc1a618ad5da1
 102:     0x7ffacd875389 - <rustc_typeck::check::autoderef::AutoderefKind as core::fmt::Debug>::fmt::h30c18b8ae1ae903e
 103:     0x7ffacd96ee04 - <rustc_typeck::outlives::explicit::ExplicitPredicatesMap as core::fmt::Debug>::fmt::he86427c31a261a0c
 104:     0x7ffacd87352d - <rustc_typeck::check::autoderef::AutoderefKind as core::fmt::Debug>::fmt::h30c18b8ae1ae903e
 105:     0x7ffacd89b4fc - <rustc_typeck::outlives::explicit::ExplicitPredicatesMap as core::fmt::Debug>::fmt::he86427c31a261a0c
 106:     0x7ffacda927b9 - <rustc_typeck::variance::test::VarianceTest as rustc::hir::itemlikevisit::ItemLikeVisitor>::visit_item::hfd5a16d343a6a78f
 107:     0x7ffacd8e31af - <rustc_typeck::outlives::explicit::ExplicitPredicatesMap as core::fmt::Debug>::fmt::he86427c31a261a0c
 108:     0x7ffacd89bd13 - <rustc_typeck::outlives::explicit::ExplicitPredicatesMap as core::fmt::Debug>::fmt::he86427c31a261a0c
 109:     0x7ffacd8671b7 - rustc_typeck::check_crate::h0c1d8c4e90985630
 110:     0x7ffacd86596d - rustc_typeck::check_crate::h0c1d8c4e90985630
 111:     0x7ffacd40cef2 - rustc_interface::passes::BoxedResolver::to_resolver_outputs::haf1c08e8f06e50a4
 112:     0x7ffacd37db93 - <rustc_driver::Compilation as core::fmt::Debug>::fmt::h95cfe5dcbe5f474b
 113:     0x7ffacd399d2d - <rustc_driver::Compilation as core::fmt::Debug>::fmt::h95cfe5dcbe5f474b
 114:     0x7ffacd30d0bf - <rustc_traits::chalk_context::ChalkContext as chalk_engine::context::ContextOps<rustc_traits::chalk_context::ChalkArenas>>::canonical::hebd46e34a4bbaab5
 115:     0x7ffacd32149d - <syntax_pos::symbol::LocalInternedString as core::fmt::Display>::fmt::hbc988d2f67a63424
 116:     0x7ffacd39b14b - <rustc_driver::Compilation as core::fmt::Debug>::fmt::h95cfe5dcbe5f474b
 117:     0x7ffacd435e9e - rustc_interface::passes::BoxedGlobalCtxt::complete::hd244c8335d3f3c57
 118:     0x7ffacd39af1e - <rustc_driver::Compilation as core::fmt::Debug>::fmt::h95cfe5dcbe5f474b
 119:     0x7ffacd36e51b - <rustc_driver::Compilation as core::fmt::Debug>::fmt::h95cfe5dcbe5f474b
 120:     0x7ffacd351416 - <rustc_driver::Compilation as core::fmt::Debug>::fmt::h95cfe5dcbe5f474b
 121:     0x7ffacd35395f - <rustc_driver::Compilation as core::fmt::Debug>::fmt::h95cfe5dcbe5f474b
 122:     0x7ffacd39256c - <rustc_driver::Compilation as core::fmt::Debug>::fmt::h95cfe5dcbe5f474b
 123:     0x7ffaf8e0c032 - _rust_maybe_catch_panic
 124:     0x7ffacd3931e2 - <rustc_driver::Compilation as core::fmt::Debug>::fmt::h95cfe5dcbe5f474b
 125:     0x7ffaf8dd7ab7 - ZN244_$LT$std..error..$LT$impl$u20$core..convert..From$LT$alloc..string..String$GT$$u20$for$u20$alloc..boxed..Box$LT$dyn$u20$std..error..Error$u2b$core..marker..Send$u2b$core..marker..Sync$GT$$GT$..from..StringError$u20$as$u20$core..fmt..Display$GT$3fmt17
 126:     0x7ffaf8e098f7 - std::sys::windows::thread::Thread::new::h4eef306d20d6310e
 127:     0x7ffb3aba7bd4 - BaseThreadInitThunk
 128:     0x7ffb3b3eced1 - RtlUserThreadStart

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.40.0 (73528e339 2019-12-16) running on x86_64-pc-windows-msvc

note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin
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.40.0 (73528e339 2019-12-16) running on x86_64-pc-windows-msvc

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

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

query stack during panic:
#0 [typeck_tables_of] processing `create_wall`
#1 [typeck_tables_of] processing `create_wall::{{closure}}#0`
#2 [type_of] processing `create_wall::{{closure}}#0`
#3 [collect_mod_item_types] collecting item types in top-level module
#4 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `test_ops_client`.

bug_sample.zip

Simple crate is attached. It's an attempt at generating a tonic client from protobuffer files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-async-awaitArea: Async & AwaitA-type-systemArea: Type systemE-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcE-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ICEBreaker-Cleanup-CrewHelping to "clean up" bugs with minimal examples and bisectionsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions