Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Shared type to fix inference fail on nightly #2

Merged
merged 1 commit into from
Sep 27, 2017

Conversation

KodrAus
Copy link
Contributor

@KodrAus KodrAus commented Sep 12, 2017

Hi there!

In rust-lang/rust#42565 some new impls were added to Arc and 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 bound Arc<T>: From<U>, U could only ever be T. That's not the case anymore, so Rust can't figure out what T should be from U. I'm assuming the reason for these bounds here was so that you could pass either T or Arc<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 T and Arc<T>, so when we get a generic T: Shared<U> we know that T must be either U or Arc<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

@bodil bodil merged commit ab5042b into bodil:master Sep 27, 2017
@bodil
Copy link
Owner

bodil commented Sep 27, 2017

Made a new major release with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants