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

librustc: Implement the syntax in the RFC for unboxed closure sugar. #17041

Merged
merged 1 commit into from
Sep 20, 2014

Conversation

pcwalton
Copy link
Contributor

@pcwalton pcwalton commented Sep 6, 2014

Part of issue #16640. I am leaving this issue open to handle parsing of
higher-rank lifetimes in traits.

This change breaks code that used unboxed closures:

  • Instead of F:|&: int| -> int, write F:Fn(int) -> int.
  • Instead of F:|&mut: int| -> int, write F:FnMut(int) -> int.
  • Instead of F:|: int| -> int, write F:FnOnce(int) -> int.

[breaking-change]

r? @alexcrichton

@steveklabnik
Copy link
Member

Where did this syntax come from? I don't remember seeing it in the RFC.

@reem
Copy link
Contributor

reem commented Sep 6, 2014

I remember seeing this discussed as an alternative, but not agreed upon in the RFC.

this.tcx().sess.span_err(b.path.span,
"unboxed function trait must be one \
of `Fn`, `FnMut`, or `FnOnce`");
ast::FnMutUnboxedClosureKind
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test for this error?

@alexcrichton
Copy link
Member

r=me with some tests

Part of issue rust-lang#16640. I am leaving this issue open to handle parsing of
higher-rank lifetimes in traits.

This change breaks code that used unboxed closures:

* Instead of `F:|&: int| -> int`, write `F:Fn(int) -> int`.

* Instead of `F:|&mut: int| -> int`, write `F:FnMut(int) -> int`.

* Instead of `F:|: int| -> int`, write `F:FnOnce(int) -> int`.

[breaking-change]
alexcrichton added a commit to alexcrichton/rust that referenced this pull request Sep 19, 2014
@bors bors merged commit 7c00d77 into rust-lang:master Sep 20, 2014
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

Successfully merging this pull request may close these issues.

5 participants