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 on missing Target type in Deref implementation #20480

Closed
swatteau opened this issue Jan 3, 2015 · 3 comments
Closed

ICE on missing Target type in Deref implementation #20480

swatteau opened this issue Jan 3, 2015 · 3 comments

Comments

@swatteau
Copy link

swatteau commented Jan 3, 2015

Version of Rust: rustc 0.13.0-nightly (c894171 2015-01-02 21:56:13 +0000)
Operating system: Linux 3.16.0-4-686-pae #1 SMP Debian 3.16.7-ckt2-1 (2014-12-08) i686 GNU/Linux

When the associated Target type is not defined in an impl Deref, this leads to an internal compiler error.

Here is an example:

#![feature(associated_types)]
use std::ops::Deref;

struct Wrapper {
    inner: int
}

impl Deref for Wrapper {
    //type Target = int;
    fn deref(&self) -> &int {
        &self.inner
    }
}

fn main() {
}

Error message from the compiler:

src/main.rs:10:5: 12:6 error: internal compiler error: impl `VtableImpl(impl_def_id=DefId { krate: 0, node: 10 }:Wrapper.Deref, substs=Substs[types=[[];[];[]], regions=[[];[];[]]], nested=[[];[];[]])` did not contain projection for `Obligation(predicate=<Wrapper as TraitRef(Wrapper, core::ops::Deref)>::Target,depth=0)`
src/main.rs:10     fn deref(&self) -> &int {
src/main.rs:11         &self.inner
src/main.rs:12     }
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

Backtrace:

thread 'rustc' panicked at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:123

stack backtrace:
   1: 0xb7383f20 - sys::backtrace::write::h6d0a4417f4e5c493sit
   2: 0xb73a8770 - failure::on_fail::h17e5357971ef1fadTuz
   3: 0xb7310d00 - rt::unwind::begin_unwind_inner::h81966bf04c2cd1f4y9y
   4: 0xb389edb0 - rt::unwind::begin_unwind::h12436254939101185090
   5: 0xb389ed20 - diagnostic::SpanHandler::span_bug::h64fa6f5fbd27e941zFF
   6: 0xb6326a10 - middle::traits::project::project_type::h85510b9af23c51a6UQP
   7: 0xb6323b00 - middle::traits::project::opt_normalize_projection_type::h16b6e65a2aa8a5c1XIP
   8: 0xb6312320 - middle::traits::project::normalize_projection_type::h4e3c940bec71651byHP
   9: 0xb6324ea0 - middle::traits::project::AssociatedTypeNormalizer<'a, 'b, 'tcx>.TypeFolder<'tcx>::fold_ty::h3cbce0725be04edf9FP
  10: 0xb6324ea0 - middle::traits::project::AssociatedTypeNormalizer<'a, 'b, 'tcx>.TypeFolder<'tcx>::fold_ty::h3cbce0725be04edf9FP
  11: 0xb6dc4600 - middle::ty_fold::ty..FnSig<'tcx>.TypeFoldable<'tcx>::fold_with::h10991263838617593069
  12: 0xb6e58690 - check::assoc::normalize_associated_types_in::h9980513805539501870
  13: 0xb6e4eae0 - check::compare_impl_method::h37df9bd14bbfe837q4j
  14: 0xb6e3aed0 - check::check_item::hda7b1175944bf853SGj
  15: 0xb6ff1830 - check_crate::unboxed_closure.39847
  16: 0xb6fec070 - check_crate::h5a3950962091692dVlx
  17: 0xb76bf8b0 - driver::phase_3_run_analysis_passes::hf1b11de46876f77cTva
  18: 0xb76ad980 - driver::compile_input::h567277daca5fdd24wba
  19: 0xb777fa80 - thunk::F.Invoke<A, R>::invoke::h14467627679629470429
  20: 0xb777e890 - rt::unwind::try::try_fn::h7264457252665277252
  21: 0xb7418c90 - rust_try_inner
  22: 0xb7418c60 - rust_try
  23: 0xb777ebd0 - thunk::F.Invoke<A, R>::invoke::h428659666485879903
  24: 0xb73956c0 - sys::thread::thread_start::haeae5d792ecbddcdy8v
  25: 0xb36c4e30 - start_thread
  26: 0xb71eddf2 - clone
  27:        0x0 - <unknown>
@GuillaumeGomez
Copy link
Member

I have the same issue but with a different backtrace:

Compiling flate2 v0.1.1 (file:///home/imperio/rust/repo_git/flate2-rs)
/home/imperio/rust/repo_git/flate2-rs/src/raw.rs:54:26: 55:78 error: internal compiler error: impl `VtableImpl(impl_def_id=DefId { krate: 0, node: 3981 }:raw::Stream.Deref, substs=Substs[types=[[];[];[]], regions=[[];[];[]]], nested=[[];[];[]])` did not contain projection for `Obligation(predicate=<raw::Stream as TraitRef(raw::Stream, core::ops::Deref)>::Target,depth=0)`
/home/imperio/rust/repo_git/flate2-rs/src/raw.rs:54         try!(self.stream.write(&[], ffi::MZ_FINISH, &mut self.buf,
/home/imperio/rust/repo_git/flate2-rs/src/raw.rs:55                                self.inner.as_mut().unwrap(), ffi::mz_deflate));
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
thread 'rustc' panicked at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:123

stack backtrace:
   1:     0x7f7c9eb433e0 - sys::backtrace::write::h07654db4c803799asit
   2:     0x7f7c9eb68c10 - failure::on_fail::hcaec3177bc42e928Tuz
   3:     0x7f7c9eace2d0 - rt::unwind::begin_unwind_inner::hb226e8b72f3e677ey9y
   4:     0x7f7c99c30e30 - rt::unwind::begin_unwind::h4014735294015536206
   5:     0x7f7c99c30dc0 - diagnostic::SpanHandler::span_bug::hf36643a9ba759b90zFF
   6:     0x7f7c9ce9b670 - middle::traits::project::project_type::h92ecab34bfecdb26UQP
   7:     0x7f7c9ce987d0 - middle::traits::project::opt_normalize_projection_type::h6d8595fd5add6228XIP
   8:     0x7f7c9ce863a0 - middle::traits::project::normalize_projection_type::h570150b42252014cyHP
   9:     0x7f7c9ce99c70 - middle::traits::project::AssociatedTypeNormalizer<'a, 'b, 'tcx>.TypeFolder<'tcx>::fold_ty::heed1bc3ca5d7ef339FP
  10:     0x7f7c9ce99c70 - middle::traits::project::AssociatedTypeNormalizer<'a, 'b, 'tcx>.TypeFolder<'tcx>::fold_ty::heed1bc3ca5d7ef339FP
  11:     0x7f7c9e14ec80 - middle::ty_fold::ty..FnSig<'tcx>.TypeFoldable<'tcx>::fold_with::h11433372155515551456
  12:     0x7f7c9e164040 - check::method::lookup_in_trait_adjusted::hf5477c0e9796df5fJyh
  13:     0x7f7c9e1460e0 - check::try_overloaded_deref::ha1b0c1202063bbdePPl
  14:     0x7f7c9e152d70 - check::method::probe::probe::hc37a8fd9501aafc23If
  15:     0x7f7c9e20e6e0 - check::check_expr_with_unifier::check_method_call::he5ead07f2eb10ed9hPm
  16:     0x7f7c9e202be0 - check::check_expr_with_unifier::h2903680690164758454
  17:     0x7f7c9e0ee3a0 - check::_match::check_match::h2acbb9a8a0ccf0973Aa
  18:     0x7f7c9e22c230 - check::check_expr_with_unifier::h13231159384621416452
  19:     0x7f7c9e1cef30 - check::check_block_with_expected::hd824300850ddcee8CKo
  20:     0x7f7c9e23a540 - check::check_expr_with_unifier::h10793131406227171560
  21:     0x7f7c9e1cef30 - check::check_block_with_expected::hd824300850ddcee8CKo
  22:     0x7f7c9e1b85b0 - check::check_fn::h7223c9c594af73c5Lyj
  23:     0x7f7c9e1c9b20 - check::check_bare_fn::h8ccefd5610a5a146goj
  24:     0x7f7c9e1cfad0 - check::check_method_body::h72b0078144bcb29elQj
  25:     0x7f7c9e1c10c0 - check::check_item::h39fb2bbe81c824a9SGj
  26:     0x7f7c9e1c9690 - visit::walk_mod::h16234166799498673367
  27:     0x7f7c9e3619d0 - check_crate::unboxed_closure.39848
  28:     0x7f7c9e35c620 - check_crate::hb52a41bcb9b55409Vlx
  29:     0x7f7c9f093620 - driver::phase_3_run_analysis_passes::h33329f43054c2979Tva
  30:     0x7f7c9f081ac0 - driver::compile_input::h88016b50923aff2bwba
  31:     0x7f7c9f14ce00 - thunk::F.Invoke<A, R>::invoke::h18199457566815101468
  32:     0x7f7c9f14bbb0 - rt::unwind::try::try_fn::h5958693639131164017
  33:     0x7f7c9ebcf510 - rust_try_inner
  34:     0x7f7c9ebcf500 - rust_try
  35:     0x7f7c9f14bf00 - thunk::F.Invoke<A, R>::invoke::h2060855259774067648
  36:     0x7f7c9eb54f50 - sys::thread::thread_start::hb5d2265d5cf58673y8v
  37:     0x7f7c994540c0 - start_thread
  38:     0x7f7c9e773ec9 - __clone
  39:                0x0 - <unknown>

@kennytm
Copy link
Member

kennytm commented Jan 4, 2015

Duplicate of #20347

@alexcrichton
Copy link
Member

Thanks @kennytm!

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

No branches or pull requests

4 participants