Skip to content
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

unboxed closure sugar not working in trait objects #17703

Closed
blaenk opened this issue Oct 2, 2014 · 4 comments · Fixed by #18630
Closed

unboxed closure sugar not working in trait objects #17703

blaenk opened this issue Oct 2, 2014 · 4 comments · Fixed by #18630
Assignees
Labels
A-closures Area: Closures (`|…| { … }`) A-parser Area: The parsing of Rust source code to an AST

Comments

@blaenk
Copy link
Contributor

blaenk commented Oct 2, 2014

#17041 implemented unboxed closure sugar parsing for trait bounds, but it doesn't seem to be implemented for trait objects.

I realize that this example probably wouldn't work anyway due to the lack of higher-rank lifetimes, but the point is that the compiler yields a parser error.

playpen sample

trait Router {
  fn route(&mut self, p: &Path) -> Path;
}

impl<'a> Router for Box<FnMut(&'a Path) -> Path + 'a> {
  fn route(&mut self, p: &Path) -> Path {
    (*self).call_mut((p,))
  }
}

fn main() {}

@p1start observed this as well.

@blaenk blaenk changed the title unboxed closure sugar not working in object types unboxed closure sugar not working in trait objects Oct 2, 2014
@ftxqxd
Copy link
Contributor

ftxqxd commented Oct 10, 2014

FWIW, this applies to impls, too:

impl FnMut(int) -> int for Foo { ... }

fails to compile with a parser error.

@huonw huonw added the A-parser Area: The parsing of Rust source code to an AST label Oct 10, 2014
@pnkfelix
Copy link
Member

cc @aturon to close this once appropriate issue is constructed (we need a proper tracking / metabug for unboxed closures)

@aturon
Copy link
Member

aturon commented Oct 16, 2014

Not closing -- just removing nomination, as this is just a bug.

@aturon aturon mentioned this issue Oct 16, 2014
47 tasks
@huonw huonw added the A-closures Area: Closures (`|…| { … }`) label Oct 16, 2014
@nikomatsakis
Copy link
Contributor

I am working in this as part of HRTB

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-closures Area: Closures (`|…| { … }`) A-parser Area: The parsing of Rust source code to an AST
Projects
None yet
7 participants