{"action":"opened","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/28099","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/28099/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/28099/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/28099/events","html_url":"https://github.com/rust-lang/rust/issues/28099","id":103931009,"number":28099,"title":"ICE at static boxed mutable function","user":{"login":"kimwallmark","id":193067,"avatar_url":"https://avatars.githubusercontent.com/u/193067?v=3","gravatar_id":"","url":"https://api.github.com/users/kimwallmark","html_url":"https://github.com/kimwallmark","followers_url":"https://api.github.com/users/kimwallmark/followers","following_url":"https://api.github.com/users/kimwallmark/following{/other_user}","gists_url":"https://api.github.com/users/kimwallmark/gists{/gist_id}","starred_url":"https://api.github.com/users/kimwallmark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kimwallmark/subscriptions","organizations_url":"https://api.github.com/users/kimwallmark/orgs","repos_url":"https://api.github.com/users/kimwallmark/repos","events_url":"https://api.github.com/users/kimwallmark/events{/privacy}","received_events_url":"https://api.github.com/users/kimwallmark/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-30T15:38:17Z","updated_at":"2015-08-30T15:38:17Z","closed_at":null,"body":"I tried this code:\r\nstatic no_op : Box<FnMut(i32)> = Box::new(move |_| { });\r\nfn main() {\r\n}\r\n\r\nI expected it to compile cleanly or give me a helpful error.  Instead, it gave me a helpful error and then an ICE:\r\n\r\nsrc/bug_repro.rs:1:34: 1:56 error: function calls in statics are limited to struct and enum constructors [E0015]\r\nsrc/bug_repro.rs:1 static no_op : Box<FnMut(i32)> = Box::new(move |_| { });\r\n                                                    ^~~~~~~~~~~~~~~~~~~~~~\r\nsrc/bug_repro.rs:1:34: 1:56 help: run `rustc --explain E0015` to see a detailed explanation\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\nnote: run with `RUST_BACKTRACE=1` for a backtrace\r\nthread 'rustc' panicked at 'assertion failed: self.mode == Mode::Var', /home/rustbuild/src/rust-buildbot/slave/stable-dist-rustc-linux/build/src/librustc/middle/check_const.rs:254\r\n\r\nVersion:\r\n rustc --version --verbose\r\nrustc 1.1.0 (35ceea399 2015-06-19)\r\nbinary: rustc\r\ncommit-hash: 35ceea3997c79a3b7562e89b462ab76af5b86b22\r\ncommit-date: 2015-06-19\r\nhost: x86_64-unknown-linux-gnu\r\nrelease: 1.1.0\r\n\r\nstack backtrace:\r\n   1:     0x7f87cd852529 - sys::backtrace::write::ha3b8868b13c6f5b594r\r\n   2:     0x7f87cd85a449 - panicking::on_panic::h0d4f0a7bb69824a9iJw\r\n   3:     0x7f87cd81b242 - rt::unwind::begin_unwind_inner::h6eae1ff9ccde81e1sow\r\n   4:     0x7f87cb69a14e - rt::unwind::begin_unwind::h5657407561811364434\r\n   5:     0x7f87cb7e0352 - middle::check_const::CheckCrateVisitor<'a, 'tcx>.Visitor<'v>::visit_fn::hd06dbbc963009a38mQd\r\n   6:     0x7f87cb7e327b - visit::walk_expr::h7428632329866803358\r\n   7:     0x7f87cb7daf58 - middle::check_const::CheckCrateVisitor<'a, 'tcx>.Visitor<'v>::visit_expr::ha2cfc0edff92e762pSd\r\n   8:     0x7f87cb7dae1e - middle::check_const::CheckCrateVisitor<'a, 'tcx>.Visitor<'v>::visit_expr::ha2cfc0edff92e762pSd\r\n   9:     0x7f87cb7c6150 - middle::check_const::CheckCrateVisitor<'a, 'tcx>::global_expr::h84b8593855198411OFd\r\n  10:     0x7f87cb7df439 - middle::check_const::CheckCrateVisitor<'a, 'tcx>.Visitor<'v>::visit_item::h07c7afb9c4056bb8tLd\r\n  11:     0x7f87cb7e799a - middle::check_const::check_crate::h91fd962e256ef08cnke\r\n  12:     0x7f87cdda222e - driver::phase_3_run_analysis_passes::h9b9e8dc3e9bbf431tGa\r\n  13:     0x7f87cdd8606c - driver::compile_input::h6e596544d26b4394Qba\r\n  14:     0x7f87cde3c041 - run_compiler::haa6c0289fab7415475b\r\n  15:     0x7f87cde39892 - boxed::F.FnBox<A>::call_box::h10721825727138786690\r\n  16:     0x7f87cde38e59 - rt::unwind::try::try_fn::h6014602198652783625\r\n  17:     0x7f87cd8d2b58 - rust_try_inner\r\n  18:     0x7f87cd8d2b45 - rust_try\r\n  19:     0x7f87cde390f4 - boxed::F.FnBox<A>::call_box::h5510246712457526188\r\n  20:     0x7f87cd8591e1 - sys::thread::Thread::new::thread_start::h11fbc90f6ba541f9zvv\r\n  21:     0x7f87c80dd6a9 - start_thread\r\n  22:     0x7f87cd4a2eec - clone\r\n  23:                0x0 - <unknown>\r\n\r\n"}}