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 with closure in array size #28189

Closed
arielb1 opened this issue Sep 3, 2015 · 4 comments
Closed

ICE with closure in array size #28189

arielb1 opened this issue Sep 3, 2015 · 4 comments
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.

Comments

@arielb1
Copy link
Contributor

arielb1 commented Sep 3, 2015

STR

struct S<T>(T) where [T; (||{}, 1).1]: Copy;                                    
fn main() {}

ICE

error: internal compiler error: ParameterEnvironment::from_item(): `unknown node
 (id=10)` is not an item
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/m
aster/CONTRIBUTING.md#bug-reports
thread 'rustc' panicked at 'Box<Any>', ../src/libsyntax/diagnostic.rs:253

stack backtrace:
   1:     0x7fbd20026278 - sys::backtrace::tracing::imp::write::ha9cbea636be565d
3Mns
                        at ../src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:40
   2:     0x7fbd2003051d - panicking::on_panic::h442c593a84f9e18f2ox
                        at ../src/libstd/panicking.rs:45
   3:     0x7fbd1ffe82d2 - rt::unwind::begin_unwind_inner::h4756f523b5ea47f6GRw
                        at ../src/libstd/rt/unwind/mod.rs:279
   4:     0x7fbd1aa267aa - rt::unwind::begin_unwind::h12315707193879185804
                        at ../src/libstd/rt/unwind/mod.rs:232
   5:     0x7fbd1aa27e5e - diagnostic::Handler::bug::h435e929ca6d65f67BUA
                        at /tmp/tmp.ebkarkShAE/rust/build-debug-assertions/<std 
macros>:3
   6:     0x7fbd1df1cb96 - session::Session::bug::h576a41ec8d8eacb7DVv
                        at ../src/librustc/session/mod.rs:218
   7:     0x7fbd1df2a168 - middle::ty::ParameterEnvironment<'a, 'tcx>::for_item:
:hdb8f422ac5af234chN7
                        at ../src/librustc/middle/ty.rs:3021
   8:     0x7fbd1df2a180 - middle::ty::ParameterEnvironment<'a, 'tcx>::for_item:
:hdb8f422ac5af234chN7
                        at ../src/librustc/middle/ty.rs:3018
   9:     0x7fbd1df2e25f - middle::check_const::CheckCrateVisitor<'a, 'tcx>::fn_
like::closure.87516
                        at ../src/librustc/middle/check_const.rs:120
                        at ../src/librustc/middle/check_const.rs:189
  10:     0x7fbd1df2e0f2 - middle::check_const::CheckCrateVisitor<'a, 'tcx>::fn_
like::hc6f2144bd55125b9iNf
                        at ../src/librustc/middle/check_const.rs:110
                        at ../src/librustc/middle/check_const.rs:188
  11:     0x7fbd1df36f6c - visit::walk_expr::h5840287169546543487 
                        at ../src/librustc/middle/check_const.rs:361
                        at ../src/librustc_front/visit.rs:775
  12:     0x7fbd1df2d8c4 - middle::check_const::CheckCrateVisitor<'a, 'tcx>.Visi
tor<'v>::visit_expr::h1e6440ffedf1f5b1T6f
                        at ../src/librustc/middle/check_const.rs:487
  13:     0x7fbd1df36e5e - visit::walk_expr::h5840287169546543487 
                        at ../src/librustc_front/visit.rs:731
  14:     0x7fbd1df2d8c4 - middle::check_const::CheckCrateVisitor<'a, 'tcx>.Visi
tor<'v>::visit_expr::h1e6440ffedf1f5b1T6f
                        at ../src/librustc/middle/check_const.rs:487
  15:     0x7fbd1df2d8c4 - middle::check_const::CheckCrateVisitor<'a, 'tcx>.Visi
tor<'v>::visit_expr::h1e6440ffedf1f5b1T6f
                        at ../src/librustc/middle/check_const.rs:487
  16:     0x7fbd1df2f222 - visit::walk_generics::h16750342663714166629
                        at ../src/librustc_front/visit.rs:74
                        at ../src/librustc_front/visit.rs:546
  17:     0x7fbd1df33a35 - visit::walk_item::h3258008959652563654 
                        at ../src/librustc_front/visit.rs:75
                        at ../src/librustc_front/visit.rs:277
  18:     0x7fbd1df3306f - middle::check_const::CheckCrateVisitor<'a, 'tcx>.Visi
tor<'v>::visit_item::h67bf74465fb74fe8vXf
                        at ../src/librustc/middle/check_const.rs:328
                        at ../src/librustc/middle/check_const.rs:110
                        at ../src/librustc/middle/check_const.rs:328
  19:     0x7fbd1df3da8a - middle::check_const::check_crate::h8dd919c3aab29c4bYD
g
                        at ../src/librustc_front/visit.rs:145
                        at ../src/librustc_front/visit.rs:63
                        at ../src/librustc_front/visit.rs:137
                        at ../src/librustc/middle/check_const.rs:818
  20:     0x7fbd20560b62 - driver::phase_3_run_analysis_passes::closure.21770
                        at ../src/librustc_driver/driver.rs:710   
                        at ../src/librustc/util/common.rs:39
                        at ../src/librustc_driver/driver.rs:709   
  21:     0x7fbd2055da33 - middle::ty::ctxt<'tcx>::create_and_enter::h9047943718302741165
                        at ../src/librustc/middle/ty.rs:1119
                        at ../src/libstd/thread/scoped_tls.rs:179
                        at ../src/librustc/middle/ty.rs:1119
                        at ../src/libstd/thread/local.rs:217
                        at ../src/librustc/middle/ty.rs:1115
                        at ../src/librustc/middle/ty.rs:3850
  22:     0x7fbd20558240 - driver::phase_3_run_analysis_passes::h374775803790228385
                        at ../src/librustc_driver/driver.rs:695
  23:     0x7fbd2053a28d - driver::compile_input::h46db35214f135fb6Yba
                        at ../src/librustc_driver/driver.rs:132
  24:     0x7fbd20627609 - run_compiler::hdc320804df1e5baebqc
                        at ../src/librustc_driver/lib.rs:159
  25:     0x7fbd206250d2 - boxed::F.FnBox<A>::call_box::h9983925303729200120
                        at ../src/librustc_driver/lib.rs:101
                        at ../src/librustc_driver/lib.rs:816
                        at ../src/liballoc/boxed.rs:493
  26:     0x7fbd20624ac9 - rt::unwind::try::try_fn::h13821349105823159516
                        at ../src/liballoc/boxed.rs:509
                        at ../src/libstd/thread/mod.rs:279
                        at ../src/libstd/rt/unwind/mod.rs:164
  27:     0x7fbd200300e8 - __rust_try
  28:     0x7fbd20016ac7 - rt::unwind::try::inner_try::h565d7516b5d175ddzNw
                        at ../src/libstd/rt/unwind/mod.rs:153
  29:     0x7fbd20624c76 - boxed::F.FnBox<A>::call_box::h9905813375732266964
                        at ../src/libstd/rt/unwind/mod.rs:136
                        at ../src/libstd/thread/mod.rs:279
                        at ../src/liballoc/boxed.rs:493
  30:     0x7fbd2002f2f5 - sys::thread::Thread::new::thread_start::h544d84bbe5bf933dmXv
  31:     0x7fbd1a251181 - start_thread
  32:     0x7fbd1fc9230c - __clone
  33:                0x0 - <unknown>

This is a distinct bug from #28181 (it is an 1.2-1.3 regression, not a 1.3-1.4 regression).

@arielb1 arielb1 added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Sep 3, 2015
@steveklabnik steveklabnik added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. and removed I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Oct 23, 2015
@steveklabnik
Copy link
Member

rust-lang/glacier#11 determined that this does, in fact, no longer ICE as of

rustc 1.5.0-nightly (7beebbe56 2015-10-22)

As such, we just need a test. I am happy to mentor anyone who wants to add one.

steveklabnik added a commit to rust-lang/glacier that referenced this issue Oct 23, 2015
@skeleten
Copy link
Contributor

I'd like to add that test. It probably just needs a run-pass test, doesn't it?

@steveklabnik
Copy link
Member

@skeleten yup! You'd put a file with these contents inside of src/test/run-pass :)

@oli-obk
Copy link
Contributor

oli-obk commented Nov 19, 2015

uhm... shouldn't this error, due to the fact that we can't have closures in constant expressions? It might not be used, but if it exists in a publicly exported const, it can be very surprising.

The only reason it works is due to the lazy nature of the const evaluator. Which is going to get us into trouble sooner than later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Projects
None yet
Development

No branches or pull requests

4 participants