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

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

Closed
awelkie opened this issue Jul 17, 2014 · 2 comments · Fixed by #19780
Closed

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

awelkie opened this issue Jul 17, 2014 · 2 comments · Fixed by #19780
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@awelkie
Copy link

awelkie commented Jul 17, 2014

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

@huonw huonw added the I-ICE label Jul 17, 2014
@ghost
Copy link

ghost commented Aug 18, 2014

Doesn't ICE any more but it fails exhaustiveness checks, which seems to be a separate bug:

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

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

fn main() { }
<anon>:6:9: 6:19 error: refutable pattern in `for` loop binding: `[]` not covered
<anon>:6     for &something in arg2
                 ^~~~~~~~~~

@ghost
Copy link

ghost commented Aug 18, 2014

Scratch that. This shouldn't typecheck as slices are not derefable.

@ghost ghost added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Nov 7, 2014
bors added a commit that referenced this issue Dec 18, 2014
Closes #5988.
Closes #10176.
Closes #10456.
Closes #12744.
Closes #13264.
Closes #13324.
Closes #14182.
Closes #15381.
Closes #15444.
Closes #15480.
Closes #15756.
Closes #16822.
Closes #16966.
Closes #17351.
Closes #17503.
Closes #17545.
Closes #17771.
Closes #17816.
Closes #17897.
Closes #17905.
Closes #18188.
Closes #18232.
Closes #18345.
Closes #18389.
Closes #18400.
Closes #18502.
Closes #18611.
Closes #18783.
Closes #19009.
Closes #19081.
Closes #19098.
Closes #19127.
Closes #19135.
bors added a commit to rust-lang-ci/rust that referenced this issue Nov 13, 2023
fix typo in mbe/lib.rs comment

fix typo in mbe/lib.rs comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants