These are chat archives for rust-lang/rust

8th
Jun 2017
notsonotso @notsonotso roots for --turn-of-borrowchecker-and-just-use-gc-for-this-module
Scott Corbeil
@scorbeil
Jun 08 2017 20:42

Is something like this even possible?

enum Things {
    A,
    B,
}

impl Things {
    fn change(&mut self) {
        *self = Things::B;
    }
}

This is far simpler than what I'm trying to do, but illustrates it well. Reassign self from within a method.

Jonas Platte
@jplatte
Jun 08 2017 20:50
@scorbeil Yeah, should be possible. Your example seems to compile just fine for me too.
Scott Corbeil
@scorbeil
Jun 08 2017 20:51
Hm... you are correct. I must have a different issue...
Ashley Mannix
@KodrAus
Jun 08 2017 20:55
@scorbeil Are you getting a compile error trying to do something like this in your code?