Skip to content

internal compiler error: Explicit deref of non-derefable type #15756

Closed
@awelkie

Description

@awelkie

The following code:

use std::slice::Chunks;
use std::slice::MutChunks;

fn dft_iter<'a, T>(arg1: Chunks<'a,T>, arg2: MutChunks<'a,T>)
{
    for &something in arg2
    {
    }
}

gives the following compiler error (when run with RUST_BACKTRACE=1):

➤ env RUST_BACKTRACE=1 rustc error.rs --test
error.rs:6:9: 6:19 error: internal compiler error: Explicit deref of non-derefable type: &mut [T]
error.rs:6     for &something in arg2
                   ^~~~~~~~~~
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 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libsyntax/diagnostic.rs:115

stack backtrace:
   1:     0x7f0ceac27620 - rt::backtrace::imp::write::h0fea79425673725266p
   2:     0x7f0ceac2ae80 - failure::on_fail::h9aabe19bffc3104alsq
   3:     0x7f0ceb3feff0 - unwind::begin_unwind_inner::h9b55d31cfec63a9e40d
   4:     0x7f0ce98a5a90 - unwind::begin_unwind::h1183448402907672069
   5:     0x7f0ce98a59c0 - diagnostic::SpanHandler::span_bug::h5b8de884ef10a1cbUdy
   6:     0x7f0ceb8669c0 - driver::session::Session::span_bug::hf691bf888bfdb422Znt
   7:     0x7f0cebae8730 - middle::mem_categorization::MemCategorizationContext<'t, TYPER>::cat_deref::h4514730681874017381
   8:     0x7f0cebae6e30 - middle::mem_categorization::MemCategorizationContext<'t, TYPER>::cat_pattern::h12152313789936254827
   9:     0x7f0cebacd160 - middle::typeck::check::regionck::visit_local::h763740eedaeb1379i4b
  10:     0x7f0cebacd3d0 - visit::walk_block::h12723599008176341713
  11:     0x7f0cebac9050 - middle::typeck::check::regionck::visit_expr::h73423e7aa5968300D7b
  12:     0x7f0cebad0470 - visit::walk_expr::h17493730021457087419
  13:     0x7f0cebac9050 - middle::typeck::check::regionck::visit_expr::h73423e7aa5968300D7b
  14:     0x7f0cebacd3d0 - visit::walk_block::h12723599008176341713
  15:     0x7f0cebac9050 - middle::typeck::check::regionck::visit_expr::h73423e7aa5968300D7b
  16:     0x7f0cebad0470 - visit::walk_expr::h17493730021457087419
  17:     0x7f0cebac9050 - middle::typeck::check::regionck::visit_expr::h73423e7aa5968300D7b
  18:     0x7f0cebacd3d0 - visit::walk_block::h12723599008176341713
  19:     0x7f0cebb11e00 - middle::typeck::check::check_bare_fn::haf584d83c0be5c3bwBg
  20:     0x7f0cebb0ae60 - middle::typeck::check::check_item::h08679946a56c7e5fcah
  21:     0x7f0cebb11c00 - middle::typeck::check::check_item_types::hfa0d60d09ac306bcOAg
  22:     0x7f0cebc83a50 - middle::typeck::check_crate::h59523a23ed9761e6GhH
  23:     0x7f0cec00cd20 - driver::driver::phase_3_run_analysis_passes::h47669ed167b54bdezhs
  24:     0x7f0cec0085c0 - driver::driver::compile_input::h539bec547706263dA3r
  25:     0x7f0cec0c1050 - driver::run_compiler::h9cb91406a88d027059u
  26:     0x7f0cec0c0f60 - driver::main_args::closure.$x22closure$x22$LP$133605$RP$
  27:     0x7f0cec0d4ab0 - task::TaskBuilder<S>::try_future::closure.$x22closure$x22$LP$134754$RP$
  28:     0x7f0cec0d4840 - task::TaskBuilder<S>::spawn_internal::closure.$x22closure$x22$LP$134731$RP$
  29:     0x7f0ceca78df0 - task::spawn_opts::closure.$x22closure$x22$LP$8163$RP$
  30:     0x7f0ceb4567b0 - rust_try
  31:     0x7f0ceb3fc080 - unwind::try::hc59e8203d98cfea8tPd
  32:     0x7f0ceb3fbde0 - task::Task::run::hc5aad491de06c5bcP0c
  33:     0x7f0ceca78be0 - task::spawn_opts::closure.$x22closure$x22$LP$8109$RP$
  34:     0x7f0ceb3fe060 - thread::thread_start::h597549996b7dcb76nnd
  35:     0x7f0cea6a8e70 - start_thread
  36:     0x7f0ceb0c0db9 - clone
  37:                0x0 - <unknown>

rustc -v gives:

rustc 0.12.0-pre-nightly (afbcbbc77ffc6b10053bc543daf7d2e05d68cc01 2014-07-16 00:31:15 +0000)

I'm running this on Fedora 20, x86_64

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