Skip to content

multiple ICE's for different patterns in array lengths #51963

Description

@DutchGhost

Another ICE on invalid expressions for array lengths:

this is related to #51714, but has been fixed in #51723, and that fix is active in the current nightly.

playground: https://play.rust-lang.org/?gist=6d0a811852e0f67736d2a189c5fdc0d3&version=nightly&mode=release&edition=2015

fn main() {
    [(); return | crash | ()];
}

Putting a type on the closure's argument does not make any difference.

Backtrace:

error[E0572]: return statement outside of function body
 --> src\main.rs:2:10
  |
2 |     [(); return | crash | ()];
  |          ^^^^^^^^^^^^^^^^^^^

thread 'main' panicked at 'missing binding mode', libcore\option.rs:960:5
stack backtrace:
   0: <std::collections::hash::map::DefaultHasher as core::fmt::Debug>::fmt
   1: <std::sys::windows::dynamic_lib::DynamicLibrary as core::ops::drop::Drop>::drop
   2: std::panicking::take_hook
   3: std::panicking::take_hook
   4: <rustc::ty::SymbolName as core::fmt::Debug>::fmt
   5: std::panicking::rust_panic_with_hook
   6: std::panicking::begin_panic_fmt
   7: rust_begin_unwind
   8: core::panicking::panic_fmt
   9: core::option::expect_failed
  10: <rustc_typeck::check::writeback::WritebackCx<'cx, 'gcx, 'tcx> as rustc::hir::intravisit::Visitor<'gcx>>::visit_pat
  11: <rustc_typeck::check::writeback::WritebackCx<'cx, 'gcx, 'tcx> as rustc::hir::intravisit::Visitor<'gcx>>::visit_expr
  12: <rustc_typeck::check::writeback::WritebackCx<'cx, 'gcx, 'tcx> as rustc::hir::intravisit::Visitor<'gcx>>::visit_expr
  13: <unknown>
  14: <rustc_typeck::collect::has_late_bound_regions::LateBoundRegionsDetector<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_lifetime
  15: <rustc_typeck::check_unused::CollectExternCrateVisitor<'a, 'tcx> as rustc::hir::itemlikevisit::ItemLikeVisitor<'v>>::visit_item
  16: <rustc_typeck::check::CheckItemTypesVisitor<'a, 'tcx> as rustc::hir::itemlikevisit::ItemLikeVisitor<'tcx>>::visit_item
  17: rustc::ty::query::on_disk_cache::__ty_decoder_impl::<impl serialize::serialize::Decoder for rustc::ty::query::on_disk_cache::CacheDecoder<'a, 'tcx, 'x>>::read_str
  18: rustc::ty::context::tls::track_diagnostic
  19: rustc::ty::context::tls::track_diagnostic
  20: rustc::dep_graph::graph::DepGraph::assert_ignored
  21: rustc::ty::context::tls::track_diagnostic
  22: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_print_query_stack
  23: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_print_query_stack
  24: rustc::ty::query::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::typeck_tables_of
  25: rustc_mir::interpret::const_eval::const_eval_provider
  26: rustc::ty::query::on_disk_cache::__ty_decoder_impl::<impl serialize::serialize::Decoder for rustc::ty::query::on_disk_cache::CacheDecoder<'a, 'tcx, 'x>>::read_str
  27: rustc::ty::context::tls::track_diagnostic
  28: rustc::ty::context::tls::track_diagnostic
  29: rustc::dep_graph::graph::DepGraph::assert_ignored
  30: rustc::ty::context::tls::track_diagnostic
  31: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_print_query_stack
  32: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_print_query_stack
  33: rustc::ty::query::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::const_eval
  34: <rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx> as rustc_typeck::astconv::AstConv<'gcx, 'tcx>>::record_ty
  35: <rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx> as rustc_typeck::astconv::AstConv<'gcx, 'tcx>>::record_ty
  36: <rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx> as rustc_typeck::astconv::AstConv<'gcx, 'tcx>>::record_ty
  37: <rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx> as rustc_typeck::astconv::AstConv<'gcx, 'tcx>>::record_ty
  38: <rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx> as rustc_typeck::astconv::AstConv<'gcx, 'tcx>>::record_ty
  39: <rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx> as rustc_typeck::astconv::AstConv<'gcx, 'tcx>>::record_ty
  40: <rustc_typeck::check::GatherLocalsVisitor<'a, 'gcx, 'tcx> as rustc::hir::intravisit::Visitor<'gcx>>::visit_pat
  41: <rustc_typeck::collect::has_late_bound_regions::LateBoundRegionsDetector<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_lifetime
  42: <rustc_typeck::check_unused::CollectExternCrateVisitor<'a, 'tcx> as rustc::hir::itemlikevisit::ItemLikeVisitor<'v>>::visit_item
  43: <rustc_typeck::check::CheckItemTypesVisitor<'a, 'tcx> as rustc::hir::itemlikevisit::ItemLikeVisitor<'tcx>>::visit_item
  44: rustc::ty::query::on_disk_cache::__ty_decoder_impl::<impl serialize::serialize::Decoder for rustc::ty::query::on_disk_cache::CacheDecoder<'a, 'tcx, 'x>>::read_str
  45: rustc::ty::context::tls::track_diagnostic
  46: rustc::ty::context::tls::track_diagnostic
  47: rustc::dep_graph::graph::DepGraph::assert_ignored
  48: rustc::ty::context::tls::track_diagnostic
  49: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_print_query_stack
  50: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_print_query_stack
  51: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_print_query_stack
  52: <rustc_typeck::check::GatherLocalsVisitor<'a, 'gcx, 'tcx> as rustc::hir::intravisit::Visitor<'gcx>>::visit_fn
  53: <rustc_typeck::check::CheckItemTypesVisitor<'a, 'tcx> as rustc::hir::itemlikevisit::ItemLikeVisitor<'tcx>>::visit_item
  54: rustc::ty::context::tls::track_diagnostic
  55: rustc::ty::context::tls::track_diagnostic
  56: rustc::dep_graph::graph::DepGraph::assert_ignored
  57: rustc::ty::context::tls::track_diagnostic
  58: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_print_query_stack
  59: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_print_query_stack
  60: rustc_typeck::check_crate
  61: <humantime::date::Error as std::error::Error>::cause
  62: <rustc_driver::pretty::IdentifiedAnnotation<'hir> as rustc_driver::pretty::PrinterSupport>::sess
  63: <unknown>
  64: rustc_driver::driver::compile_input
  65: rustc_driver::run_compiler
  66: <env_logger::filter::inner::Filter as core::fmt::Display>::fmt
  67: <rustc_driver::derive_registrar::Finder as rustc::hir::itemlikevisit::ItemLikeVisitor<'v>>::visit_item
  68: _rust_maybe_catch_panic
  69: <rustc_driver::derive_registrar::Finder as rustc::hir::itemlikevisit::ItemLikeVisitor<'v>>::visit_item
  70: rustc_driver::main
  71: <unknown>
  72: std::panicking::update_panic_count
  73: _rust_maybe_catch_panic
  74: std::rt::lang_start_internal
  75: <unknown>
  76: <unknown>
  77: BaseThreadInitThunk
  78: RtlUserThreadStart
query stack during panic:
#0 [typeck_tables_of] processing `main::{{constant}}`
#1 [const_eval] const-evaluating `main::{{constant}}`
#2 [typeck_tables_of] processing `main`
#3 [typeck_item_bodies] type-checking all item bodies
end of query stack
error: aborting due to previous error

For more information about this error, try `rustc --explain E0572`.

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.28.0-nightly (e3bf634e0 2018-06-28) running on x86_64-pc-windows-msvc

note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden

error: Could not compile `return_closure_with_arg_in_array_length`.

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

Activity

  1. self-assigned this
    on Jul 1, 2018
  2. DutchGhost commented on Jul 1, 2018

    @DutchGhost
    Author

    Update:

    It seems there are more versions that produces the thread 'main' panicked at 'missing binding mode', libcore\option.rs:960:5 ICE:

    fn main() {
        [(); return while let Some(n) = Some(1) {}];
    }
    fn main() {
        [(); return for _ in 0.. {}];
    }
  3. DutchGhost commented on Jul 1, 2018

    @DutchGhost
    Author

    another update:

    with 3 other match expressions I also got the same ICE message:

    fn main() {
        [(); return match 1 {
            n => n,
        }]
    }

    matching a loop {}....

    fn main() {
        [(); return match loop {} {
            something => 1
        }]
    }

    n isnt even a thing....

    fn main() {
        [(); return match () {
            foo => n
        }]
    }
  4. DutchGhost commented on Jul 1, 2018

    @DutchGhost
    Author

    IMPOSSIBLE CASE REACHED
    Another version, resulting in a different ICE message, but still related:

    fn main() {
        [(); return match 1 {
            1 => 1,
        }]
    }

    Backtrace:

    error[E0572]: return statement outside of function body
     --> src\main.rs:2:10
      |
    2 |       [(); return match 1 {
      |  __________^
    3 | |         1 => 1,
    4 | |     }]
      | |_____^
    
    error: internal compiler error: librustc_mir\hair\pattern\mod.rs:1172: impossible case reached
    
    thread 'main' panicked at 'Box<Any>', librustc_errors\lib.rs:554:9
    stack backtrace:
       0: <std::collections::hash::map::DefaultHasher as core::fmt::Debug>::fmt
       1: <std::sys::windows::dynamic_lib::DynamicLibrary as core::ops::drop::Drop>::drop
       2: std::panicking::take_hook
       3: std::panicking::take_hook
       4: <rustc::ty::SymbolName as core::fmt::Debug>::fmt
       5: std::panicking::rust_panic_with_hook
       6: <rustc_errors::emitter::ColorConfig as core::fmt::Debug>::fmt
       7: rustc_errors::Handler::bug
       8: rustc::traits::util::Elaborator::filter_to_traits
       9: rustc::ty::context::tls::track_diagnostic
      10: rustc::ty::context::tls::track_diagnostic
      11: rustc::ty::context::tls::track_diagnostic
      12: rustc::session::bug_fmt
      13: rustc::session::bug_fmt
      14: rustc_mir::hair::pattern::compare_const_vals
      15: rustc_mir::hair::pattern::PatternContext::lower_pattern
      16: rustc_mir::hair::pattern::PatternContext::lower_pattern
      17: <rustc_mir::transform::inline::CallSite<'tcx> as core::fmt::Debug>::fmt
      18: <unknown>
      19: <unknown>
      20: <rustc_mir::hair::pattern::check_match::MatchVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_expr
      21: <rustc_mir::hair::pattern::check_match::MatchVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_expr
      22: <rustc_mir::dataflow::impls::borrows::Borrows<'a, 'gcx, 'tcx> as rustc_mir::dataflow::BitDenotation>::start_block_effect
      23: rustc_mir::hair::pattern::check_match::check_crate
      24: rustc::ty::context::tls::track_diagnostic
      25: rustc::ty::context::tls::track_diagnostic
      26: rustc::dep_graph::graph::DepGraph::assert_ignored
      27: rustc::ty::context::tls::track_diagnostic
      28: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_print_query_stack
      29: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_print_query_stack
      30: rustc::ty::query::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::check_match
      31: rustc_mir::interpret::const_eval::const_eval_provider
      32: rustc::ty::query::on_disk_cache::__ty_decoder_impl::<impl serialize::serialize::Decoder for rustc::ty::query::on_disk_cache::CacheDecoder<'a, 'tcx, 'x>>::read_str
      33: rustc::ty::context::tls::track_diagnostic
      34: rustc::ty::context::tls::track_diagnostic
      35: rustc::dep_graph::graph::DepGraph::assert_ignored
      36: rustc::ty::context::tls::track_diagnostic
      37: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_print_query_stack
      38: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_print_query_stack
      39: rustc::ty::query::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::const_eval
      40: <rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx> as rustc_typeck::astconv::AstConv<'gcx, 'tcx>>::record_ty
      41: <rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx> as rustc_typeck::astconv::AstConv<'gcx, 'tcx>>::record_ty
      42: <rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx> as rustc_typeck::astconv::AstConv<'gcx, 'tcx>>::record_ty
      43: <rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx> as rustc_typeck::astconv::AstConv<'gcx, 'tcx>>::record_ty
      44: <rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx> as rustc_typeck::astconv::AstConv<'gcx, 'tcx>>::record_ty
      45: <rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx> as rustc_typeck::astconv::AstConv<'gcx, 'tcx>>::record_ty
      46: <rustc_typeck::check::GatherLocalsVisitor<'a, 'gcx, 'tcx> as rustc::hir::intravisit::Visitor<'gcx>>::visit_pat
      47: <rustc_typeck::collect::has_late_bound_regions::LateBoundRegionsDetector<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_lifetime
      48: <rustc_typeck::check_unused::CollectExternCrateVisitor<'a, 'tcx> as rustc::hir::itemlikevisit::ItemLikeVisitor<'v>>::visit_item
      49: <rustc_typeck::check::CheckItemTypesVisitor<'a, 'tcx> as rustc::hir::itemlikevisit::ItemLikeVisitor<'tcx>>::visit_item
      50: rustc::ty::query::on_disk_cache::__ty_decoder_impl::<impl serialize::serialize::Decoder for rustc::ty::query::on_disk_cache::CacheDecoder<'a, 'tcx, 'x>>::read_str
      51: rustc::ty::context::tls::track_diagnostic
      52: rustc::ty::context::tls::track_diagnostic
      53: rustc::dep_graph::graph::DepGraph::assert_ignored
      54: rustc::ty::context::tls::track_diagnostic
      55: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_print_query_stack
      56: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_print_query_stack
      57: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_print_query_stack
      58: <rustc_typeck::check::GatherLocalsVisitor<'a, 'gcx, 'tcx> as rustc::hir::intravisit::Visitor<'gcx>>::visit_fn
      59: <rustc_typeck::check::CheckItemTypesVisitor<'a, 'tcx> as rustc::hir::itemlikevisit::ItemLikeVisitor<'tcx>>::visit_item
      60: rustc::ty::context::tls::track_diagnostic
      61: rustc::ty::context::tls::track_diagnostic
      62: rustc::dep_graph::graph::DepGraph::assert_ignored
      63: rustc::ty::context::tls::track_diagnostic
      64: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_print_query_stack
      65: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_print_query_stack
      66: rustc_typeck::check_crate
      67: <humantime::date::Error as std::error::Error>::cause
      68: <rustc_driver::pretty::IdentifiedAnnotation<'hir> as rustc_driver::pretty::PrinterSupport>::sess
      69: <unknown>
      70: rustc_driver::driver::compile_input
      71: rustc_driver::run_compiler
      72: <env_logger::filter::inner::Filter as core::fmt::Display>::fmt
      73: <rustc_driver::derive_registrar::Finder as rustc::hir::itemlikevisit::ItemLikeVisitor<'v>>::visit_item
      74: _rust_maybe_catch_panic
      75: <rustc_driver::derive_registrar::Finder as rustc::hir::itemlikevisit::ItemLikeVisitor<'v>>::visit_item
      76: rustc_driver::main
      77: <unknown>
      78: std::panicking::update_panic_count
      79: _rust_maybe_catch_panic
      80: std::rt::lang_start_internal
      81: <unknown>
      82: <unknown>
      83: BaseThreadInitThunk
      84: RtlUserThreadStart
    query stack during panic:
    #0 [check_match] processing `main::{{constant}}`
    #1 [const_eval] const-evaluating `main::{{constant}}`
    #2 [typeck_tables_of] processing `main`
    #3 [typeck_item_bodies] type-checking all item bodies
    end of query stack
    error: aborting due to 2 previous errors
    
    For more information about this error, try `rustc --explain E0572`.
    
    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.28.0-nightly (e3bf634e0 2018-06-28) running on x86_64-pc-windows-msvc
    
    note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin
    
    note: some of the compiler flags provided by cargo are hidden
    
    error: Could not compile `match_impossible_case`.
    
    
  5. DutchGhost commented on Jul 1, 2018

    @DutchGhost
    Author

    UNEXPECTED TYPE
    Yet another ICE. This time, putting wrong types in the match expression.

    fn main() {
        [(); return match () {
            'c' => 1
        }];
    }

    Backtrace:

    error[E0572]: return statement outside of function body
     --> src\main.rs:2:10
      |
    2 |       [(); return match () {
      |  __________^
    3 | |         'c' => 1
    4 | |     }];
      | |_____^
    
    error: internal compiler error: librustc\ty\layout.rs:1122: LayoutDetails::compute: unexpected type `[type error]`
    
    thread 'main' panicked at 'Box<Any>', librustc_errors\lib.rs:554:9
    stack backtrace:
       0: <std::collections::hash::map::DefaultHasher as core::fmt::Debug>::fmt
       1: <std::sys::windows::dynamic_lib::DynamicLibrary as core::ops::drop::Drop>::drop
       2: std::panicking::take_hook
       3: std::panicking::take_hook
       4: <rustc::ty::SymbolName as core::fmt::Debug>::fmt
       5: std::panicking::rust_panic_with_hook
       6: <rustc_errors::emitter::ColorConfig as core::fmt::Debug>::fmt
       7: rustc_errors::Handler::bug
       8: rustc::traits::util::Elaborator::filter_to_traits
       9: rustc::ty::context::tls::track_diagnostic
      10: rustc::ty::context::tls::track_diagnostic
      11: rustc::ty::context::tls::track_diagnostic
      12: rustc::session::bug_fmt
      13: rustc::session::bug_fmt
      14: rustc::ty::layout::provide
      15: rustc::ty::context::tls::track_diagnostic
      16: <rustc::ty::layout::LayoutError<'tcx> as core::fmt::Display>::fmt
      17: rustc::ty::query::on_disk_cache::__ty_decoder_impl::<impl serialize::serialize::Decoder for rustc::ty::query::on_disk_cache::CacheDecoder<'a, 'tcx, 'x>>::read_str
      18: rustc::ty::context::tls::track_diagnostic
      19: rustc::ty::context::tls::track_diagnostic
      20: rustc::dep_graph::graph::DepGraph::assert_ignored
      21: rustc::ty::context::tls::track_diagnostic
      22: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_print_query_stack
      23: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_print_query_stack
      24: <rustc::ty::layout::LayoutCx<'tcx, rustc::ty::context::TyCtxt<'a, 'tcx, 'tcx>> as rustc_target::abi::LayoutOf>::layout_of
      25: <rustc_mir::monomorphize::collector::MonoItemCollectionMode as core::fmt::Debug>::fmt
      26: rustc_mir::hair::pattern::compare_const_vals
      27: <rustc_mir::hair::pattern::_match::Matrix<'a, 'tcx> as core::fmt::Debug>::fmt
      28: <rustc_mir::hair::pattern::_match::Matrix<'a, 'tcx> as core::fmt::Debug>::fmt
      29: <rustc_mir::hair::pattern::_match::Matrix<'a, 'tcx> as core::fmt::Debug>::fmt
      30: <rustc_mir::transform::uniform_array_move_out::LocalUse as core::fmt::Debug>::fmt
      31: <rustc_mir::monomorphize::collector::MonoItemCollectionMode as core::fmt::Debug>::fmt
      32: <rustc_mir::hair::pattern::_match::Matrix<'a, 'tcx> as core::fmt::Debug>::fmt
      33: <rustc_mir::hair::pattern::check_match::MatchVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_expr
      34: <rustc_mir::hair::pattern::check_match::MatchVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_expr
      35: <rustc_mir::dataflow::impls::borrows::Borrows<'a, 'gcx, 'tcx> as rustc_mir::dataflow::BitDenotation>::start_block_effect
      36: rustc_mir::hair::pattern::check_match::check_crate
      37: rustc::ty::context::tls::track_diagnostic
      38: rustc::ty::context::tls::track_diagnostic
      39: rustc::dep_graph::graph::DepGraph::assert_ignored
      40: rustc::ty::context::tls::track_diagnostic
      41: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_print_query_stack
      42: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_print_query_stack
      43: rustc::ty::query::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::check_match
      44: rustc_mir::interpret::const_eval::const_eval_provider
      45: rustc::ty::query::on_disk_cache::__ty_decoder_impl::<impl serialize::serialize::Decoder for rustc::ty::query::on_disk_cache::CacheDecoder<'a, 'tcx, 'x>>::read_str
      46: rustc::ty::context::tls::track_diagnostic
      47: rustc::ty::context::tls::track_diagnostic
      48: rustc::dep_graph::graph::DepGraph::assert_ignored
      49: rustc::ty::context::tls::track_diagnostic
      50: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_print_query_stack
      51: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_print_query_stack
      52: rustc::ty::query::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::const_eval
      53: <rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx> as rustc_typeck::astconv::AstConv<'gcx, 'tcx>>::record_ty
      54: <rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx> as rustc_typeck::astconv::AstConv<'gcx, 'tcx>>::record_ty
      55: <rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx> as rustc_typeck::astconv::AstConv<'gcx, 'tcx>>::record_ty
      56: <rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx> as rustc_typeck::astconv::AstConv<'gcx, 'tcx>>::record_ty
      57: <rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx> as rustc_typeck::astconv::AstConv<'gcx, 'tcx>>::record_ty
      58: <rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx> as rustc_typeck::astconv::AstConv<'gcx, 'tcx>>::record_ty
      59: <rustc_typeck::check::GatherLocalsVisitor<'a, 'gcx, 'tcx> as rustc::hir::intravisit::Visitor<'gcx>>::visit_pat
      60: <rustc_typeck::collect::has_late_bound_regions::LateBoundRegionsDetector<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_lifetime
      61: <rustc_typeck::check_unused::CollectExternCrateVisitor<'a, 'tcx> as rustc::hir::itemlikevisit::ItemLikeVisitor<'v>>::visit_item
      62: <rustc_typeck::check::CheckItemTypesVisitor<'a, 'tcx> as rustc::hir::itemlikevisit::ItemLikeVisitor<'tcx>>::visit_item
      63: rustc::ty::query::on_disk_cache::__ty_decoder_impl::<impl serialize::serialize::Decoder for rustc::ty::query::on_disk_cache::CacheDecoder<'a, 'tcx, 'x>>::read_str
      64: rustc::ty::context::tls::track_diagnostic
      65: rustc::ty::context::tls::track_diagnostic
      66: rustc::dep_graph::graph::DepGraph::assert_ignored
      67: rustc::ty::context::tls::track_diagnostic
      68: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_print_query_stack
      69: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_print_query_stack
      70: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_print_query_stack
      71: <rustc_typeck::check::GatherLocalsVisitor<'a, 'gcx, 'tcx> as rustc::hir::intravisit::Visitor<'gcx>>::visit_fn
      72: <rustc_typeck::check::CheckItemTypesVisitor<'a, 'tcx> as rustc::hir::itemlikevisit::ItemLikeVisitor<'tcx>>::visit_item
      73: rustc::ty::context::tls::track_diagnostic
      74: rustc::ty::context::tls::track_diagnostic
      75: rustc::dep_graph::graph::DepGraph::assert_ignored
      76: rustc::ty::context::tls::track_diagnostic
      77: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_print_query_stack
      78: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_print_query_stack
      79: rustc_typeck::check_crate
      80: <humantime::date::Error as std::error::Error>::cause
      81: <rustc_driver::pretty::IdentifiedAnnotation<'hir> as rustc_driver::pretty::PrinterSupport>::sess
      82: <unknown>
      83: rustc_driver::driver::compile_input
      84: rustc_driver::run_compiler
      85: <env_logger::filter::inner::Filter as core::fmt::Display>::fmt
      86: <rustc_driver::derive_registrar::Finder as rustc::hir::itemlikevisit::ItemLikeVisitor<'v>>::visit_item
      87: _rust_maybe_catch_panic
      88: <rustc_driver::derive_registrar::Finder as rustc::hir::itemlikevisit::ItemLikeVisitor<'v>>::visit_item
      89: rustc_driver::main
      90: <unknown>
      91: std::panicking::update_panic_count
      92: _rust_maybe_catch_panic
      93: std::rt::lang_start_internal
      94: <unknown>
      95: <unknown>
      96: BaseThreadInitThunk
      97: RtlUserThreadStart
    query stack during panic:
    #0 [layout_raw] computing layout of `[type error]`
    #1 [check_match] processing `main::{{constant}}`
    #2 [const_eval] const-evaluating `main::{{constant}}`
    #3 [typeck_tables_of] processing `main`
    #4 [typeck_item_bodies] type-checking all item bodies
    end of query stack
    error: aborting due to 2 previous errors
    
    For more information about this error, try `rustc --explain E0572`.
    
    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.28.0-nightly (e3bf634e0 2018-06-28) running on x86_64-pc-windows-msvc
    
    note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin
    
    note: some of the compiler flags provided by cargo are hidden
    
    error: Could not compile `unexpected_type`.
    
    To learn more, run the command again with --verbose.
    
  6. added
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    on Jul 2, 2018
  7. added a commit that references this issue on Jul 2, 2018
    7c9ba44
  8. changed the title [-]Return closure with argument in array length causes ICE[/-] [+]multiple ICE's for different patterns in array lengths[/+] on Jul 2, 2018
  9. DutchGhost commented on Jul 3, 2018

    @DutchGhost
    Author

    found another one that gives the 'missing binding mode' message,

    fn main() {
        [(); return None?]
    }
  10. varkor commented on Jul 3, 2018

    @varkor
    Contributor

    @DutchGhost: can't test now, but let's see if that's also fixed when #51967 is merged (I think it should be).

  11. DutchGhost commented on Jul 4, 2018

    @DutchGhost
    Author

    not only array constants are able to ICE:

    [] - MISSING BINDING MODE - []

    fn main() {
        
        const const_binding_mode_crash: () =  return |crash| {};
    }    
    fn main() {
        enum enum_binding_mode_crash {
            t = return |crash| ()
        }
    }    

    [] - UNEXPECTED TYPE - []

    fn main() {
        enum enum_unexpected_type_crash {
            t = return match () {
                'c' => 1,
            },
        }
    }    

    [] - IMPOSSIBLE CASE REACHED - []

    fn main() {
        enum enum_impossible_case_reached {
            t = return match 1 {
                1 => 1,
            }
        }
    }    
  12. varkor commented on Jul 4, 2018

    @varkor
    Contributor

    @DutchGhost: let's check these after #51967 is merged, and if any are still occurring afterwards, we can open new issues for them.

  13. added a commit that references this issue on Jul 5, 2018
    69b9e1e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions