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 on rustc 1.26.0-nightly (ae544ee1c 2018-03-29) #49534

Closed
topecongiro opened this issue Mar 31, 2018 · 15 comments
Closed

ICE on rustc 1.26.0-nightly (ae544ee1c 2018-03-29) #49534

topecongiro opened this issue Mar 31, 2018 · 15 comments
Assignees
Labels
A-mir Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@topecongiro
Copy link
Contributor

topecongiro commented Mar 31, 2018

I encountered an ICE while working on rustfmt (my branch) with this commit. I am using 1.26.0-nightly (ae544ee1c 2018-03-29).

Log

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 { first_child: mp30, place: _4 }, MovePath { place: _5 }, MovePath { place: _6 }, MovePath { place: _7 }, MovePath { place: _8 }, MovePath { place: _9 }, MovePath { place: _10 }, MovePath { place: _11 }, MovePath { place: _12 }, MovePath { place: _13 }, MovePath { place: _14 }, MovePath { place: _15 }, MovePath { place: _16 }, MovePath { place: _17 }, MovePath { place: _18 }, MovePath { place: _19 }, MovePath { first_child: mp28, place: _20 }, MovePath { place: _21 }, MovePath { place: _22 }, MovePath { place: _23 }, MovePath { place: _24 }, MovePath { place: _25 }, MovePath { place: _26 }, MovePath { place: _27 }, MovePath { parent: mp20, place: (*_20) }, MovePath { parent: mp4, place: (_4.0: &'<empty> imports::UseSegment) }, MovePath { parent: mp4, next_sibling: mp29 place: (_4.1: &'<empty> &'<empty> mut imports::UseSegment) }], moves: [mp5@bb0[5], mp6@bb0[5], mp6@bb0[6], mp5@bb0[7], mp10@bb0[10], mp1@bb2[7], mp22@bb2[10], mp23@bb2[10], mp13@bb3[10], mp14@bb3[10], mp11@bb4[1], mp9@bb5[0], mp14@bb6[0], mp13@bb6[1], mp15@bb6[2], mp8@bb6[4], mp16@bb6[5], mp16@bb6[6], mp1@bb7[0], mp8@bb8[0], mp9@bb9[0], mp16@bb10[0], mp23@bb11[0], mp22@bb11[1], mp20@bb12[0], mp22@bb13[0], mp21@bb14[0], mp22@bb15[0], mp26@bb15[5], mp26@bb16[0], mp25@bb16[3], mp27@bb16[3], mp27@bb17[0], mp25@bb17[1], mp25@bb18[0], mp24@bb19[0], mp25@bb20[0], mp21@bb20[1], mp24@bb20[1], mp24@bb20[2], mp24@bb21[0], mp21@bb21[1], mp21@bb22[0], mp20@bb22[1], mp19@bb22[2], mp19@bb22[3], mp18@bb23[0], mp20@bb24[0], mp19@bb25[0], mp20@bb25[1], mp20@bb26[0], mp18@bb26[1], mp18@bb27[0], mp17@bb28[0], mp18@bb29[0], mp17@bb29[1], mp17@bb29[2], mp17@bb30[0], mp9@bb31[0], mp8@bb31[1], mp8@bb32[0], mp4@bb32[1], mp1@bb32[2], mp0@bb33[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], []], [[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]], [[mo50], [mo51]], [[mo52]], [[mo53]], [[mo54], [mo55], [mo56]], [[mo57], []], [[mo58], [mo59]], [[mo60], [mo61], [mo62]], [[mo63]]] }, path_map: [[mo63], [mo5, mo18, mo62], [], [], [mo61], [mo0, mo3], [mo1, mo2], [], [mo15, mo19, mo59, mo60], [mo11, mo20, mo58], [mo4], [mo10], [], [mo8, mo13], [mo9, mo12], [mo14], [mo16, mo17, mo21], [mo53, mo55, mo56, mo57], [mo46, mo51, mo52, mo54], [mo44, mo45, mo48], [mo24, mo43, mo47, mo49, mo50], [mo26, mo37, mo41, mo42], [mo6, mo23, mo25, mo27], [mo7, mo22], [mo35, mo38, mo39, mo40], [mo30, mo33, mo34, mo36], [mo28, mo29], [mo31, mo32], [], [], []], 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, mp24, mp25, mp26, mp27], projections: {(mp4, Field(field[1], AbstractType)): mp30, (mp20, Deref): mp28, (mp4, Field(field[0], AbstractType)): mp29} }, inits: [mp1@src/imports.rs:145:14: 145:18 (Deep), mp2@src/imports.rs:145:20: 145:25 (Deep), mp3@src/imports.rs:145:44: 145:48 (Deep), mp5@src/imports.rs:146:16: 146:21 (Deep), mp6@src/imports.rs:146:23: 146:29 (Deep), mp4@src/imports.rs:146:15: 146:30 (Deep), mp7@src/imports.rs:146:9: 155:10 (Deep), mp10@src/imports.rs:147:14: 147:38 (Deep), mp20@<vec macros>:3:25: 3:46 (Shallow), mp22@src/imports.rs:152:46: 152:50 (Deep), mp23@src/imports.rs:152:52: 152:56 (Deep), mp21@src/imports.rs:152:17: 152:57 (NonPanicPathOnly), mp8@src/imports.rs:147:31: 147:37 (Deep), mp9@src/imports.rs:147:57: 147:63 (Deep), mp13@src/imports.rs:148:17: 148:19 (Deep), mp15@src/imports.rs:148:27: 148:34 (Deep), mp14@src/imports.rs:148:27: 148:34 (Deep), mp12@src/imports.rs:148:17: 148:35 (NonPanicPathOnly), mp11@src/imports.rs:147:40: 147:64 (Deep), mp16@src/imports.rs:149:34: 149:36 (Deep), mp0@src/imports.rs:149:17: 149:37 (Deep), mp26@src/imports.rs:153:46: 153:51 (Deep), mp25@src/imports.rs:153:46: 153:59 (NonPanicPathOnly), mp27@src/imports.rs:153:61: 153:65 (Deep), mp24@src/imports.rs:153:17: 153:66 (NonPanicPathOnly), mp28@<vec macros>:3:29: 3:46 (Deep), mp19@<vec macros>:3:25: 3:46 (Deep), mp18@<vec macros>:3:25: 3:46 (Deep), mp17@<vec macros>:3:1: 3:48 (NonPanicPathOnly), mp0@src/imports.rs:151:18: 154:15 (Deep)], init_loc_map: LocationMap { map: [[[], [], [in3], [], [in4], [in5], [], [], [in6], [in7], []], [[]], [[], [], [], [], [in8], [], [], [in9], [], [in10], [in11]], [[], [in12], [], [in13], [], [in14], [], [], [in15], [in16], [in17]], [[in18], []], [[]], [[], [], [], [], [in19], [in20], []], [[]], [[]], [[]], [[], []], [[], []], [[]], [[]], [[]], [[], [], [], [], [in21], [in22]], [[], [], [in23], [in24]], [[], []], [[]], [[]], [[], [in25], []], [[], []], [[], [in26], [in27], []], [[]], [[]], [[], []], [[], [in28]], [[]], [[]], [[], [in29], []], [[], []], [[], []], [[], [], []], [[]]] }, init_path_map: [[in20, in29], [in0], [in1], [in2], [in5], [in3], [in4], [in6], [in12], [in13], [in7], [in18], [in17], [in14], [in16], [in15], [in19], [in28], [in27], [in26], [in8], [in11], [in9], [in10], [in24], [in22], [in21], [in23], [in25], [], []] }, [IllegalMove { cannot_move_out_of: IllegalMoveOrigin { span: src/imports.rs:147:31: 147:37, kind: BorrowedContent } }, IllegalMove { cannot_move_out_of: IllegalMoveOrigin { span: src/imports.rs:147:57: 147:63, kind: BorrowedContent } }])', libcore/result.rs:945:5

Backtrace

   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at libstd/sys_common/backtrace.rs:71
             at libstd/sys_common/backtrace.rs:59
   2: std::panicking::default_hook::{{closure}}
             at libstd/panicking.rs:207
   3: std::panicking::default_hook
             at libstd/panicking.rs:223
   4: core::ops::function::Fn::call
   5: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:403
   6: std::panicking::begin_panic_fmt
             at libstd/panicking.rs:349
   7: rust_begin_unwind
             at libstd/panicking.rs:325
   8: core::panicking::panic_fmt
             at libcore/panicking.rs:72
   9: core::result::unwrap_failed
  10: <rustc_mir::transform::elaborate_drops::ElaborateDrops as rustc_mir::transform::MirPass>::run_pass
  11: rustc_mir::transform::optimized_mir::{{closure}}
  12: rustc_mir::transform::optimized_mir
  13: rustc::ty::maps::<impl rustc::ty::maps::queries::optimized_mir<'tcx>>::compute_result
  14: rustc::dep_graph::graph::DepGraph::with_task_impl
  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::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::instance_mir
  21: rustc_mir::monomorphize::collector::collect_items_rec
  22: rustc_mir::monomorphize::collector::collect_items_rec
  23: rustc_mir::monomorphize::collector::collect_items_rec
  24: rustc_mir::monomorphize::collector::collect_items_rec
  25: rustc_mir::monomorphize::collector::collect_items_rec
  26: rustc_mir::monomorphize::collector::collect_items_rec
  27: rustc_mir::monomorphize::collector::collect_items_rec
  28: rustc_mir::monomorphize::collector::collect_items_rec
  29: rustc_mir::monomorphize::collector::collect_items_rec
  30: rustc_mir::monomorphize::collector::collect_items_rec
  31: rustc_mir::monomorphize::collector::collect_items_rec
  32: rustc_mir::monomorphize::collector::collect_items_rec
  33: rustc_mir::monomorphize::collector::collect_items_rec
  34: rustc_mir::monomorphize::collector::collect_items_rec
  35: rustc_mir::monomorphize::collector::collect_items_rec
  36: rustc_mir::monomorphize::collector::collect_items_rec
  37: rustc_mir::monomorphize::collector::collect_items_rec
  38: rustc_mir::monomorphize::collector::collect_items_rec
  39: rustc_mir::monomorphize::collector::collect_crate_mono_items
  40: rustc::util::common::time
  41: rustc_trans::base::collect_and_partition_translation_items
  42: rustc::dep_graph::graph::DepGraph::with_task_impl
  43: rustc_errors::Handler::track_diagnostics
  44: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::cycle_check
  45: rustc::ty::maps::<impl rustc::ty::maps::queries::collect_and_partition_translation_items<'tcx>>::force
  46: rustc::ty::maps::<impl rustc::ty::maps::queries::collect_and_partition_translation_items<'tcx>>::try_get
  47: rustc::ty::maps::TyCtxtAt::collect_and_partition_translation_items
  48: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::collect_and_partition_translation_items
  49: rustc_trans::base::trans_crate
  50: <rustc_trans::LlvmTransCrate as rustc_trans_utils::trans_crate::TransCrate>::trans_crate
  51: rustc::util::common::time
  52: rustc_driver::driver::phase_4_translate_to_llvm
  53: rustc_driver::driver::compile_input::{{closure}}
  54: <std::thread::local::LocalKey<T>>::with
  55: <std::thread::local::LocalKey<T>>::with
  56: rustc::ty::context::TyCtxt::create_and_enter
  57: rustc_driver::driver::compile_input
  58: rustc_driver::run_compiler_impl
  59: syntax::with_globals
@ishitatsuyuki ishitatsuyuki added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Mar 31, 2018
@ishitatsuyuki
Copy link
Contributor

Can you try a few older nightlies to determine which day has this regressed? Looks similar to #46197, so maybe you can check that thread as well.

@ishitatsuyuki ishitatsuyuki added regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. A-mir Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html regression-from-stable-to-stable Performance or correctness regression from one stable version to another. labels May 13, 2018
@ishitatsuyuki
Copy link
Contributor

From #50668: this has also regressed stable.

@nikomatsakis
Copy link
Contributor

@topecongiro perhaps you can https://github.com/rust-lang-nursery/cargo-bisect-rustc to nail down more precisely what led to the problem? if so, that would be 💯!

@nikomatsakis nikomatsakis added the P-high High priority label May 17, 2018
@nikomatsakis
Copy link
Contributor

I'll assign to myself but mostly trying to veirfy if this is indeed a dup of #46197 to start

@nikomatsakis nikomatsakis self-assigned this May 17, 2018
@Swoorup
Copy link

Swoorup commented May 21, 2018

I wonder if this is something a beginner can solve, since this looks like a regression? If so, I can take a look?

@ishitatsuyuki
Copy link
Contributor

@Swoorup #49534 (comment) has some instructions for what you can start with, but actually fixing the root cause may be hard. Either way, if you report back the team members will answer your questions.

@pnkfelix pnkfelix added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label May 31, 2018
@pnkfelix pnkfelix self-assigned this May 31, 2018
@nikomatsakis
Copy link
Contributor

Note that #46197 -- of which this is possibly a dup -- was itself a dup of another issue, which has been fixed. So it's possible that there is no bug here (but in that case, the original source should now fail to compile with a compilation error).

Can anyone verify that? (cc @topecongiro)

@mikhail-m1
Copy link
Contributor

looking at it

@mikhail-m1
Copy link
Contributor

it successfully compiles by rustc 1.28.0-nightly (2a00629 2018-06-09), of cause after several fixes not related to the ICE commit.

@pietroalbini pietroalbini removed the regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. label Jun 20, 2018
@nikomatsakis
Copy link
Contributor

@mikhail-m1 to be clear, you mean that the specific commit of rustfmt is working now? In other words, the ICE is gone? In that case, we can probably close, even if we don't know the exact cause.

@mikhail-m1
Copy link
Contributor

yes, it works, I think it's enough for close

@Swoorup
Copy link

Swoorup commented Jun 21, 2018

Still crashing using this code on playground on nightly
https://play.rust-lang.org/?gist=f0fb16a9c07eaa29468da07063225642&version=nightly&mode=debug

@mikhail-m1
Copy link
Contributor

mikhail-m1 commented Jun 21, 2018

thanks for nice sample, stack backtrace is same, I will look at it, minimized:

fn main() {
    let a = vec!["".to_string()];
    a.iter().enumerate()
            .take_while(|(_, &t)| false)
            .collect::<Vec<_>>();
}

@nikomatsakis
Copy link
Contributor

This might be fixed by #51686

@nikomatsakis
Copy link
Contributor

Yes, it is.

bors added a commit that referenced this issue Jun 22, 2018
…t-bindings-bug, r=eddyb

yet another "old borrowck" bug around match default bindings

We were getting the type of the parameter from its pattern, but that didn't include adjustments. I did a `ripgrep` around and this seemed to be the only affected case.

The reason this didn't show up as an ICE earlier is that mem-categorization is lenient with respect to weird discrepancies. I am going to add more delay-span-bug calls shortly around that (I'll push onto the PR).

This example is an ICE, but I presume that there is a way to make a soundness example out of this -- it basically ignores borrows occuring inside match-default-bindings in a closure, though only if the implicit deref is at the top-level. It happens though that this occurs frequently in iterators, which often give a `&T` parameter.

Fixes #51415
Fixes #49534

r? @eddyb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-mir Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. 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

7 participants