Commit c09d5f5
committed
Get a hashmap, odd borrowing
Compiling aoc0521 v0.1.0 (/home/ed/git/aoc-2021/05)
warning: cannot borrow `points` as mutable because it is also borrowed as immutable
--> src/main.rs:85:32
|
84 | match points.get(&point) {
| ------ immutable borrow occurs here
85 | Some(count) => points.insert(point, count+1),
| ^^^^^^ ----- immutable borrow later used here
| |
| mutable borrow occurs here
|
= note: `#[warn(mutable_borrow_reservation_conflict)]` on by default
= warning: this borrowing pattern was not meant to be accepted, and may become a hard error in the future
= note: for more information, see issue #59159 <rust-lang/rust#59159>
warning: `aoc0521` (bin "aoc0521") generated 1 warning
Finished dev [unoptimized + debuginfo] target(s) in 1.19s
Running `target/debug/aoc0521`
[
Line {
start: Point {
x: 0,
y: 9,
},
end: Point {
x: 5,
y: 9,
},
},
Line {
start: Point {
x: 8,
y: 0,
},
end: Point {
x: 0,
y: 8,
},
},
Line {
start: Point {
x: 9,
y: 4,
},
end: Point {
x: 3,
y: 4,
},
},
Line {
start: Point {
x: 2,
y: 2,
},
end: Point {
x: 2,
y: 1,
},
},
Line {
start: Point {
x: 7,
y: 0,
},
end: Point {
x: 7,
y: 4,
},
},
Line {
start: Point {
x: 6,
y: 4,
},
end: Point {
x: 2,
y: 0,
},
},
Line {
start: Point {
x: 0,
y: 9,
},
end: Point {
x: 2,
y: 9,
},
},
Line {
start: Point {
x: 3,
y: 4,
},
end: Point {
x: 1,
y: 4,
},
},
Line {
start: Point {
x: 0,
y: 0,
},
end: Point {
x: 8,
y: 8,
},
},
Line {
start: Point {
x: 5,
y: 5,
},
end: Point {
x: 8,
y: 2,
},
},
]
Line { start: Point { x: 0, y: 9 }, end: Point { x: 5, y: 9 } }
dx=5 dy=0
n=5 ix=1 iy=0
Line { start: Point { x: 8, y: 0 }, end: Point { x: 0, y: 8 } }
dx=-8 dy=8
n=8 ix=1 iy=-1
Line { start: Point { x: 9, y: 4 }, end: Point { x: 3, y: 4 } }
dx=-6 dy=0
n=6 ix=1 iy=0
Line { start: Point { x: 2, y: 2 }, end: Point { x: 2, y: 1 } }
dx=0 dy=-1
n=1 ix=0 iy=1
Line { start: Point { x: 7, y: 0 }, end: Point { x: 7, y: 4 } }
dx=0 dy=4
n=4 ix=0 iy=1
Line { start: Point { x: 6, y: 4 }, end: Point { x: 2, y: 0 } }
dx=-4 dy=-4
n=4 ix=1 iy=1
Line { start: Point { x: 0, y: 9 }, end: Point { x: 2, y: 9 } }
dx=2 dy=0
n=2 ix=1 iy=0
Line { start: Point { x: 3, y: 4 }, end: Point { x: 1, y: 4 } }
dx=-2 dy=0
n=2 ix=1 iy=0
Line { start: Point { x: 0, y: 0 }, end: Point { x: 8, y: 8 } }
dx=8 dy=8
n=8 ix=1 iy=1
Line { start: Point { x: 5, y: 5 }, end: Point { x: 8, y: 2 } }
dx=3 dy=-3
n=3 ix=1 iy=-1
{Point { x: 8, y: 0 }: 1, Point { x: 8, y: 8 }: 1, Point { x: 6, y: 6 }: 1, Point { x: 10, y: 4 }: 1, Point { x: 7, y: 2 }: 1, Point { x: 2, y: 3 }: 1, Point { x: 4, y: 4 }: 2, Point { x: 11, y: 4 }: 1, Point { x: 7, y: 0 }: 1, Point { x: 7, y: 5 }: 1, Point { x: 12, y: -4 }: 1, Point { x: 3, y: 4 }: 1, Point { x: 7, y: 7 }: 1, Point { x: 10, y: -2 }: 1, Point { x: 1, y: 1 }: 1, Point { x: 8, y: 2 }: 1, Point { x: 11, y: -3 }: 1, Point { x: 2, y: 2 }: 2, Point { x: 7, y: 1 }: 1, Point { x: 7, y: 3 }: 2, Point { x: 6, y: 4 }: 2, Point { x: 9, y: 7 }: 1, Point { x: 13, y: 4 }: 1, Point { x: 3, y: 3 }: 1, Point { x: 15, y: -7 }: 1, Point { x: 2, y: 9 }: 2, Point { x: 10, y: 8 }: 1, Point { x: 3, y: 9 }: 1, Point { x: 9, y: -1 }: 1, Point { x: 13, y: -5 }: 1, Point { x: 5, y: 9 }: 1, Point { x: 5, y: 4 }: 1, Point { x: 4, y: 9 }: 1, Point { x: 16, y: -8 }: 1, Point { x: 9, y: 4 }: 1, Point { x: 12, y: 4 }: 1, Point { x: 0, y: 9 }: 2, Point { x: 14, y: -6 }: 1, Point { x: 15, y: 4 }: 1, Point { x: 8, y: 6 }: 1, Point { x: 5, y: 5 }: 2, Point { x: 7, y: 4 }: 1, Point { x: 1, y: 9 }: 2, Point { x: 14, y: 4 }: 1, Point { x: 0, y: 0 }: 1}1 parent b593d4b commit c09d5f5
1 file changed
Lines changed: 11 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
91 | 89 | | |
| 90 | + | |
| 91 | + | |
92 | 92 | | |
0 commit comments