Does not build on latest nightly w/ RFC 509
drbawb opened this issue · 4 comments
After rust-lang/rust@400c3a0d implemented RFC 509
HashMap::VacantEntry
now takes an additional type parameter Sized? Q: ToOwned<K>
The idea being that HashMap#entry()
now accepts the key by reference (&'a Q
instead of K
).
Then VacantEntry calls Q#to_owned() -> K
to store it in the map.
I've been trying to fix this; but I'm stumped. In TypeMap: the caller does not generate the TypeId, instead it is generated internally by TypeMap#entry()
.
Since no reference to this TypeId would live past the call to TypeMap#entry()
this invalidates the Entry<'a, K, V>
we're trying return.
The best I've been able to do so far is add a helper method that generates the TypeId and returns it to the caller so it lives long enough; then the caller passes it into TypeMap#entry()
... but it's a huge loss for ergonomics.
This appears to be a bug in the new Entry API, which requires the key reference to live as long as the map itself. This should be fixed upstream in the near future and there's unfortunately nothing we can really do about it for now.
We're reverting to by-value keys. Should be fixed by the next nightly.
Sorry! 😭
Ok, sounds good. This is only (I think) blocking Iron right now, which is blocked by about 10 other things, so no problem.