Skip to content

Finalize unboxed closure feature gates for 1.0 #18875

Closed
@nikomatsakis

Description

@nikomatsakis

We do not expect to completely "unfeature-gate" unboxed closures for 1.0. We wish to reserve the flexibility to change a few aspects:

  1. Move to variadic generics in place of auto-tupling.
  2. Change the A and R arguments from input types to (possibly) associated types. (cc Make return type of the Fn traits an associated type #20871)
  3. Improve the coherence story with respect to fn-trait hierarchy. (cc Unable to manually implement FnOnce #18835)

To this end we will adjust the features to:

  • Disallow references to the Fn* traits using angle bracket notation
  • Disallow user impls of the Fn* traits
  • Disallow direct calls to foo.call()
  • Disallow parenthetical notation (Foo(A,B) -> C) from being used with anything other than the Fn* traits

In short, we permit unboxed closures to be used as if they are a language builtin, but disallow (for now) a lot of the more generic uses. We should be able to drop this feature gate shortly after 1.0.

cc @pcwalton

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-closuresArea: Closures (`|…| { … }`)

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions