Add Shared type to fix inference fail on nightly#2
Merged
bodil merged 1 commit intobodil:masterfrom Sep 27, 2017
Merged
Conversation
Owner
|
Made a new major release with this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi there!
In rust-lang/rust#42565 some new impls were added to
Arcand friends that are breaking type inference on this crate for string keys/values. This was originally reported here.The trait bounds here worked previously because we only had
impl<T> From<T> for Arc<T>in the standard library, so in the boundArc<T>: From<U>,Ucould only ever beT. That's not the case anymore, so Rust can't figure out whatTshould be fromU. I'm assuming the reason for these bounds here was so that you could pass eitherTorArc<T>to some of the datastructures and have it do the right thing.To work around this I've added a trait that's implemented only for
TandArc<T>, so when we get a genericT: Shared<U>we know thatTmust be eitherUorArc<U>. I haven't tried to come up with a good name for this trait or add any docs, in case this isn't the way you want to solve this problem.This is technically a breaking change. An alternative solution is that callers will just need to give Rust a hand and specify the type of maps and things when it can't figure it out itself.
cc: @bodil