-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-type-systemArea: Type systemArea: Type systemB-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.Blocker: Approved by a merged RFC but not yet implemented.C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.
Milestone
Description
This is part of unboxed closures. cc @nikomatsakis
I suggest that we adopt the following syntax for now. We can change it and bikeshed it later.
|&: x, y| x + y // Fn
|&mut: x, y| x + y // FnMut (the commonest, eventually the default)
|: x, y| x + y // FnOnce
These create anonymous struct types that move their upvars (cf. #12831) and implement the Fn
/FnMut
/FnOnce
traits.
Per discussion last week I believe that this is necessary for 1.0. Nominating for backcompat-lang because we will remove the old closures after this is done.
Metadata
Metadata
Assignees
Labels
A-type-systemArea: Type systemArea: Type systemB-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.Blocker: Approved by a merged RFC but not yet implemented.C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.