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 when using `impl Iterator<Item = &'a Path> + 'a` #46476

Closed
ThatsGobbles opened this Issue Dec 3, 2017 · 1 comment

Comments

Projects
None yet
3 participants
@ThatsGobbles
Copy link

ThatsGobbles commented Dec 3, 2017

impl MediaLibrary{
    // ..........
    pub fn meta_fps_from_item_fp<'a, P: Into<PathBuf> + 'a>(&'a self, abs_item_path: P) -> impl Iterator<Item = &'a Path> + 'a {
        // Dummy fixture to make sure this is a generator.
        let closure = move || {
            if false {
                yield Path::new("foo.txt")
            }

            // Empty for loop, compiled here just to check if my code was correct.
            // ICE occurred after adding this loop.
            for meta_target in self.meta_targets {

            }
        };
        gen_to_iter(closure)
    }
}

^ I tried compiling this snippet of code (as part of a cargo test invocation, specifically), and got the following ICE:

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.23.0-nightly (827cb0d61 2017-11-26) running on x86_64-unknown-linux-gnu

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

thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: (MoveData { move_paths: [MovePath { lvalue: _0 }, MovePath { first_child: mp24, lvalue: _1 }, MovePath { lvalue: _2 }, MovePath { lvalue: _3 }, MovePath { lvalue: _4 }, MovePath { lvalue: _5 }, MovePath { lvalue: _6 }, MovePath { lvalue: _7 }, MovePath { lvalue: _8 }, MovePath { lvalue: _9 }, MovePath { lvalue: _10 }, MovePath { lvalue: _11 }, MovePath { lvalue: _12 }, MovePath { first_child: mp25, lvalue: _13 }, MovePath { lvalue: _14 }, MovePath { lvalue: _15 }, MovePath { lvalue: _16 }, MovePath { lvalue: _17 }, MovePath { lvalue: _18 }, MovePath { lvalue: _19 }, MovePath { lvalue: _20 }, MovePath { lvalue: _21 }, MovePath { lvalue: _22 }, MovePath { lvalue: _23 }, MovePath { parent: mp1, lvalue: (_1.0: &'a library::MediaLibrary) }, MovePath { parent: mp13, first_child: mp26, lvalue: (_13 as Some) }, MovePath { parent: mp25, lvalue: ((_13 as Some).0: library::MetaTarget) }], moves: [mp4@bb3[0], mp1@bb5[0], mp3@bb6[1], mp5@bb6[2], mp1@bb7[0], mp8@bb9[4], mp8@bb10[0], mp8@bb11[0], mp7@bb12[0], mp8@bb13[0], mp7@bb15[1], mp14@bb16[6], mp14@bb17[0], mp9@bb18[0], mp11@bb19[0], mp16@bb20[1], mp26@bb25[1], mp16@bb25[3], mp18@bb25[4], mp18@bb26[0], mp13@bb27[0], mp16@bb28[0], mp18@bb29[0], mp18@bb30[0], mp16@bb30[1], mp16@bb31[0], mp13@bb31[1], mp13@bb32[0], mp15@bb32[1], mp11@bb32[2], mp11@bb33[0], mp9@bb33[1], mp16@bb34[0], mp13@bb34[1], mp13@bb35[0], mp15@bb35[1], mp11@bb35[4], mp21@bb35[5], mp21@bb35[6], mp21@bb36[0], mp20@bb36[3], mp20@bb37[0], mp11@bb37[1], mp11@bb38[0], mp9@bb39[0], mp7@bb39[1], mp7@bb40[0], mp23@bb40[4], mp6@bb40[5], mp1@bb40[6]], 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]], [[mo22]], [[mo23], [mo24]], [[mo25], [mo26]], [[mo27], [mo28], [mo29]], [[mo30], [mo31]], [[mo32], [mo33]], [[mo34], [mo35], [], [], [mo36], [mo37], [mo38]], [[mo39], [], [], [mo40]], [[mo41], [mo42]], [[mo43], []], [[mo44], [mo45]], [[mo46], [], [], [], [mo47], [mo48], [mo49]], [[]]] }, path_map: [[], [mo1, mo4, mo49], [], [mo2], [mo0], [mo3], [mo48], [mo8, mo10, mo45, mo46], [mo5, mo6, mo7, mo9], [mo13, mo31, mo44], [], [mo14, mo29, mo30, mo36, mo42, mo43], [], [mo20, mo26, mo27, mo33, mo34], [mo11, mo12], [mo28, mo35], [mo15, mo17, mo21, mo24, mo25, mo32], [], [mo18, mo19, mo22, mo23], [], [mo40, mo41], [mo37, mo38, mo39], [], [mo47], [], [], [mo16]], rev_lookup: MovePathLookup { locals: [mp0, mp1, mp2, mp3, mp4, mp5, mp6, mp7, mp8, mp9, mp10, mp11, mp12, mp13, mp14, mp15, mp16, mp17, mp18, mp19, mp20, mp21, mp22, mp23], projections: {(mp25, Field(field[0], AbstractType)): mp26, (mp1, Field(field[0], AbstractType)): mp24, (mp13, Downcast(std::option::Option, 1)): mp25} } }, [IllegalMove { cannot_move_out_of: IllegalMoveOrigin { span: src/library.rs:210:32: 210:49, kind: BorrowedContent } }])', /checkout/src/libcore/result.rs:906:4
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at /checkout/src/libstd/sys_common/backtrace.rs:68
             at /checkout/src/libstd/sys_common/backtrace.rs:57
   2: _ZN3std9panicking12default_hook28_$u7b$$u7b$closure$u7d$$u7d$17h246e98e86e2934d1E.llvm.5A8AA348
             at /checkout/src/libstd/panicking.rs:381
   3: _ZN3std9panicking12default_hook17h46552aebd4a65fe4E.llvm.5A8AA348
             at /checkout/src/libstd/panicking.rs:391
   4: std::panicking::rust_panic_with_hook
             at /checkout/src/libstd/panicking.rs:577
   5: _ZN3std9panicking11begin_panic17he08ceb6b4902de71E.llvm.5A8AA348
             at /checkout/src/libstd/panicking.rs:538
   6: std::panicking::begin_panic_fmt
             at /checkout/src/libstd/panicking.rs:522
   7: rust_begin_unwind
             at /checkout/src/libstd/panicking.rs:498
   8: core::panicking::panic_fmt
             at /checkout/src/libcore/panicking.rs:71
   9: core::result::unwrap_failed
  10: <rustc_mir::transform::elaborate_drops::ElaborateDrops as rustc_mir::transform::MirPass>::run_pass
  11: _ZN9rustc_mir9transform13optimized_mir28_$u7b$$u7b$closure$u7d$$u7d$17hf4e2fe79d7e904ebE.llvm.1C47F73D
  12: rustc_mir::transform::optimized_mir
  13: rustc::ty::maps::<impl rustc::ty::maps::queries::optimized_mir<'tcx>>::compute_result
  14: _ZN5rustc9dep_graph5graph8DepGraph14with_task_impl17h50e0c5cde2c42781E.llvm.9B8CD3D8
  15: rustc_errors::Handler::track_diagnostics
  16: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::cycle_check
  17: rustc::ty::maps::<impl rustc::ty::maps::queries::optimized_mir<'tcx>>::force
  18: rustc::ty::maps::<impl rustc::ty::maps::queries::optimized_mir<'tcx>>::try_get
  19: rustc::ty::maps::TyCtxtAt::optimized_mir
  20: rustc::ty::sty::ClosureSubsts::field_tys
  21: rustc_mir::transform::type_check::type_check
  22: <std::thread::local::LocalKey<T>>::with
  23: rustc::ty::context::GlobalCtxt::enter_local
  24: <rustc_mir::transform::type_check::TypeckMir as rustc_mir::transform::MirPass>::run_pass
  25: _ZN9rustc_mir9transform9mir_const28_$u7b$$u7b$closure$u7d$$u7d$17h41798532b9d3d81eE.llvm.1C47F73D
  26: rustc_mir::transform::mir_const
  27: rustc::ty::maps::<impl rustc::ty::maps::queries::mir_const<'tcx>>::compute_result
  28: _ZN5rustc9dep_graph5graph8DepGraph14with_task_impl17h358c5dbfda855a2cE.llvm.9B8CD3D8
  29: rustc_errors::Handler::track_diagnostics
  30: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::cycle_check
  31: rustc::ty::maps::<impl rustc::ty::maps::queries::mir_const<'tcx>>::force
  32: rustc::ty::maps::<impl rustc::ty::maps::queries::mir_const<'tcx>>::try_get
  33: rustc::ty::maps::TyCtxtAt::mir_const
  34: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::mir_const
  35: rustc_mir::transform::mir_validated
  36: rustc::ty::maps::<impl rustc::ty::maps::queries::mir_validated<'tcx>>::compute_result
  37: _ZN5rustc9dep_graph5graph8DepGraph14with_task_impl17h358c5dbfda855a2cE.llvm.9B8CD3D8
  38: rustc_errors::Handler::track_diagnostics
  39: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::cycle_check
  40: rustc::ty::maps::<impl rustc::ty::maps::queries::mir_validated<'tcx>>::force
  41: rustc::ty::maps::<impl rustc::ty::maps::queries::mir_validated<'tcx>>::try_get
  42: rustc::ty::maps::TyCtxtAt::mir_validated
  43: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::mir_validated
  44: _ZN14rustc_borrowck8borrowck8borrowck17hcedc9c7f4446392dE.llvm.D63B9554
  45: _ZN5rustc9dep_graph5graph8DepGraph14with_task_impl17h7859b748933c95dfE.llvm.9B8CD3D8
  46: rustc_errors::Handler::track_diagnostics
  47: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::cycle_check
  48: rustc::ty::maps::<impl rustc::ty::maps::queries::borrowck<'tcx>>::force
  49: rustc::ty::maps::<impl rustc::ty::maps::queries::borrowck<'tcx>>::try_get
  50: rustc::ty::maps::TyCtxtAt::borrowck
  51: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::borrowck
  52: rustc_borrowck::borrowck::check_crate
  53: <std::thread::local::LocalKey<T>>::with
  54: <std::thread::local::LocalKey<T>>::with
  55: rustc::ty::context::TyCtxt::create_and_enter
  56: rustc_driver::driver::compile_input
  57: rustc_driver::run_compiler

error: Could not compile `taggu`.

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

Output of rustc --version --verbose:

rustc 1.23.0-nightly (827cb0d61 2017-11-26)
binary: rustc
commit-hash: 827cb0d61e22eb6d5c9c5e8e8d05b07108a9968b
commit-date: 2017-11-26
host: x86_64-unknown-linux-gnu
release: 1.23.0-nightly
LLVM version: 4.0
@ThatsGobbles

This comment has been minimized.

Copy link
Author

ThatsGobbles commented Dec 3, 2017

Also, just checked, this still occurs after updating to rustc 1.24.0-nightly (f9b0897 2017-12-02).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment