Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moves into patterns (also irrefutable patterns) always copy #3097

Closed
nikomatsakis opened this issue Aug 3, 2012 · 4 comments
Closed

Moves into patterns (also irrefutable patterns) always copy #3097

nikomatsakis opened this issue Aug 3, 2012 · 4 comments
Assignees
Labels
A-codegen Area: Code generation
Milestone

Comments

@nikomatsakis
Copy link
Contributor

The following test:

struct foo {
    x: int;

    new(x: int) {
        self.x = x;
    }

    drop {
        error!{"Hello, world!"};
    }
}

fn main() {
    let x = ~foo(1);
    error!{"x.x: %d", x.x};
    let ~y <- x;
    error!{"y.x: %d", y.x};

    alt move y {
      copy z {}
    }
}

prints Hello World! three times. I think that patterns (both refutable/irrefutable, which are different code paths) just always copy in trans.

@nikomatsakis
Copy link
Contributor Author

Also, the copy keyword on the pattern (right now) just makes it into "value mode". It shouldn't be necessary eventually and should in fact produce a warning.

@ghost ghost assigned nikomatsakis Aug 9, 2012
@bblum bblum mentioned this issue Nov 5, 2012
@catamorphism
Copy link
Contributor

I'm going to take this as part of #3271. Hopefully @nikomatsakis won't mind ;-)

@ghost ghost assigned catamorphism Nov 5, 2012
@catamorphism
Copy link
Contributor

As of 563aa0b , the copy keyword in the pattern does in fact produce an error.

@pcwalton
Copy link
Contributor

Closing this. Please reopen if this is still an issue.

@ghost ghost assigned nikomatsakis Jun 20, 2013
RalfJung pushed a commit to RalfJung/rust that referenced this issue Oct 1, 2023
celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
Mermaid does not accept `@` characters in axis labels when the labels
aren't in quotes. (Seen when trying to run CBMC's upcoming benchcomp
suite.) Note: the title must not be quoted, else the quotes themselves
will be rendered.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation
Projects
None yet
Development

No branches or pull requests

3 participants