Skip to content

unboxed closure sugar not working in trait objects #17703

Closed
@blaenk

Description

@blaenk

#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.

Metadata

Metadata

Assignees

Labels

A-closuresArea: Closures (`|…| { … }`)A-parserArea: The lexing & parsing of Rust source code to an AST

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions