Skip to content

ICE when merge join two btreemap #47211

Closed
@WiSaGaN

Description

@WiSaGaN

ICE on 1.23 stable

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 (766bd11c8 2018-01-01) running on x86_64-unknown-linux-gnu

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

thread 'rustc' panicked at 'region_obligations not empty: [
    (
        NodeId(
            0
        ),
        RegionObligation(sub_region='_#15r, sup_type=bool)
    ),
    (
        NodeId(
            0
        ),
        RegionObligation(sub_region='_#15r, sup_type=())
    ),
    (
        NodeId(
            0
        ),
        RegionObligation(sub_region='_#16r, sup_type=bool)
    ),
    (
        NodeId(
            0
        ),
        RegionObligation(sub_region='_#16r, sup_type=())
    )
]', /checkout/src/librustc/infer/mod.rs:1161:8
stack backtrace:
   0:     0x7f979832ed93 - std::sys::imp::backtrace::tracing::imp::unwind_backtrace::hd278582b7bf125b4
                               at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1:     0x7f979832a46c - std::sys_common::backtrace::_print::h585aeaf99da81bd9
                               at /checkout/src/libstd/sys_common/backtrace.rs:68
   2:     0x7f979833c2e1 - std::panicking::default_hook::{{closure}}::h2cf5ae2c765258ee
                               at /checkout/src/libstd/sys_common/backtrace.rs:57
                               at /checkout/src/libstd/panicking.rs:381
   3:     0x7f979833bfee - std::panicking::default_hook::h4df9c6962fc8f370
                               at /checkout/src/libstd/panicking.rs:391
   4:     0x7f979833c7ea - std::panicking::rust_panic_with_hook::hec57cb9076b0053e
                               at /checkout/src/libstd/panicking.rs:577
   5:     0x7f979833c66e - std::panicking::begin_panic::hf1e5e0b8a9c20d4e
                               at /checkout/src/libstd/panicking.rs:538
   6:     0x7f979833c569 - std::panicking::begin_panic_fmt::hae9efc5efbaf8262
                               at /checkout/src/libstd/panicking.rs:522
   7:     0x7f979455d316 - rustc::infer::InferCtxt::resolve_regions_and_report_errors::h2489ea2ac57c357e
   8:     0x7f9794b8c7b7 - rustc_typeck::check::regionck::<impl rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx>>::regionck_fn::hc14e4293e3b679a8
   9:     0x7f9794c163ba - <std::thread::local::LocalKey<T>>::with::h01f73e03a15e8426
  10:     0x7f9794c8e67a - rustc::ty::context::GlobalCtxt::enter_local::h69d9e38a43681cbd
  11:     0x7f9794ba2e77 - _ZN12rustc_typeck5check16typeck_tables_of17hda1df5d1a781f516E.llvm.6CA2F5D0
  12:     0x7f979423d56f - rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::compute_result::ha75df1fb9b8d3d18
  13:     0x7f97944915f7 - _ZN5rustc9dep_graph5graph8DepGraph14with_task_impl17hfeaf2a9e09dd54d2E.llvm.F50A461C
  14:     0x7f97940e612d - rustc_errors::Handler::track_diagnostics::h164606659a2ac147
  15:     0x7f9794631c8d - rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::cycle_check::h62e23c272a55a3c9
  16:     0x7f979423d605 - rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::force::hd19c6c4a34fec988
  17:     0x7f979423dd74 - rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::try_get::h68926bb8acb77cbb
  18:     0x7f97943f1caf - rustc::ty::maps::TyCtxtAt::typeck_tables_of::h7b9335e88bc1b0ba
  19:     0x7f979423d4e5 - rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables_of<'tcx>>::ensure::h439a01508b470686
  20:     0x7f9794c2ee75 - rustc::session::Session::track_errors::h4dcf1131057a0881
  21:     0x7f9794ba273a - _ZN12rustc_typeck5check18typeck_item_bodies17hab9b46dbfd42ae52E.llvm.6CA2F5D0
  22:     0x7f979423c2ef - rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_item_bodies<'tcx>>::compute_result::h1dbc736fd065c6cf
  23:     0x7f979448435b - _ZN5rustc9dep_graph5graph8DepGraph14with_task_impl17hc108b7b2e4ed98c4E.llvm.F50A461C
  24:     0x7f9794106c1f - rustc_errors::Handler::track_diagnostics::hc2b6cdaae0cd4c7a
  25:     0x7f9794637c8d - rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::cycle_check::h7c1717b072245c43
  26:     0x7f979423c379 - rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_item_bodies<'tcx>>::force::h8f71571c8a351326
  27:     0x7f979423c991 - rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_item_bodies<'tcx>>::try_get::h465200f11ebb0a04
  28:     0x7f97943f1bbd - rustc::ty::maps::TyCtxtAt::typeck_item_bodies::hf490bb31c6267e76
  29:     0x7f9794678673 - rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::typeck_item_bodies::hee5e0ed807fbd890
  30:     0x7f9794c4c6f5 - rustc::util::common::time::h3d96e1b50037fb39
  31:     0x7f9794c807bb - rustc_typeck::check_crate::hc40e9fd329108497
  32:     0x7f97987757e8 - <std::thread::local::LocalKey<T>>::with::hab712da7b05f1721
  33:     0x7f9798774d2c - <std::thread::local::LocalKey<T>>::with::h860f3147313caedd
  34:     0x7f97986c0a0e - rustc::ty::context::TyCtxt::create_and_enter::h1e9eab2229a6f71b
  35:     0x7f9798708d31 - rustc_driver::driver::compile_input::h3ac66d54d480a26d
  36:     0x7f979876494a - rustc_driver::run_compiler::h189ce0baff261139
  37:     0x7f97986e4a02 - _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h832a69c7866f656aE.llvm.E45E81C6
  38:     0x7f97983479de - __rust_maybe_catch_panic
                               at /checkout/src/libpanic_unwind/lib.rs:101
  39:     0x7f97987558c2 - _ZN50_$LT$F$u20$as$u20$alloc..boxed..FnBox$LT$A$GT$$GT$8call_box17h89fc984700f7576bE.llvm.5C5B5F27
  40:     0x7f979833b16b - std::sys::imp::thread::Thread::new::thread_start::h379d0fc65e150416
                               at /checkout/src/liballoc/boxed.rs:772
                               at /checkout/src/libstd/sys_common/thread.rs:24
                               at /checkout/src/libstd/sys/unix/thread.rs:90
  41:     0x7f979226d6b9 - start_thread
  42:     0x7f97980003dc - clone
  43:                0x0 - <unknown>

Minimal example I managed to reduce to:

extern crate itertools; 
use itertools::Itertools;
use std::collections::btree_map::BTreeMap;

pub fn foo() {
    let bar1 = BTreeMap::<(), ()>::new();
    let bar2 = BTreeMap::<(), ()>::new();
    let _ = bar1.iter().merge_join_by(bar2.iter(), |_, _| ::std::cmp::Ordering::Equal);
}

fn main() {}

Playground link: https://play.rust-lang.org/?gist=044e2ff3efea878618257649546c8753&version=stable

Works fine on 1.22.1, current beta, current nightly. ICE on 1.23.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions