Skip to content

Function call in static results in compiler panic #26289

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

Function call in static results in compiler panic #26289

grantslatton opened this issue Jun 14, 2015 · 2 comments

Comments

@grantslatton
Copy link

See http://is.gd/0FO78Z

Code:

pub type TypeWithLifetime<'a> = Box<Fn() -> () + 'a>;

static static_closure : TypeWithLifetime<'static> = Box::new(|| {
    panic!()
});

fn main() {}

Error:

6:3 error: function calls in statics are limited to struct and enum constructors [E0015]
<anon>:4 static static_closure : TypeWithLifetime<'static> = Box::new(|| {
<anon>:5     panic!()
<anon>:6 });
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/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
@nagisa
Copy link
Member

nagisa commented Jun 14, 2015

Does not happen in a recent nightly, therefore I believe this can be closed.

@arielb1
Copy link
Contributor

arielb1 commented Jun 14, 2015

Duplicate of #25180

@arielb1 arielb1 closed this as completed Jun 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants