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 in ElaborateDrops with generators #47482

Closed
kazimuth opened this issue Jan 16, 2018 · 0 comments
Closed

ICE in ElaborateDrops with generators #47482

kazimuth opened this issue Jan 16, 2018 · 0 comments
Labels
A-coroutines Area: Coroutines 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.

Comments

@kazimuth
Copy link

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

#![feature(generators)]

use std::rc::Rc;
use std::cell::RefCell;

fn main() {
    let thing: Rc<RefCell<Option<String>>> = Rc::new(RefCell::new(None));

    let _ = || {
        thing.borrow_mut().unwrap();
        yield;
    };
}

Playground currently panics: rustc 1.25.0-nightly (79a521bb9 2018-01-15) running on x86_64-unknown-linux-gnu. My machine also panics, rustc 1.25.0-nightly (e6072a7b3 2018-01-13) on OSX Yosemite.

Without the yield, this (naturally) gives cannot move out of borrowed content.

Stack trace:

thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: (MoveData { move_paths: [MovePath { place: _0 }, MovePath { place: _1 }, MovePath { place: _2 }, MovePath { place: _3 }, MovePath { place: _4 }, MovePath { place: _5 }, MovePath { place: _6 }, MovePath { place: _7 }, MovePath { place: _8 }, MovePath { place: _9 }, MovePath { place: _10 }, MovePath { place: _11 }], moves: [mp9@bb0[8], mp9@bb1[1], mp7@bb1[2], mp1@bb3[0], mp5@bb4[1], mp5@bb5[1], mp7@bb5[2], mp3@bb5[3], mp6@bb6[0], mp2@bb7[0], mp3@bb8[0], mp3@bb9[0], mp3@bb10[0], mp4@bb10[1], mp6@bb10[2], mp6@bb11[0], mp8@bb11[1], mp11@bb11[4], mp11@bb12[1], mp1@bb12[3], mp1@bb13[0], mp0@bb15[0]], loc_map: LocationMap { map: [[[], [], [], [], [], [], [], [], [mo0]], [[], [mo1], [mo2]], [[]], [[mo3]], [[], [mo4]], [[], [mo5], [mo6], [mo7]], [[mo8]], [[mo9]], [[mo10]], [[mo11]], [[mo12], [mo13], [mo14]], [[mo15], [mo16], [], [], [mo17]], [[], [mo18], [], [mo19]], [[mo20]], [[]], [[mo21]]] }, path_map: [[mo21], [mo3, mo19, mo20], [mo9], [mo7, mo10, mo11, mo12], [mo13], [mo4, mo5], [mo8, mo14, mo15], [mo2, mo6], [mo16], [mo0, mo1], [], [mo17, mo18]], rev_lookup: MovePathLookup { locals: [mp0, mp1, mp2, mp3, mp4, mp5, mp6, mp7, mp8, mp9, mp10, mp11], projections: {} }, inits: [mp1@src/main.rs:9:13: 12:6 (Deep), mp9@src/main.rs:10:9: 10:14 (Deep), mp8@src/main.rs:10:9: 10:14 (NonPanicPathOnly), mp7@src/main.rs:10:9: 10:14 (Deep), mp6@src/main.rs:10:9: 10:27 (NonPanicPathOnly), mp5@src/main.rs:10:9: 10:27 (Deep), mp4@src/main.rs:10:9: 10:27 (NonPanicPathOnly), mp3@src/main.rs:10:9: 10:27 (Deep), mp2@src/main.rs:10:9: 10:36 (NonPanicPathOnly), mp11@src/main.rs:11:9: 11:14 (Deep), mp10@src/main.rs:11:9: 11:14 (Deep), mp0@src/main.rs:9:16: 12:6 (Deep)], init_loc_map: LocationMap { map: [[[], [], [], [], [], [], [], [in1], [in2]], [[in3], [], [in4]], [[]], [[]], [[in5], [in6]], [[in7], [], [], [in8]], [[]], [[]], [[]], [[]], [[], [], []], [[], [], [], [in9], []], [[in10], [], [in11], []], [[]], [[]], [[]]] }, init_path_map: [[in11], [in0], [in8], [in7], [in6], [in5], [in4], [in3], [in2], [in1], [in10], [in9]] }, [IllegalMove { cannot_move_out_of: IllegalMoveOrigin { span: src/main.rs:10:9: 10:27, kind: BorrowedContent } }])', libcore/result.rs:916:5
stack backtrace:
   0:        0x109f23bab - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::hb00ae1fbed16a78a
   1:        0x109f2f89e - std::sys_common::backtrace::print::hf36ed66abb5dec36
   2:        0x109f11e50 - std::panicking::default_hook::{{closure}}::ha90d4c866bd13547
   3:        0x109f11935 - std::panicking::default_hook::hfd2d1b85accf952b
   4:        0x109f122d6 - std::panicking::rust_panic_with_hook::hca4836ceadb52bda
   5:        0x109f121ae - std::panicking::begin_panic::hc0cdca14ab0bf4ba
   6:        0x109f12083 - std::panicking::begin_panic_fmt::hb46649ba52f55429
   7:        0x109f11ff2 - rust_begin_unwind
   8:        0x109f9c243 - core::panicking::panic_fmt::h5760b74cba8293a5
   9:        0x107d3780d - core::result::unwrap_failed::h6a1acabdff3d0eec
  10:        0x107d0f13e - <rustc_mir::transform::elaborate_drops::ElaborateDrops as rustc_mir::transform::MirPass>::run_pass::h747dc48ca9895755
  11:        0x107c9ed1b - rustc_mir::transform::optimized_mir::{{closure}}::hfa2c280020d3ce13
  12:        0x107c9d480 - rustc_mir::transform::optimized_mir::ha00b500d245fc403
  13:        0x10869e3cb - rustc::ty::maps::<impl rustc::ty::maps::queries::optimized_mir<'tcx>>::compute_result::hdc4a263a98158641
  14:        0x10877ae44 - rustc::dep_graph::graph::DepGraph::with_task_impl::h68143cbe1a9f97d5
  15:        0x10840c2a9 - rustc_errors::Handler::track_diagnostics::h50bfc12ff579da45
  16:        0x1089038a0 - rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::cycle_check::h34d534ce00b6fcf7
  17:        0x10869e457 - rustc::ty::maps::<impl rustc::ty::maps::queries::optimized_mir<'tcx>>::force::hbda1b1132bda3f85
  18:        0x10869ebcb - rustc::ty::maps::<impl rustc::ty::maps::queries::optimized_mir<'tcx>>::try_get::h9cf3822b490e0f01
  19:        0x1087f8080 - rustc::ty::maps::TyCtxtAt::optimized_mir::haae9d93689f8eefc
  20:        0x108846fa3 - rustc::ty::sty::ClosureSubsts::field_tys::h8fd7b2516bb1163a
  21:        0x107db489a - rustc_mir::borrow_check::nll::type_check::TypeChecker::typeck_mir::hd7ac2903ec768b89
  22:        0x107daabcd - rustc_mir::borrow_check::nll::type_check::type_check_internal::h6c3133caba4342ea
  23:        0x107cae37f - rustc::ty::context::tls::enter::h70f5fa31abd1ad21
  24:        0x107d68e3f - rustc::infer::InferCtxtBuilder::enter::h4680b6a4bf730a54
  25:        0x107db77a2 - <rustc_mir::borrow_check::nll::type_check::TypeckMir as rustc_mir::transform::MirPass>::run_pass::h4fd610f0b6b66e61
  26:        0x107c9e249 - rustc_mir::transform::mir_const::{{closure}}::hc40a872c7350d68c
  27:        0x107c9d078 - rustc_mir::transform::mir_const::h0351d4971ca6ebdf
  28:        0x10869b90b - rustc::ty::maps::<impl rustc::ty::maps::queries::mir_const<'tcx>>::compute_result::hb8a281daa66135cd
  29:        0x108775e24 - rustc::dep_graph::graph::DepGraph::with_task_impl::h48d605fbff117d9a
  30:        0x108406809 - rustc_errors::Handler::track_diagnostics::h32ef0a507c5dd5df
  31:        0x108931e70 - rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::cycle_check::hb1bac88a62839f0b
  32:        0x10869b997 - rustc::ty::maps::<impl rustc::ty::maps::queries::mir_const<'tcx>>::force::hee54d72e3401bac7
  33:        0x10869c100 - rustc::ty::maps::<impl rustc::ty::maps::queries::mir_const<'tcx>>::try_get::he171ddd9fe88fdac
  34:        0x1087f7ea0 - rustc::ty::maps::TyCtxtAt::mir_const::hab99d6c9e77dfbf4
  35:        0x108959f43 - rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::mir_const::hf9e51693a91842c6
  36:        0x107c9d252 - rustc_mir::transform::mir_validated::h13c0973e82916778
  37:        0x10869ce6b - rustc::ty::maps::<impl rustc::ty::maps::queries::mir_validated<'tcx>>::compute_result::hee6bdf13a75fe72c
  38:        0x108775e24 - rustc::dep_graph::graph::DepGraph::with_task_impl::h48d605fbff117d9a
  39:        0x108418969 - rustc_errors::Handler::track_diagnostics::h8861c27316edbd88
  40:        0x108941e50 - rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::cycle_check::he132784372d189f4
  41:        0x10869cef7 - rustc::ty::maps::<impl rustc::ty::maps::queries::mir_validated<'tcx>>::force::hfbf3a4807f19d884
  42:        0x10869d660 - rustc::ty::maps::<impl rustc::ty::maps::queries::mir_validated<'tcx>>::try_get::hd6aaf4e01bb964da
  43:        0x1087f7f90 - rustc::ty::maps::TyCtxtAt::mir_validated::h23f34482bc52bd78
  44:        0x108959f73 - rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::mir_validated::hf3587735b5a14d04
  45:        0x107b8026b - rustc_borrowck::borrowck::borrowck::h11e8ba64c24145d9
  46:        0x10877b7a2 - rustc::dep_graph::graph::DepGraph::with_task_impl::h6834951daf031258
  47:        0x1084208b9 - rustc_errors::Handler::track_diagnostics::ha885c61e4d186bff
  48:        0x1089198a0 - rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::cycle_check::h6e59ac1032587978
  49:        0x1086ac557 - rustc::ty::maps::<impl rustc::ty::maps::queries::borrowck<'tcx>>::force::hf280f025ebc910a1
  50:        0x1086acc55 - rustc::ty::maps::<impl rustc::ty::maps::queries::borrowck<'tcx>>::try_get::h3087dea5e2e013ca
  51:        0x1087f89e2 - rustc::ty::maps::TyCtxtAt::borrowck::h06c2cbc0702f5c60
  52:        0x10895a1b3 - rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::borrowck::h232ca7089166992d
  53:        0x107b7ffe1 - rustc_borrowck::borrowck::check_crate::h72c5192c8cad1ef1
  54:        0x103ba8921 - <std::thread::local::LocalKey<T>>::with::h4ceb21c51d383228
  55:        0x103ba909c - <std::thread::local::LocalKey<T>>::with::h523066c0aa34625d
  56:        0x103c0940d - rustc::ty::context::TyCtxt::create_and_enter::h9fc0e01596742138
  57:        0x103bd4e80 - rustc_driver::driver::compile_input::h79f5a6577555cf39
  58:        0x103bdcf0e - rustc_driver::run_compiler::h451b54d7493e8f3b
  59:        0x103b047c1 - std::sys_common::backtrace::__rust_begin_short_backtrace::h6ce56a7d644f541f
  60:        0x109f5611e - __rust_maybe_catch_panic
  61:        0x103b49d4d - <F as alloc::boxed::FnBox<A>>::call_box::h727cb74d478d9b7e
  62:        0x109f32237 - std::sys_common::thread::start_thread::h6da1675f0959472c
  63:        0x109f3c0f8 - std::sys::unix::thread::Thread::new::thread_start::habc04e704e134061
  64:     0x7fff9601293a - _pthread_body
  65:     0x7fff96012886 - _pthread_start
@pietroalbini pietroalbini added 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. C-bug Category: This is a bug. A-coroutines Area: Coroutines labels Jan 23, 2018
@bors bors closed this as completed in 4325c63 Feb 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-coroutines Area: Coroutines 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.
Projects
None yet
Development

No branches or pull requests

2 participants