PistonDevelopers / Piston-Tutorials

Tutorials for Piston
545 stars 89 forks source link

fix `sudoku` compile error #242

Closed SKTT1Ryze closed 3 years ago

SKTT1Ryze commented 3 years ago

The current sudoku compile will get an error:

error[E0311]: the parameter type `K` may not live long enough
   --> /home/hustccc/.cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd/rusttype-0.2.3/src/support/bst/map.rs:81:19
    |
81  |             match node.force() {
    |                   ^^^^
    |
    = help: consider adding an explicit lifetime bound for `K`
note: the parameter type `K` must be valid for the anonymous lifetime #1 defined on the function body at 77:9...
   --> /home/hustccc/.cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd/rusttype-0.2.3/src/support/bst/map.rs:77:9
    |
77  | /         fn clone_subtree<K: Clone, V: Clone>(
78  | |                 node: node::NodeRef<marker::Immut, K, V, marker::LeafOrInternal>)
79  | |                 -> BTreeMap<K, V> {
80  | |
...   |
136 | |             }
137 | |         }
    | |_________^
error: could not compile `rusttype`.

Because the piston2d-graphics crate depends on the rusttype-0.2.3 crate, however the rusttype-0.2.3 can not compiles successfully.
And this PR will fix it by specifying the right version of piston2d-graphics like getting-start tutorial.
Also this PR fix an error in src/main.rs, which locates in line 27.

bvssvni commented 3 years ago

Merging

bvssvni commented 3 years ago

Thanks!