1
0
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:
Nicole L
2025-06-26 12:17:57 -07:00
committed by GitHub
parent 2e50843812
commit 447b31cd45
2 changed files with 5 additions and 5 deletions

View File

@ -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;
}

View File

@ -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);
}