You've already forked comprehensive-rust
mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-07-04 13:50:28 +02:00
Remove type annotations from borrowck example (#2791)
These slides are on day 3, I don't think we need the explicit type annotations at this point.
This commit is contained in:
@ -29,11 +29,11 @@ rule. For a given value, at any time:
|
||||
|
||||
```rust,editable,compile_fail
|
||||
fn main() {
|
||||
let mut a: i32 = 10;
|
||||
let b: &i32 = &a;
|
||||
let mut a = 10;
|
||||
let b = &a;
|
||||
|
||||
{
|
||||
let c: &mut i32 = &mut a;
|
||||
let c = &mut a;
|
||||
*c = 20;
|
||||
}
|
||||
|
||||
|
@ -33,8 +33,8 @@ fn left_most(p1: &Point, p2: &Point) -> &Point {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let p1: Point = Point(10, 10);
|
||||
let p2: Point = Point(20, 20);
|
||||
let p1 = Point(10, 10);
|
||||
let p2 = Point(20, 20);
|
||||
let p3 = left_most(&p1, &p2); // What is the lifetime of p3?
|
||||
dbg!(p3);
|
||||
}
|
||||
|
Reference in New Issue
Block a user