Closed
Description
Got the following output when compiling:
src/lib.rs:41:32: 41:45 error: cannot infer an appropriate lifetime due to conflicting requirements
src/lib.rs:41 guard.get(key).map(|v| BorrowedValue { guard: guard, value: v })
^~~~~~~~~~~~~
src/lib.rs:40:5: 42:6 help: consider using an explicit lifetime parameter as shown: fn new(guard: RwLockReadGuard<'a, HashMap<K, V>>, key: &K) -> Option<Self>
src/lib.rs:40 fn new(guard: RwLockReadGuard<'a, HashMap<K, V>>, key: &K) -> Option<Self> {
src/lib.rs:41 guard.get(key).map(|v| BorrowedValue { guard: guard, value: v })
src/lib.rs:42 }
Notice the "help" suggests the function definition that is exactly the one used.
Full code to reproduce can be found here: https://github.com/seppo0010/shardhashmap-rs/blob/help-is-not-helpful/src/lib.rs#L40
The rustc version I'm using is rustc 1.4.0-nightly (7780408af 2015-09-01)
.