File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ println!("{}", x + z);
87
87
This gives us an error:
88
88
89
89
``` text
90
- hello.rs:6:24: 6:25 error: mismatched types: expected `i32` but found `&i32 ` (expected i32 but found &-ptr)
90
+ hello.rs:6:24: 6:25 error: mismatched types: expected `_`, found `&_ ` (expected integral variable, found &-ptr)
91
91
hello.rs:6 println!("{}", x + z);
92
92
^
93
93
```
@@ -305,7 +305,7 @@ References are immutable by default:
305
305
let x = 5;
306
306
let y = &x;
307
307
308
- *y = 5; // error: cannot assign to immutable dereference of `&`-pointer `*y`
308
+ *y = 5; // error: cannot assign to immutable borrowed content `*y`
309
309
```
310
310
311
311
They can be made mutable with ` mut ` , but only if its referent is also mutable.
@@ -668,7 +668,7 @@ struct BigStruct {
668
668
}
669
669
670
670
fn foo(x: Box<BigStruct>) -> Box<BigStruct> {
671
- return Box::new(*x);
671
+ Box::new(*x)
672
672
}
673
673
674
674
fn main() {
@@ -696,7 +696,7 @@ struct BigStruct {
696
696
}
697
697
698
698
fn foo(x: Box<BigStruct>) -> BigStruct {
699
- return *x;
699
+ *x
700
700
}
701
701
702
702
fn main() {
You can’t perform that action at this time.
0 commit comments