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

ICE when assigning a method to a variable #18412

Closed
murarth opened this issue Oct 29, 2014 · 2 comments · Fixed by #18413
Closed

ICE when assigning a method to a variable #18412

murarth opened this issue Oct 29, 2014 · 2 comments · Fixed by #18413

Comments

@murarth
Copy link
Contributor

murarth commented Oct 29, 2014

I was curious whether it would be possible to treat a method like a function, so I gave it a try.

struct A;

impl A {
    fn foo(&self) { }
}

fn main() {
    let f = A::foo;
    f(&A);
}

This is the version of rustc:

$ rustc -v
rustc 0.13.0-nightly (bd7138dd6 2014-10-27 23:02:55 +0000)

And this is the error:

x.rs:8:13: 8:19 error: internal compiler error: uncategorized def for expr 26: DefMethod(DefId { krate: 0, node: 8 }, None, FromImpl(DefId { krate: 0, node: 7 }))
x.rs:8     let f = A::foo;
                   ^~~~~~
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:116

stack backtrace:
   1:     0x7ffe6856e070 - rt::backtrace::imp::write::h5a0997daa091452aAdq
   2:     0x7ffe68571160 - failure::on_fail::hc2bbfb16552a42a7Xyq
   3:     0x7ffe6caae180 - unwind::begin_unwind_inner::hba0c3c1372f5cb73PRd
   4:     0x7ffe692c39b0 - unwind::begin_unwind::h2734907025152909083
   5:     0x7ffe692c3930 - diagnostic::SpanHandler::span_bug::h963265597453565ah6F
   6:     0x7ffe6d4a4b10 - middle::ty::expr_kind::hdf6435478ca3d03fa9I
   7:     0x7ffe6d46cb30 - middle::trans::expr::trans_into::h59e7bbcc4d5362a6dG4
   8:     0x7ffe6d536370 - middle::trans::_match::store_local::closure.126275
   9:     0x7ffe6d536160 - middle::trans::_match::mk_binding_alloca::h7586589838283757987
  10:     0x7ffe6d505760 - middle::trans::_match::store_local::haee979a4ae164c29qwk
  11:     0x7ffe6d46c180 - middle::trans::base::init_local::h14997c0412bcab7fybg
  12:     0x7ffe6d46b540 - middle::trans::controlflow::trans_stmt::h0b313766085d2deenR0
  13:     0x7ffe6d46cf50 - middle::trans::controlflow::trans_block::he2d4b6f33ad56bdctW0
  14:     0x7ffe6d50c730 - middle::trans::base::trans_closure::hf302583eb5981ca2Y2g
  15:     0x7ffe6d460250 - middle::trans::base::trans_fn::h2698897672e52421meh
  16:     0x7ffe6d45d990 - middle::trans::base::trans_item::h108ceed97013196fFxh
  17:     0x7ffe6d516d10 - middle::trans::base::trans_crate::h2959ddec9d0661d4wvi
  18:     0x7ffe6d934da0 - driver::driver::phase_4_translate_to_llvm::h871e70ba7828df26FnA
  19:     0x7ffe6d92b610 - driver::driver::compile_input::hc2f03680b6cd2d08zUz
  20:     0x7ffe6d9ae5c0 - driver::run_compiler::h7d611b9a41d83191KHD
  21:     0x7ffe6d9ae4b0 - driver::run::closure.144980
  22:     0x7ffe6d12bfd0 - task::TaskBuilder<S>::try_future::closure.103244
  23:     0x7ffe6d12bdc0 - task::TaskBuilder<S>::spawn_internal::closure.103215
  24:     0x7ffe6cdf8a80 - task::NativeSpawner.Spawner::spawn::closure.8444
  25:     0x7ffe6cb07650 - rust_try_inner
  26:     0x7ffe6cb07640 - rust_try
  27:     0x7ffe6caab920 - unwind::try::hc0b42c9b6f96abb8xGd
  28:     0x7ffe6caab7b0 - task::Task::run::h1c3d2c1e07305f00nMc
  29:     0x7ffe6cdf87c0 - task::NativeSpawner.Spawner::spawn::closure.8382
  30:     0x7ffe6caad050 - thread::thread_start::h962311e4e7f76acfC7c
  31:     0x7ffe6791b0c0 - start_thread
  32:     0x7ffe6c775f89 - __clone
  33:                0x0 - <unknown>
@alexcrichton
Copy link
Member

cc @nick29581

@bkoropoff
Copy link
Contributor

#18177 doesn't seem to address this, but the fix appears simple

bkoropoff added a commit to bkoropoff/rust that referenced this issue Oct 29, 2014
This just adds some missing match cases in ty and trans

Closes rust-lang#18412
bkoropoff added a commit to bkoropoff/rust that referenced this issue Oct 29, 2014
lnicola added a commit to lnicola/rust that referenced this issue Oct 29, 2024
internal: Stop producing .gz artifacts for Windows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants