Skip to content

ICE with generators: Broken MIR: generator contains type ... in MIR, but typeck only knows about ... #44184

Closed
@Eroc33

Description

@Eroc33

This seems to be some sort of interaction with the String inside the Command enum in the following code as removing either variant stops the ICE from occuring.

Example:

https://play.rust-lang.org/?gist=1d2672fd04e7df3dccbaf140f99fa7f6&version=nightly

Gives an ICE internal compiler error: /checkout/src/librustc_mir/transform/generator.rs:340: Broken MIR: generator contains type std::string::String in MIR, but typeck only knows about ((), std::option::Option<Command>, Command)

Meta

rustc --version --verbose:

rustc 1.21.0-nightly (c11f689d2 2017-08-29)
binary: rustc
commit-hash: c11f689d2475dd9ab956e881238d5d7b6b485efb
commit-date: 2017-08-29
host: x86_64-pc-windows-msvc
release: 1.21.0-nightly
LLVM version: 4.0

Backtrace:

error: internal compiler error: src\librustc_mir\transform\generator.rs:340: Broken MIR: generator contains type std::string::String in MIR, but typeck only knows about ((), std::option::Option<Command>, Command)
  --> src\main.rs:15:5
   |
15 | /     move ||{
16 | |         loop{
17 | |             let val = control_interface_next();
18 | |             if let Some(command) = val{
...  |
30 | |         }
31 | |     }
   | |_____^

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.21.0-nightly (c11f689d2 2017-08-29) running on x86_64-pc-windows-msvc

note: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'Box<Any>', src\librustc_errors\lib.rs:443:8
stack backtrace:
   0: _rdl_shrink_in_place
   1: std::panicking::Location::column
   2: std::panicking::Location::column
   3: std::panicking::rust_panic_with_hook
   4: <unknown>
   5: <unknown>
   6: <rustc_mir::shim::DropShimElaborator<'a, 'tcx> as rustc_mir::util::elaborate_drops::DropElaborator<'a, 'tcx>>::clear_drop_flag
   7: <rustc_mir::shim::DropShimElaborator<'a, 'tcx> as rustc_mir::util::elaborate_drops::DropElaborator<'a, 'tcx>>::clear_drop_flag
   8: <rustc_mir::transform::generator::StateTransform as rustc::mir::transform::MirPass>::run_pass
   9: <rustc_mir::shim::DropShimElaborator<'a, 'tcx> as rustc_mir::util::elaborate_drops::DropElaborator<'a, 'tcx>>::get_drop_flag
  10: <rustc_mir::shim::DropShimElaborator<'a, 'tcx> as rustc_mir::util::elaborate_drops::DropElaborator<'a, 'tcx>>::get_drop_flag
  11: rustc::dep_graph::graph::DepGraph::in_task
  12: rustc::ty::maps::<impl rustc::ty::maps::queries::optimized_mir<'tcx>>::try_get
  13: rustc::ty::maps::TyCtxtAt::optimized_mir
  14: rustc::ty::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::instance_mir
  15: <rustc_trans::builder::Builder<'a, 'tcx> as core::ops::drop::Drop>::drop
  16: <rustc_trans::builder::Builder<'a, 'tcx> as core::ops::drop::Drop>::drop
  17: rustc_trans::base::trans_crate
  18: rustc_trans::base::trans_crate
  19: rustc_driver::driver::phase_4_translate_to_llvm
  20: rustc_driver::driver::compile_input
  21: <rustc_driver::derive_registrar::Finder as rustc::hir::itemlikevisit::ItemLikeVisitor<'v>>::visit_impl_item
  22: rustc_driver::driver::compile_input
  23: rustc_driver::run_compiler
  24: <unknown>
  25: _rust_maybe_catch_panic
  26: <rustc_driver::derive_registrar::Finder as rustc::hir::itemlikevisit::ItemLikeVisitor<'v>>::visit_impl_item
  27: std::sys::imp::thread::Thread::new
  28: BaseThreadInitThunk

error: Could not compile `generator_ice`.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlA-coroutinesArea: CoroutinesC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-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