Skip to content

ICE using an associated constant as an array length in a function parameter #26922

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

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

Comments

@ghost
Copy link

ghost commented Jul 9, 2015

The following code causes an ICE using the latest nightly.

 #![feature(associated_consts)] 

pub trait Test {
    const LENGTH: usize;

    fn method(array: [i32; Self::LENGTH]) {    }

}

fn main() { }

Running with RUST_BACKTRACE=1 gives

thread 'rustc' panicked at 'path not fully resolved: PathResolution { base_def: DefSelfTy(Some(DefId { krate: 0, node: 4 }Test), None), last_private: LastMod(AllPublic), depth: 1 }', ../src/librustc/middle/def.rs:81

stack backtrace:
   1:     0x7fcb00fecdde - sys::backtrace::write::h69183b7c98049b30wqs
   2:     0x7fcb00ff4a44 - panicking::on_panic::h2c3150d5b218c447i8w
   3:     0x7fcb00fb77ee - rt::unwind::begin_unwind_inner::hf9bdd075490425c8WNw
   4:     0x7fcb00fb851c - rt::unwind::begin_unwind_fmt::h6a9238aa2a13c0892Mw
   5:     0x7fcaff01d717 - middle::const_eval::eval_const_expr_with_substs::h14003455026798805522
   6:     0x7fcafefca59b - middle::const_eval::eval_const_expr_partial::hfb624d4880a32ba3IGk
   7:     0x7fcb007d5cf2 - astconv::ast_ty_to_ty::heeb2edb80837d1162Qv
   8:     0x7fcb008317ee - vec::Vec<T>.FromIterator<T>::from_iter::h3785597557409810636
   9:     0x7fcb00830d56 - astconv::ty_of_method_or_bare_fn::h7fc2677ba2149d77I6v
  10:     0x7fcb00849e9b - collect::convert_method::h2213f9f8b79b70d9Fsx
  11:     0x7fcb00838e74 - collect::convert_item::hbcf9d38ceb0aafd0cIx
  12:     0x7fcb00833917 - collect::collect_item_types::hacdb13c97b5df6d8zPw
  13:     0x7fcb00880a59 - check_crate::h0321f1e753acbcf9WWC
  14:     0x7fcb01555cd9 - driver::phase_3_run_analysis_passes::closure.15875
  15:     0x7fcb0155461b - middle::ty::ctxt<'tcx>::create_and_enter::h9079099211582893073
  16:     0x7fcb0154f5c1 - driver::phase_3_run_analysis_passes::h12132907910932298086
  17:     0x7fcb0152e83c - driver::compile_input::h3a475b0b9259362fTba
  18:     0x7fcb01614bd3 - run_compiler::h2cc1d87c2af5b2f0A7b
  19:     0x7fcb016125ae - boxed::F.FnBox<A>::call_box::h6791803627395147597
  20:     0x7fcb01611df9 - rt::unwind::try::try_fn::h10416075533806878094
  21:     0x7fcb0106f738 - rust_try_inner
  22:     0x7fcb0106f725 - rust_try
  23:     0x7fcb00fe00f7 - rt::unwind::try::inner_try::h6181b0bb7448f551PJw
  24:     0x7fcb0161200b - boxed::F.FnBox<A>::call_box::h6862050082343839214
  25:     0x7fcb00ff36a1 - sys::thread::Thread::new::thread_start::hadfe7238e1724c34CTv
  26:     0x7fcafac580a3 - start_thread
  27:     0x7fcb00c3e04c - clone
  28:                0x0 - <unknown>
$ rustc --version --verbose
rustc 1.3.0-nightly (16f64c388 2015-07-09)
binary: rustc
commit-hash: 16f64c38803e820fc20a669987395e663ced1387
commit-date: 2015-07-09
host: x86_64-unknown-linux-gnu
release: 1.3.0-nightly

This might be a duplicate of #24938 (although that issue is now closed) or #26402.

@steveklabnik steveklabnik added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Jul 9, 2015
@ghost
Copy link
Author

ghost commented Jul 30, 2015

cc @quantheory

@alexcrichton
Copy link
Member

Closing as a dupe of #25145

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

2 participants