Skip to content

Box<Fn(int) -> int + 'static> is not accepted: "explicit lifetime bound required" #18772

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
japaric opened this issue Nov 8, 2014 · 2 comments

Comments

@japaric
Copy link
Member

japaric commented Nov 8, 2014

STR

#![feature(unboxed_closures)]

#[cfg(error)]
fn adder(y: int) -> Box<Fn(int) -> int + 'static> {
    //~^ error: explicit lifetime bound required
    box move |&: x| y + x
}

#[cfg(not(error))]
fn adder(y: int) -> Box<Fn<(int,), int> + 'static> {
    box move |&: x| y + x
}

fn main() {}

Version: ebc625a (2014-11-08)

cc @nikomatsakis

@aturon aturon mentioned this issue Nov 10, 2014
47 tasks
@nikomatsakis
Copy link
Contributor

Added to metabug, will take a look.

@nikomatsakis
Copy link
Contributor

This is due to the precedence of +. It is fixed by #19298.

nikomatsakis added a commit to nikomatsakis/rust that referenced this issue Nov 26, 2014
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants