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

Encountered a "freshend type" with id 0 but our counter is only at 0 #26056

Closed
apasel422 opened this issue Jun 6, 2015 · 2 comments
Closed
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@apasel422
Copy link
Contributor

Attempting to compile the following with my eclectic crate yields an ICE:

extern crate eclectic;

use eclectic::*;
use std::collections::HashMap;

fn main() {
    let mut m = Box::new(HashMap::new()) as Box<Map<Key = u32, Value = u16, MapValue = u16>>;
}

Output from rustc 1.2.0-nightly (613e57b44 2015-06-01) (built 2015-06-02)

error: internal compiler error: Encountered a freshend type with id 0 but our counter is only at 0
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
thread 'rustc' panicked at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:249

stack backtrace:
   1:     0x7f08dda43733 - sys::backtrace::write::h8f69c25b82e602958cs
   2:     0x7f08dda4b669 - panicking::on_panic::hfa966c25addcbd02XXw
   3:     0x7f08dda0bcfa - rt::unwind::begin_unwind_inner::h75eec641d76d2f34HDw
   4:     0x7f08dad4121d - rt::unwind::begin_unwind::h14500343321142098312
   5:     0x7f08dad422cb - diagnostic::Handler::bug::h9e4df7b884e0ff65SwC
   6:     0x7f08dba785a1 - middle::infer::freshen::TypeFreshener<'a, 'tcx>.TypeFolder<'tcx>::fold_ty::hbba8394a1318ccd19Tx
   7:     0x7f08dba7a359 - middle::ty_fold::TypeFolder::fold_substs::h12490848347031286316
   8:     0x7f08dba7a4c7 - middle::ty_fold::TypeFolder::fold_trait_ref::h366400209910128023
   9:     0x7f08dba78aca - middle::infer::freshen::TypeFreshener<'a, 'tcx>.TypeFolder<'tcx>::fold_ty::hbba8394a1318ccd19Tx
  10:     0x7f08dba7a359 - middle::ty_fold::TypeFolder::fold_substs::h12490848347031286316
  11:     0x7f08dba7a4c7 - middle::ty_fold::TypeFolder::fold_trait_ref::h366400209910128023
  12:     0x7f08dba7a6a9 - vec::Vec<T>.FromIterator<T>::from_iter::h7804625273203759361
  13:     0x7f08dba78bfa - middle::infer::freshen::TypeFreshener<'a, 'tcx>.TypeFolder<'tcx>::fold_ty::hbba8394a1318ccd19Tx
  14:     0x7f08dba78645 - middle::infer::freshen::TypeFreshener<'a, 'tcx>.TypeFolder<'tcx>::fold_ty::hbba8394a1318ccd19Tx
  15:     0x7f08dba7a359 - middle::ty_fold::TypeFolder::fold_substs::h12490848347031286316
  16:     0x7f08db9ec204 - middle::traits::select::SelectionContext<'cx, 'tcx>::select::h456eea09c6f56102ZCR
  17:     0x7f08dbaf0364 - middle::traits::fulfill::FulfillmentContext<'tcx>::select::h0b0ca9cf88804e1dutP
  18:     0x7f08dbaef7cb - middle::traits::fulfill::FulfillmentContext<'tcx>::select_where_possible::h024ac6ace12ce31bIsP
  19:     0x7f08db991b36 - middle::traits::fulfill::FulfillmentContext<'tcx>::select_all_or_error::h22aff0507cad5936VqP
  20:     0x7f08dbb3b6a1 - middle::traits::evaluate_builtin_bound::h6e70f995e202484e3tW
  21:     0x7f08dbb3bd84 - middle::traits::type_known_to_meet_builtin_bound::h671317eb5d69fe1dQyW
  22:     0x7f08dd22b5cb - check::check_expr_with_unifier::h9262487761452434614
  23:     0x7f08dd25042a - check::check_decl_initializer::h560d058302b179c0pis
  24:     0x7f08dd2504fe - check::check_decl_local::hfdc555781b7d77f4xjs
  25:     0x7f08dd250729 - check::check_stmt::h68d4b68936a29aa0sls
  26:     0x7f08dd1fea9f - check::check_block_with_expected::hc7f9a96e5e0cf6ebDps
  27:     0x7f08dd1e0e86 - check::check_fn::h8e528748d4698667GYn
  28:     0x7f08dd1f8d62 - check::check_bare_fn::h5c9e5a029c40e37egOn
  29:     0x7f08dd1f6c92 - check::check_item_body::hc73fe14f4f5e38bb9eo
  30:     0x7f08dd1f8984 - check::check_item_types::hc534e279d6be8522NLn
  31:     0x7f08dd2b5016 - check_crate::h8370691d6b257a96g7C
  32:     0x7f08ddf98fff - driver::phase_3_run_analysis_passes::h074ae803b27ce882GGa
  33:     0x7f08ddf7c19c - driver::compile_input::hda494d426ffc5b8bQba
  34:     0x7f08de031cc1 - run_compiler::hd539ddde81e1e162n6b
  35:     0x7f08de02f512 - boxed::F.FnBox<A>::call_box::h2241471336346299975
  36:     0x7f08de02ed19 - rt::unwind::try::try_fn::h1392995902660742682
  37:     0x7f08ddac44e8 - rust_try_inner
  38:     0x7f08ddac44d5 - rust_try
  39:     0x7f08dda36ee7 - rt::unwind::try::inner_try::hfac58a0de8636543Azw
  40:     0x7f08de02ef39 - boxed::F.FnBox<A>::call_box::h9914386528590371672
  41:     0x7f08dda4a321 - sys::thread::Thread::new::thread_start::h5dbb55e110740b5cMJv
  42:     0x7f08d7a2b6a9 - start_thread
  43:     0x7f08dd692eec - clone
  44:                0x0 - <unknown>
@steveklabnik steveklabnik added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Jun 8, 2015
@apasel422
Copy link
Contributor Author

Reduced:

use std::collections::HashMap;

trait Map: MapLookup<<Self as Map>::Key> {
    type Key;
    type Value;
}

impl<K, V> Map for HashMap<K, V> {
    type Key = K;
    type Value = V;
}

trait MapLookup<Q> {
    type MapValue;
}

impl<K, V> MapLookup<K> for HashMap<K, V> {
    type MapValue = V;
}

fn main() {
    let _ = &HashMap::new()
        as &Map<Key = u32, Value = u16, MapValue = u16>;
}

arielb1 added a commit to arielb1/rust that referenced this issue Oct 23, 2015
…being it

This is a [breaking-change]:lang, but the broken code does not make
much sense.

Fixes rust-lang#26056
bors added a commit that referenced this issue Oct 24, 2015
…being it

This is a [breaking-change]:lang, but the broken code does not make
much sense.

Fixes #26056

r? @eddyb
@tupshin
Copy link

tupshin commented Dec 9, 2016

I'm able to reproduce this exact same error on stable and nightly today using this 8 line example:
https://is.gd/CUG30C

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

3 participants