Skip to content

Add sugar to simplify mutable function arguments #3488

Closed

Description

@erickt

While it's pretty easy to write a function that makes an argument mutable:

fn foo(x: ~int) {
    let x = move x;
    ...
}

It'd be nice to save a line here and there to add some sugar to express an argument is directly mutable, with something like:

fn foo(mut x: ~int) { ... }

Activity

  1. nikomatsakis commented on Sep 13, 2012

    @nikomatsakis
    Contributor

    +1

  2. bstrie commented on Sep 13, 2012

    @bstrie
    Contributor

    I've stubbed my toe on this as well.

  3. nikomatsakis commented on Sep 27, 2012

    @nikomatsakis
    Contributor

    I started tagging some of the places in the code where this would be useful with FIXME(#3488)

  4. Dretch commented on Nov 12, 2012

    @Dretch
    Contributor

    +1

  5. sanxiyn commented on Jan 3, 2013

    @sanxiyn
    Contributor

    I am working on this.

  6. catamorphism commented on Jan 23, 2013

    @catamorphism
    Contributor

    Fixed: 54344c2

  7. sanxiyn commented on Jan 23, 2013

    @sanxiyn
    Contributor

    Can places with FIXME be fixed, or does that require a snapshot?

  8. catamorphism commented on Jan 23, 2013

    @catamorphism
    Contributor

    @sanxiyn Yes, that will require a snapshot, because it has to be possible to compile the libraries with the stage0 compiler (the existing snapshot). But we are going to make a snapshot soon.

  9. added a commit that references this issue on Jan 31, 2013
  10. added a commit that references this issue on Feb 1, 2013
  11. added a commit that references this issue on Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-frontendArea: Compiler frontend (errors, parsing and HIR)C-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions