You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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) });
I have a branch that just gives up and replaces these with macros. This results in clearer and more concise code like map_insert_rand_bench!{insert_rand_100, 100, BTreeMap}.
Confirmed produces sane results in benchmark output. Hope to submit something tomorrow.
the
find
closure being passed intocollections::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.Removing the semi-colon causes lifetime conflict issues.
CC @alexcrichton
The text was updated successfully, but these errors were encountered: