Closed
Description
the find
closure being passed into collections::bench::find_*_n
in BTreeMap and VecMap's benches has a trailing semi-colon making the return value ()
, and thus making the entire operation a no-op.
#[bench]
pub fn find_seq_100(b: &mut Bencher) {
let mut m = BTreeMap::new();
find_seq_n(100, &mut m, b,
|m, i| { m.insert(i, 1); },
|m, i| { m.get(&i); });
^~~~~ big trouble in little BTreeMap town
}
Removing the semi-colon causes lifetime conflict issues.
map.rs:1882:32: 1882:39 error: cannot infer an appropriate lifetime for autoref due to conflicting requirements
map.rs:1882 |m, i| { m.get(&i) });
^~~~~~~
map.rs:1880:9: 1880:20 note: first, the lifetime cannot outlive the expression at 1880:8...
map.rs:1880 find_rand_n(100, &mut m, b,
^~~~~~~~~~~
map.rs:1880:9: 1880:20 note: ...so that the declared lifetime parameter bounds are satisfied
map.rs:1880 find_rand_n(100, &mut m, b,
^~~~~~~~~~~
map.rs:1882:30: 1882:31 note: but, the lifetime must be valid for the expression at 1882:29...
map.rs:1882 |m, i| { m.get(&i) });
^
map.rs:1882:30: 1882:31 note: ...so that auto-reference is valid at the time of borrow
map.rs:1882 |m, i| { m.get(&i) });
Metadata
Metadata
Assignees
Labels
No labels