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 #15480

Closed
mahkoh opened this issue Jul 6, 2014 · 3 comments · Fixed by #19780
Closed

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

mahkoh opened this issue Jul 6, 2014 · 3 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

@mahkoh
Copy link
Contributor

mahkoh commented Jul 6, 2014

fn main() {
    let &ref a = [0u].as_slice();
}
test.rs:2:9: 2:15 error: internal compiler error: Explicit deref of non-derefable type: &[uint]
test.rs:2     let &ref a = [0u].as_slice();
                  ^~~~~~
@jfager
Copy link
Contributor

jfager commented Jul 25, 2014

With backtrace:

export RUST_BACKTRACE=1; rustc r15480.rs 
r15480.rs:2:9: 2:15 error: internal compiler error: Explicit deref of non-derefable type: &[uint]
r15480.rs:2     let &ref a = [0u].as_slice();
                    ^~~~~~
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>', /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/libsyntax/ast_util.rs:784

stack backtrace:
   1:        0x112430835 - rt::backtrace::imp::write::h5d63a9f72ef354013fq
   2:        0x112433d9b - failure::on_fail::h89ada4236fabc57cmwq
   3:        0x1126d3829 - unwind::begin_unwind_inner::h4d1846566643d36fYXd
   4:        0x111ba14e4 - unwind::begin_unwind::h1316945459152882216
   5:        0x111ba1465 - diagnostic::SpanHandler::span_bug::h050393a5020e8271W3C
   6:        0x10f40d955 - driver::session::Session::span_bug::hc10d21d2b457e141DJx
   7:        0x10f7e5145 - middle::mem_categorization::MemCategorizationContext<'t, TYPER>::cat_deref::h8125247981898923686
   8:        0x10f7e31a5 - middle::mem_categorization::MemCategorizationContext<'t, TYPER>::cat_pattern::h13645017680664184286
   9:        0x10f7cb20d - middle::typeck::check::regionck::visit_local::h42acb69149b80471OaM
  10:        0x10f7cb3ca - visit::walk_block::h17231782441881723029
  11:        0x10f80c181 - middle::typeck::check::check_bare_fn::h5be886e12a74689ciNQ
  12:        0x10f805232 - middle::typeck::check::check_item::hfe41449e63dbede7VlR
  13:        0x10f80bead - middle::typeck::check::check_item_types::h08bd559eea95a15cAMQ
  14:        0x10f2519c4 - util::common::time::h7914738111600996838
  15:        0x10f9f682c - middle::typeck::check_crate::hfd4595a3c987ab71i5h
  16:        0x10fac7ce8 - driver::driver::phase_3_run_analysis_passes::h79777ef02491f761QBw
  17:        0x10fac2b20 - driver::driver::compile_input::h26a8582bf38a3d4avnw
  18:        0x10fb6bfbf - driver::run_compiler::h70fa80d88f179db6Ixz
  19:        0x10fb6a5a6 - driver::main_args::closure.$x22closure$x22$LP$138335$RP$
  20:        0x10fb7ce7b - task::TaskBuilder<S>::try_future::closure.$x22closure$x22$LP$139479$RP$
  21:        0x10fb7cd70 - task::TaskBuilder<S>::spawn_internal::closure.$x22closure$x22$LP$139456$RP$
  22:        0x11062c44c - task::spawn_opts::closure.$x22closure$x22$LP$8327$RP$
  23:        0x1127378ec - rust_try
  24:        0x1126d07ab - unwind::try::hd934ccd3bea02a143Ld
  25:        0x1126d0513 - task::Task::run::hfec74f59cf869534VXc
  26:        0x11062c2e1 - task::spawn_opts::closure.$x22closure$x22$LP$8272$RP$
  27:        0x1126d25d6 - thread::thread_start::h830410741c29e779tkd
  28:     0x7fff901fa899 - _pthread_body
  29:     0x7fff901fa72a - _pthread_struct_init

This is an explicit span_bug call in middle/mem_categorization, which I'm assuming implies that this error should have been caught upstream somewhere.

@mahkoh
Copy link
Contributor Author

mahkoh commented Sep 13, 2014

<anon>:21:13: 21:19 error: refutable pattern in local binding: `[]` not covered [E0005]
<anon>:21         let &ref a = [0u].as_slice();

@sfackler sfackler added E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. and removed E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. labels Sep 13, 2014
@sfackler sfackler added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Oct 8, 2014
@wackywendell
Copy link
Contributor

Here is another example program (rust playpen):

fn main() {
    let v = vec![&3i, &4i, &5i];

    for &&x in v.iter() {
        println!("{}", x + 3);
    }
}

Which yields

<anon>:4:10: 4:12 error: internal compiler error: Explicit deref of non-derefable type: core::slice::Items<'_, &int>
<anon>:4     for &&x in v.iter() {
                  ^~
note: the compiler unexpectedly panicked. 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' panicked at 'Box<Any>', /build/rust-git/src/rust/src/libsyntax/diagnostic.rs:116

playpen: application terminated with error code 101
Program ended.

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 Aug 21, 2023
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.

5 participants