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

Unbalanced < and closure crash with "tuple pattern unexpected type Err(())" #34334

Closed
rardiol opened this issue Jun 17, 2016 · 0 comments
Closed
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@rardiol
Copy link

rardiol commented Jun 17, 2016

I tried this code:

fn main () {
    let sr: Vec<(u32, _, _) = vec![];
    let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_receiver)| {}).collect();
}

I expected to see this happen:

error: missing >

Instead, this happened:

> t.rs:2:29: 2:30 error: expected one of `+`, `,`, or `>`, found `=`
> t.rs:2     let sr: Vec<(u32, _, _) = vec![];
>                                    ^
> t.rs:3:33: 3:35 error: unresolved name `sr` [E0425]
> t.rs:3     let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_receiver)| {}).collect();
>                                        ^~
> t.rs:3:33: 3:35 help: run `rustc --explain E0425` to see a detailed explanation
> t.rs:3:48: 3:81 error: internal compiler error: src/librustc/middle/mem_categorization.rs:1300: tuple pattern unexpected type Err(())
> t.rs:3     let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_receiver)| {}).collect();
>                                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 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
> thread 'rustc' panicked at 'Box<Any>', src/libsyntax/errors/mod.rs:545
> note: Run with `RUST_BACKTRACE=1` for a backtrace.

Meta

rustc --version --verbose:

rustc 1.11.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.11.0-dev

Backtrace:


thread 'rustc' panicked at 'Box<Any>', src/libsyntax/errors/mod.rs:545
stack backtrace:
   1:     0x7f9f8901f0d4 - std::sys::backtrace::tracing::imp::write::hc6294d1e0e9044ff
   2:     0x7f9f8902d24b - std::panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::h695d4ae4d161909f
   3:     0x7f9f8902cdfc - std::panicking::default_hook::h369905e6af8b368f
   4:     0x7f9f88ff0f2d - std::panicking::rust_panic_with_hook::h021cdbac2b00d849
   5:     0x7f9f87d27ec8 - std::panicking::begin_panic::h7e9acd4fe05e4790
   6:     0x7f9f87d27d35 - rustc::session::opt_span_bug_fmt::_$u7b$$u7b$closure$u7d$$u7d$::hd2ee128532aebb8f
   7:     0x7f9f87d27b0f - rustc::session::span_bug_fmt::h89f92d121ede5b08
   8:     0x7f9f87dc4fb1 - rustc::middle::mem_categorization::MemCategorizationContext::cat_pattern_::hf21ea97e9711ea54
   9:     0x7f9f87dc380e - rustc_typeck::check::regionck::RegionCtxt::link_pattern::h70a3cd02a4321d1f
  10:     0x7f9f87dbfde8 - rustc_typeck::check::regionck::RegionCtxt::visit_fn_body::h5d3b7e4816fadba8
  11:     0x7f9f87dc27cf - rustc::hir::intravisit::walk_expr::h325cb1ca83c8a266
  12:     0x7f9f87dbdb4e - _<rustc_typeck..check..regionck..RegionCtxt<'a, 'gcx, 'tcx> as rustc..hir..intravisit..Visitor<'v>>::visit_expr::hd3645caaa0b0f045
  13:     0x7f9f87dc24e6 - rustc::hir::intravisit::walk_expr::h325cb1ca83c8a266
  14:     0x7f9f87dbd7ac - _<rustc_typeck..check..regionck..RegionCtxt<'a, 'gcx, 'tcx> as rustc..hir..intravisit..Visitor<'v>>::visit_expr::hd3645caaa0b0f045
  15:     0x7f9f87dc24e6 - rustc::hir::intravisit::walk_expr::h325cb1ca83c8a266
  16:     0x7f9f87dbd7ac - _<rustc_typeck..check..regionck..RegionCtxt<'a, 'gcx, 'tcx> as rustc..hir..intravisit..Visitor<'v>>::visit_expr::hd3645caaa0b0f045
  17:     0x7f9f87dc0ad1 - _<rustc_typeck..check..regionck..RegionCtxt<'a, 'gcx, 'tcx> as rustc..hir..intravisit..Visitor<'v>>::visit_local::h22e75c1a3f5047ed
  18:     0x7f9f87dbfe57 - rustc_typeck::check::regionck::RegionCtxt::visit_fn_body::h5d3b7e4816fadba8
  19:     0x7f9f87d47285 - rustc_typeck::check::regionck::_<impl rustc_typeck..check..FnCtxt<'a, 'gcx, 'tcx>>::regionck_fn::ha576d8a0a2255f8a
  20:     0x7f9f87d40b09 - rustc_typeck::check::check_bare_fn::h633487f778296e99
  21:     0x7f9f87d3c247 - rustc_typeck::check::check_item_body::ha7c59baac63cfc16
  22:     0x7f9f87d33888 - rustc_typeck::check::check_item_bodies::hc78013d54503f502
  23:     0x7f9f87d29653 - rustc_typeck::check_crate::hab8b45ac86a97257
  24:     0x7f9f895890d2 - rustc_driver::driver::phase_3_run_analysis_passes::_$u7b$$u7b$closure$u7d$$u7d$::h9ce010bf2f288e62
  25:     0x7f9f89586be5 - rustc::ty::context::TyCtxt::create_and_enter::h6d2f513f498cf199
  26:     0x7f9f8954d461 - rustc_driver::driver::compile_input::h5e5e4501615d7d4b
  27:     0x7f9f895343e0 - rustc_driver::run_compiler::h9bfe8b5b10d5224d
  28:     0x7f9f8953114f - std::panicking::try::call::h66750c51b011e8b9
  29:     0x7f9f8903a81b - __rust_try
  30:     0x7f9f8903a7be - __rust_maybe_catch_panic
  31:     0x7f9f89531cc1 - _<F as alloc..boxed..FnBox<A>>::call_box::h1dabc16042a72ead
  32:     0x7f9f8902b454 - std::sys::thread::Thread::new::thread_start::h00ab25479c85f368
  33:     0x7f9f83919413 - start_thread
  34:     0x7f9f88c78c3c - __clone
  35:                0x0 - <unknown>

@apasel422 apasel422 added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Jun 17, 2016
bors added a commit that referenced this issue Jun 18, 2016
Fix ICE in memory categorization of tuple patterns

Fixes #34334

It seems to be ok for `pat_ty` to return `Err` even if type checking is done, because it uses `infcx.node_ty` which is supposed to return `Err` for all kinds of erroneous types so its callers could quickly bail out with `?`.

r? @arielb1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

2 participants