Skip to content

Move and swap operators #410

Closed
Closed
@graydon

Description

@graydon
Contributor

Add operator <- for move semantics and operator <-> for in-place swapping. Essential components to making the unique ownership model work. Steal <- from send, turn operator send into |> and make it chain to the right.

Activity

msullivan

msullivan commented on Jun 13, 2011

@msullivan
Contributor

<- is in, but the typestate component doesn't exist yet. Receive is now |> but doesn't chain.

msullivan

msullivan commented on Jun 21, 2011

@msullivan
Contributor

Swap is implemented.

graydon

graydon commented on Jun 28, 2011

@graydon
ContributorAuthor

Is there much left to do here, aside from "fix bugs as they occur"?

msullivan

msullivan commented on Jun 28, 2011

@msullivan
Contributor

Tim has implemented the typestate stuff.
Currently we don't properly check that the arguments to swap are lvals and that the RHS of move is a local. The former will trip an llvm assert, the latter will compile and do the wrong thing.

Otherwise I think it should be good?

graydon

graydon commented on Jun 28, 2011

@graydon
ContributorAuthor

Heh. Ok. Want to fix those?

msullivan

msullivan commented on Jun 29, 2011

@msullivan
Contributor

The swap issue has been fixed in #590 and the move issue has been opened as #591.

I'm going to close this bug.

added a commit that references this issue on Dec 12, 2017

Auto merge of rust-lang#410 - kallisti5:master, r=alexcrichton

added a commit that references this issue on Nov 29, 2018
5e676a7
added a commit that references this issue on Mar 7, 2023
added a commit that references this issue on Feb 21, 2024

Merge pull request rust-lang#410 from vuittont60/master

47373be
added a commit that references this issue on Jan 18, 2025

Merge pull request rust-lang#410 from heiher/loongarch64

53fe1a3
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)E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @graydon@msullivan

        Issue actions

          Move and swap operators · Issue #410 · rust-lang/rust