Skip to content

Commit 789cc47

Browse files
Make example compilable
1 parent 5c1daf9 commit 789cc47

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

posts/2020-07-30-Rust-1.45.1.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,17 @@ practice: the code must have inputs consisting of entirely constant values and
4040
no control flow or function calls in between.
4141

4242
```rust
43-
let mut foo = Foo { x: 42 };
44-
let x = &mut foo.x;
45-
*x = 13;
46-
let y = foo;
47-
println!("{}", y.x); // -> 42; expected result: 13
43+
struct Foo {
44+
x: u32,
45+
}
46+
47+
fn main() {
48+
let mut foo = Foo { x: 42 };
49+
let x = &mut foo.x;
50+
*x = 13;
51+
let y = foo;
52+
println!("{}", y.x); // -> 42; expected result: 13
53+
}
4854
```
4955

5056
## Contributors to 1.45.1

0 commit comments

Comments
 (0)