Skip to content

function calls in statics cause internal compiler error #26643

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
sj6219 opened this issue Jun 29, 2015 · 2 comments
Closed

function calls in statics cause internal compiler error #26643

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

Comments

@sj6219
Copy link

sj6219 commented Jun 29, 2015

Source is very simple.

//
//
static F : Box< Fn(i32) -> i32 > = Box::new(move |x:i32| x);

fn main() {
}
//
//

this code generate fault as follows.

src\main.rs:2:34: 2:58 error: function calls in statics are limited to struct an
d enum constructors [E0015]
src\main.rs:2 static F : Box<Fn(i32) -> i32> = Box::new(move |x:i32| x);
^~~~~~~~~~~~~~~~~~~~~~~~
error: internal compiler error: unexpected panic
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
note: run with RUST_BACKTRACE=1 for a backtrace
thread 'rustc' panicked at 'assertion failed: self.mode == Mode::Var', C:/bot/sl
ave/beta-dist-rustc-win-64/build/src/librustc\middle\check_const.rs:232

Could not compile hello_world.

To learn more, run the command again with --verbose.

@sfackler sfackler added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Jun 29, 2015
@frewsxcv
Copy link
Member

This causes an ICE on 1.1.0. This does not cause in ICE on 1.2.0 beta.

I assume this caused by the use of a static closure. If so, this is a duplicate of #25180

@arielb1
Copy link
Contributor

arielb1 commented Jun 30, 2015

Duplicate of #25180.

@arielb1 arielb1 closed this as completed Jun 30, 2015
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

4 participants