{"action":"closed","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/28267","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/28267/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/28267/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/28267/events","html_url":"https://github.com/rust-lang/rust/issues/28267","id":105068506,"number":28267,"title":"ICE returning arrays with length specified by an associated constant","user":{"login":"dcrewi","id":1852207,"avatar_url":"https://avatars.githubusercontent.com/u/1852207?v=3","gravatar_id":"","url":"https://api.github.com/users/dcrewi","html_url":"https://github.com/dcrewi","followers_url":"https://api.github.com/users/dcrewi/followers","following_url":"https://api.github.com/users/dcrewi/following{/other_user}","gists_url":"https://api.github.com/users/dcrewi/gists{/gist_id}","starred_url":"https://api.github.com/users/dcrewi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcrewi/subscriptions","organizations_url":"https://api.github.com/users/dcrewi/orgs","repos_url":"https://api.github.com/users/dcrewi/repos","events_url":"https://api.github.com/users/dcrewi/events{/privacy}","received_events_url":"https://api.github.com/users/dcrewi/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rust-lang/rust/labels/I-ICE","name":"I-ICE","color":"e10c02"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-09-06T03:21:01Z","updated_at":"2015-09-08T17:23:54Z","closed_at":"2015-09-08T17:23:54Z","body":"### code\r\n```rust\r\n#![feature(associated_consts)]\r\n\r\ntrait Trait {\r\n    const SIZE: usize;\r\n}\r\n\r\npub fn cause_compiler_to_panic<T: Trait>() -> [u8; T::SIZE] {\r\n    unimplemented!()\r\n}\r\n\r\n```\r\n### compiler output\r\n```\r\n$ RUST_BACKTRACE=1 rustc --crate-type rlib compiler_panic.rs\r\nerror: internal compiler error: unexpected panic\r\nnote: the compiler unexpectedly panicked. this is a bug.\r\nnote: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports\r\nthread 'rustc' panicked at 'no path elem for NodeTyParam(TyParam { ident: T#0, id: 12, bounds: [TraitTyParamBound(PolyTraitRef { bound_lifetimes: [], trait_ref: TraitRef { path: path(Trait), ref_id: 13 }, span: compiler_panic.rs:15:35: 15:40 }, None)], default: None, span: compiler_panic.rs:15:32: 15:33 })', src/librustc/front/map/mod.rs:488\r\n\r\nstack backtrace:\r\n   1:     0x7f49381bbc99 - sys::backtrace::tracing::imp::write::hbc14f1d64893fa38REs\r\n   2:     0x7f49381c2946 - panicking::on_panic::h2f9a11502875a3547ox\r\n   3:     0x7f493818641e - rt::unwind::begin_unwind_inner::h9f15d88ec266cbe3DRw\r\n   4:     0x7f4938187167 - rt::unwind::begin_unwind_fmt::h7bb2b8a52c6074abJQw\r\n   5:     0x7f49360c9214 - front::map::Map<'ast>::get_path_elem::h810c6a17cb85afb1jeb\r\n   6:     0x7f493637aee7 - front::map::Map<'ast>::with_path_next::h6183113809238491628\r\n   7:     0x7f49362268f9 - middle::ty::ctxt<'tcx>::item_path_str::h29769059e7d6586b5Vb\r\n   8:     0x7f49362256bb - middle::def_id::DefId.fmt..Debug::fmt::h6e39007ab82770f3Oap\r\n   9:     0x7f4938232e65 - fmt::write::ha67db0db2f6a096ce8Q\r\n  10:     0x7f493820f7a0 - fmt::builders::DebugTuple<'a, 'b>::field::h2ce8d9f33236cafaDwQ\r\n  11:     0x7f49361b5115 - middle::def::Def...std..fmt..Debug::fmt::h938391f0b3e7112dsJn\r\n  12:     0x7f4938232e65 - fmt::write::ha67db0db2f6a096ce8Q\r\n  13:     0x7f493820f274 - fmt::builders::DebugStruct<'a, 'b>::field::haef609d3419cdbd2JrQ\r\n  14:     0x7f49362265b1 - fmt::_&'a T.Debug::fmt::h17657018559682767623\r\n  15:     0x7f4938232e65 - fmt::write::ha67db0db2f6a096ce8Q\r\n  16:     0x7f49381870ea - rt::unwind::begin_unwind_fmt::h7bb2b8a52c6074abJQw\r\n  17:     0x7f49361c70c5 - middle::const_eval::eval_const_expr_partial::hbec1acc1da716a81GTk\r\n  18:     0x7f493754f37c - astconv::ast_ty_to_ty::h7a1c0c0cca136ce6Cjx\r\n  19:     0x7f493759718d - astconv::convert_ty_with_lifetime_elision::h62c494c14aa9de2fthw\r\n  20:     0x7f493759fc8e - astconv::ty_of_method_or_bare_fn::hcabe6144b8119a6eHBx\r\n  21:     0x7f49375c1a60 - collect::type_scheme_of_item::he0f646ae1f45c0d9X9z\r\n  22:     0x7f49375b9e29 - collect::convert_typed_item::hed81c40d50d02aa4HeA\r\n  23:     0x7f49375a55ce - collect::convert_item::h415e2accc707fad518y\r\n  24:     0x7f49375a2577 - collect::collect_item_types::h2934ed33155c9781xky\r\n  25:     0x7f49375edc2b - check_crate::hfe64eeb39daabb000BE\r\n  26:     0x7f49386f027d - driver::phase_3_run_analysis_passes::closure.21698\r\n  27:     0x7f49386d28a3 - middle::ty::ctxt<'tcx>::create_and_enter::h17134548426382567756\r\n  28:     0x7f49386cdd7e - driver::phase_3_run_analysis_passes::h13764670269333747744\r\n  29:     0x7f49386ad6fd - driver::compile_input::h3c82c6370b45f42aYba\r\n  30:     0x7f49388154fb - run_compiler::h551ac01c07dc0a95eqc\r\n  31:     0x7f4938812e17 - boxed::F.FnBox<A>::call_box::h12386432182602546056\r\n  32:     0x7f4938812884 - rt::unwind::try::try_fn::h15469726732675206848\r\n  33:     0x7f49381c24e8 - __rust_try\r\n  34:     0x7f49381ae5e2 - rt::unwind::try::inner_try::h58375fb23cadeb38wNw\r\n  35:     0x7f4938812a18 - boxed::F.FnBox<A>::call_box::h11817215854212583186\r\n  36:     0x7f49381c1933 - sys::thread::Thread::new::thread_start::h255e2285f2cbfbcekXv\r\n  37:     0x7f49324c86a9 - start_thread\r\n  38:     0x7f4937e40eec - clone\r\n  39:                0x0 - <unknown>\r\n```\r\n### verbose compiler info\r\n```\r\n$ rustc --version --verbose\r\nrustc 1.4.0-dev (205c356ac 2015-09-05)\r\nbinary: rustc\r\ncommit-hash: 205c356ace559f511d5b7e51fd6b8c46bb4cc1ea\r\ncommit-date: 2015-09-05\r\nhost: x86_64-unknown-linux-gnu\r\nrelease: 1.4.0-dev\r\n```\r\n\r\n### other thoughts\r\nI would have expected the accepted way to write the array size would be `<T as Trait>::SIZE`, but that fails to compile with this error message:\r\n```\r\ncompiler_panic.rs:7:52: 7:70 error: array length constant evaluation error: non-constant path in constant expr [E0250]\r\ncompiler_panic.rs:7 pub fn cause_compiler_to_panic<T: Trait>() -> [u8; <T as Trait>::SIZE] {\r\n                                                                       ^~~~~~~~~~~~~~~~~~\r\ncompiler_panic.rs:7:52: 7:70 help: run `rustc --explain E0250` to see a detailed explanation\r\nerror: aborting due to previous error\r\n```"}}