Skip to content

Closure reform #2202

Closed
Closed

Description

@nikomatsakis

UPDATE:

This is a meta-bug now for tracking the work on completing closures. Now that #6801 has landed, the remaining pieces of work are:

ORIGINAL FOLLOWS:
We need to revamp function types in light of regions. I think fn() (the "any" function) will go away, and fn@() and fn~() will be coercable to fn&(), just as with poiners/vectors/slices/etc. Also, fn&() becomes fn&r() (that is, r is a region), though the user won't typically need to write it. We can probably leave the representation as is, though we could also tweak fn&() to not have a ref count since there will be an explicit borrowing that occurs.

Activity

  1. catamorphism commented on Apr 19, 2012

    @catamorphism
    Contributor

    @nikomatsakis Should this be an RFC, since it would change syntax?

  2. nikomatsakis commented on Apr 19, 2012

    @nikomatsakis
    ContributorAuthor

    I don't feel it's necessary as I think it is more like a tweak. More importantly, I don't think that the work on regions makes much sense without taking these steps.

  3. nikomatsakis commented on Apr 19, 2012

    @nikomatsakis
    ContributorAuthor

    But I am happy to prepare an RFC if you think it makes sense.

  4. catamorphism commented on Apr 19, 2012

    @catamorphism
    Contributor

    Well, by the RFC process criteria, it is a change to the AST that isn't just refactoring, doesn't relate to numerical criteria, and would be noticed by end users. But if you think that would be overkill, it's your call.

  5. nikomatsakis commented on Apr 19, 2012

    @nikomatsakis
    ContributorAuthor

    OK. FWIW I don't think it'd be noticed by end-users: that is, all existing syntax will remain valid, it'll just be re-interpreted to be regions-based.

  6. catamorphism commented on Apr 19, 2012

    @catamorphism
    Contributor

    I'm confused -- you said in the original post that "fn() (the "any" function) will go away"? So isn't that making existing syntax not valid anymore? (Not trying to be antagonistic here, I just don't understand.)

  7. nikomatsakis commented on Apr 19, 2012

    @nikomatsakis
    ContributorAuthor

    You're right, what I wrote was misleading (or perhaps just plain wrong). I meant that it would go away in the type system. You'd still be able to type fn(), it'd just be omitting the region bound (region bounds can always be omitted in all cases where they appear, such as slices etc).

  8. catamorphism commented on Apr 19, 2012

    @catamorphism
    Contributor

    Ah ok. Then I agree, not really visible to users, hence no need for an RFC.

  9. catamorphism commented on Oct 1, 2012

    @catamorphism
    Contributor

    Moved to 0.4.

  10. nikomatsakis commented on Oct 1, 2012

    @nikomatsakis
    ContributorAuthor

    @catamorphism I think the beginning work here has been done. The remaining work is probably better left to 0.5. Is there some specific change you had in mind for 0.4?

  11. catamorphism commented on Oct 1, 2012

    @catamorphism
    Contributor

    @pcwalton was saying that borrowing an @fn to a &fn results in a memory leak, and that that had something to do with this bug.

  12. nikomatsakis commented on Oct 2, 2012

    @nikomatsakis
    ContributorAuthor

    That is true. I am not sure that we need to fix that for 0.4 though.

  13. 13 remaining items

  14. nikomatsakis commented on Sep 26, 2013

    @nikomatsakis
    ContributorAuthor

    Update: I have a branch that does a lot of the borowck work. Semi-blocked on fixing destructor semantics.

  15. brson commented on Oct 8, 2013

    @brson
    Contributor

    Current plan of action:

    • make ~fn once fns
    • rename &fn to |A| -> B
    • rename extern "Rust" to fn
    • rename ~fn -> proc
    • replace various do &fn use cases with RAII
    • remove do for &fn
    • add capture clauses??
    • note: procs should carry file/line info for debugging?
  16. pnkfelix commented on Nov 29, 2013

    @pnkfelix
    Contributor

    cc me

  17. nikomatsakis commented on Jan 16, 2014

    @nikomatsakis
    ContributorAuthor

    As part of this work, we need to update the kinds for function types to take into account the mutability etc of the captured values.

  18. nikomatsakis commented on Feb 12, 2014

    @nikomatsakis
    ContributorAuthor

    Updated main comment.

  19. flaper87 commented on Apr 19, 2014

    @flaper87
    Contributor

    updated the description to add #13621

  20. pcwalton commented on Jun 9, 2014

    @pcwalton
    Contributor

    I propose closing this as an outdated metabug that is currently not particularly actionable. We have several other bugs for unboxed closures.

  21. pnkfelix commented on Jun 12, 2014

    @pnkfelix
    Contributor

    Closing in favor of new unboxed closures approach we are now adopting: see rust-lang/rfcs#114

  22. added a commit that references this issue on Sep 22, 2022
  23. added a commit that references this issue on Jan 21, 2025
  24. added a commit that references this issue on Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-lifetimesArea: Lifetimes / regionsmetabugIssues about issues themselves ("bugs about bugs")

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions