Mark mutating functions with mutable modifier, and owning functions with consuming.

This commit is contained in:
Paul Daniel Faria 2020-07-30 11:07:13 -04:00
parent 7009d5ee2b
commit a044ff0138
5 changed files with 70 additions and 15 deletions

View file

@ -36,6 +36,10 @@ impl Foo {
fn qux(&mut self) {
self.x = 0;
}
fn quop(&self) -> i32 {
self.x
}
}
static mut STATIC_MUT: i32 = 0;
@ -87,6 +91,11 @@ fn main() {
let Foo { x: z, y } = Foo { x: z, y };
y;
let mut foo = Foo { x, y: x };
foo.quop();
foo.qux();
foo.baz();
}
enum Option<T> {