Skip to content

Instantly share code, notes, and snippets.

0 -1 -2 -3
-1 1 0 -1
-2 0 0 1
. ← ← ←
↑ ↖ ← ←
↑ ↑ ↖ ↖
@kindlychung
kindlychung / err
Last active September 19, 2016 23:26
cargo test
Compiling algorithms_in_a_nutshell v0.1.0 (file:///Users/kaiyin/Documents/workspace-eclipse-neon/algorithms_in_a_nutshell)
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter 'a in generic type due to conflicting requirements
--> src/needleman_wunsch.rs:30:2
|
30 | fn align<'a, 'b>(&'a self, vec: &'a Vec<T>, similarity: &'b Fn(&T, &T) -> i64, gap_penalty: i64) -> (Vec<Option<&'a T>>, Vec<Option<&'a T>>) {
| ^
|
help: consider using an explicit lifetime parameter as shown: fn align<'c, 'a,
'b>(&'a self, vec: &'a Vec<T>, similarity: &'b Fn(&T, &T) -> i64,
error: no method named `max_elem` found for type `[{integer}; 6]` in the current scope
--> src/max_elem.rs:34:17
|
34 | let m = array.max_elem();
| ^^^^^^^^
|
= help: items from traits can only be used if the trait is implemented and in scope; the following trait defines an item `max_elem`, perhaps you need to implement it:
= help: candidate #1: `max_elem::MaxElem`
Compiling algorithms_in_a_nutshell v0.1.0 (file:///Users/kaiyin/Documents/workspace-eclipse-neon/algorithms_in_a_nutshell)
error: `i` does not live long enough
--> src/convex_hull.rs:231:15
|
229 | (0..5).into_iter().map(|j| {
| --- capture occurs here
230 | let j = j as f64;
231 | Point::new(i, j)
| ^ does not live long enough
232 | })
use std::cmp::Ordering::Equal;
use std::cmp::Ordering;
use std::ops::{Add, Sub, Mul};
use std::collections::BTreeSet;
#[derive(Debug, Copy, Clone)]
struct Point {
x: f64,
y: f64,
}
use std::cmp::Ordering::Equal;
use std::cmp::Ordering;
use std::ops::{Add, Sub, Mul};
use std::collections::BTreeSet;
#[derive(Debug, Copy, Clone)]
struct Point {
x: f64,
y: f64,
}
cargo test
Compiling algorithms_in_a_nutshell v0.1.0 (file:///Users/kaiyin/Documents/workspace-eclipse-neon/algorithms_in_a_nutshell)
error[E0119]: conflicting implementations of trait `std::cmp::PartialEq<&convex_hull::Point>` for type `&convex_hull::Point`:
--> src/convex_hull.rs:28:1
|
28 | impl<'a> PartialEq for &'a Point {
| ^
|
= note: conflicting implementation in crate `core`
@kindlychung
kindlychung / err
Last active September 17, 2016 11:09
Compiling algorithms_in_a_nutshell v0.1.0 (file:///Users/kaiyin/Documents/workspace-eclipse-neon/algorithms_in_a_nutshell)
error[E0308]: mismatched types
--> src/convex_hull.rs:167:10
|
167 | set
| ^^^ expected struct `convex_hull::Point`, found reference
...
175 | let minus_i = points.difference(&(btreeset!(p_i)));
| -------------- in this macro invocation
|
@kindlychung
kindlychung / err
Last active September 17, 2016 10:34
Compiling algorithms_in_a_nutshell v0.1.0 (file:///Users/kaiyin/Documents/workspace-eclipse-neon/algorithms_in_a_nutshell)
error[E0277]: the trait bound `&std::collections::HashSet<convex_hull::Point>: std::iter::IntoIterator` is not satisfied
--> src/convex_hull.rs:155:2
|
155 | for p_i in points {
| ^ trait `&std::collections::HashSet<convex_hull::Point>: std::iter::IntoIterator` not satisfied
|
= help: the following implementations were found:
= help: <&'a std::collections::HashSet<T, S> as std::iter::IntoIterator>
= help: <std::collections::HashSet<T, S> as std::iter::IntoIterator>
//! A simple parser for a tiny subset of CSS.
//!
//! To support more CSS syntax, it would probably be easiest to replace this
//! hand-rolled parser with one based on a library or parser generator.
use std::ascii::AsciiExt; // for `to_ascii_lowercase`
// Data structures:
#[derive(Debug)]