Skip to content

ICE: index out of bounds: the len is 1 but the index is 1 #18345

Closed
@ruuda

Description

@ruuda

Minimal example to reproduce (compile as lib):

type Step<'s, R, T> = |R, T|: 's -> R;
type Transducer<'t, R, T, U> = |Step<'t, R, U>|: 't -> Step<'t, R, T>;

fn mapping<'f, R, T, U>(f: |T|: 'f -> U) -> &'f Transducer<'f, R, T, U> {
    |step| |r, x| step(r, f(x))
}

When &'f is removed, this does not ICE.

Backtrace:

src\lib.rs:5:19: 5:23 error: the type of this value must be known in this context
src\lib.rs:5     |step| |r, x| step(r, f(x))
                               ^~~~
src\lib.rs:5:19: 5:32 error: the type of this value must be known in this context
src\lib.rs:5     |step| |r, x| step(r, f(x))
                               ^~~~~~~~~~~~~
src\lib.rs:5:19: 5:32 error: cannot use call notation; the first type parameter for the function trait is neither a tuple nor unit [E0059]
src\lib.rs:5     |step| |r, x| step(r, f(x))
                               ^~~~~~~~~~~~~
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'index out of bounds: the len is 1 but the index is 1', C:\bot\slave\nightly-win-64\build\src\librustc\lib.rs:1

stack backtrace:
   1:         0x66be4310 - ZN2rt9backtrace3imp5write20h934065ecf3007278mJqE
   2:         0x66be7dec - ZN2rt4init20h4292e4f337cb4f72SWqE
   3:         0x668465bd - ZN6unwind18begin_unwind_inner20hf882ab956f0fa8d10odE
   4:         0x668462df - ZN6unwind16begin_unwind_fmt20hf3a962d8a6ecff9bsmdE
   5:         0x66846054 - rust_begin_unwind
   6:         0x6689f383 - ZN7failure8fail_fmt20hfd6527033c0675afJ6jE
   7:         0x6689f2bd - ZN7failure17fail_bounds_check20h203b816dba18350ei5jE
   8:           0xb7825c - ZN6middle6typeck5check33LvaluePreference...std..fmt..Show3fmt20h80b014a110e9c593EpXE
   9:           0xb76775 - ZN6middle6typeck5check33LvaluePreference...std..fmt..Show3fmt20h80b014a110e9c593EpXE
  10:           0xb75e79 - ZN6middle6typeck5check33LvaluePreference...std..fmt..Show3fmt20h80b014a110e9c593EpXE
  11:           0xb79de8 - ZN6middle6typeck5infer36InferCtxt$LT$$x27a$C$$x20$x27tcx$GT$17next_float_var_id20h648ccc13102fcd036QgE
  12:           0xb42ed5 - ZN6middle6typeck5check67GatherLocalsVisitor$LT$$x27a$C$$x20$x27tcx$GT$.Visitor$LT$$x27v$GT$10visit_item20h0435a11cd4e677cfkbVE
  13:           0xb3eb21 - ZN6middle6typeck5check16check_item_types20haa06e749d835c720YZUE
  14:           0xb84a3a - ZN6middle6typeck5check9may_break20h7fb024cf507262edEI1E
  15:           0xb7ae80 - ZN6middle6typeck5infer36InferCtxt$LT$$x27a$C$$x20$x27tcx$GT$17next_float_var_id20h648ccc13102fcd036QgE
  16:           0xb42ed5 - ZN6middle6typeck5check67GatherLocalsVisitor$LT$$x27a$C$$x20$x27tcx$GT$.Visitor$LT$$x27v$GT$10visit_item20h0435a11cd4e677cfkbVE
  17:           0xb3eb21 - ZN6middle6typeck5check16check_item_types20haa06e749d835c720YZUE
  18:           0xb84a3a - ZN6middle6typeck5check9may_break20h7fb024cf507262edEI1E
  19:           0xb7ae80 - ZN6middle6typeck5infer36InferCtxt$LT$$x27a$C$$x20$x27tcx$GT$17next_float_var_id20h648ccc13102fcd036QgE
  20:           0xb42ed5 - ZN6middle6typeck5check67GatherLocalsVisitor$LT$$x27a$C$$x20$x27tcx$GT$.Visitor$LT$$x27v$GT$10visit_item20h0435a11cd4e677cfkbVE
  21:           0xb3eb21 - ZN6middle6typeck5check16check_item_types20haa06e749d835c720YZUE
  22:           0xb3e036 - ZN6middle6typeck5check16check_item_types20haa06e749d835c720YZUE
  23:           0xb399be - ZN6middle6typeck5check10check_item20h6c957f569297abcfPkVE
  24:           0xb3dec1 - ZN6middle6typeck5check16check_item_types20haa06e749d835c720YZUE
  25:           0x6239e6 - ZN8metadata6cstore6CStore21get_used_crate_source20h6f5bb0bd0dc9f8edvHxE
  26:           0xe1607c - ZN6middle6typeck11check_crate20h2e65239b4c9f3bd8QHnE
  27:           0xe808e0 - ZN6driver6driver27phase_3_run_analysis_passes20haaecab27067904a27kAE
  28:           0xe7b403 - ZN6driver6driver13compile_input20h1c7fd93bac6d1b6cS1zE
  29:           0xf00555 - ZN6driver7monitor20h8e01e22495d9d147EDEE
  30:           0xefe880 - ZN6driver7monitor20h8e01e22495d9d147EDEE
  31:           0x63d565 - ZN6driver6driver35OutputFilenames...std..clone..Clone5clone20h544ba2b215219c40mRAE
  32:           0x63d497 - ZN6driver6driver35OutputFilenames...std..clone..Clone5clone20h544ba2b215219c40mRAE
  33:         0x7072b36c - ZN4task15Ops.rt..Runtime4wrap20h09aff520fc9440e4eyeE
  34:         0x668aae4f - rust_try
  35:         0x668aae29 - rust_try
  36:         0x6684456e - ZN6unwind3try20hf68ddd0d42564cdb4bdE
  37:         0x668443a9 - ZN4task4Task3run20h97bab04403f5fe37eFcE
  38:         0x7072b170 - ZN4task15Ops.rt..Runtime4wrap20h09aff520fc9440e4eyeE
  39:         0x66845b5d - ZN6thread7cleanup20h49ddb49977ad2dc04YcE
  40:         0x772959ed - BaseThreadInitThunk

Version:

rustc 0.13.0-nightly (172b59abe 2014-10-25 00:32:07 +0000)
binary: rustc
commit-hash: 172b59abe510dde5826fec24377f208a19418c04
commit-date: 2014-10-25 00:32:07 +0000
host: x86_64-w64-mingw32
release: 0.13.0-nightly

OS: Windows 7 x64

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.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