does &* on the Rc help
-
-
Replying to @steveklabnik
yeah, just, idk why I'm surprised given the type system rules but this caught me off guard
2 replies 0 retweets 1 like -
Replying to @mountain_ghosts @steveklabnik
It's just not an impl that anyone thought to write explicitly. Auto-deref isn't ever used when satisfying traits, so unless there's an explicit `PartialEq<Rc<String>> for str`, it'll fail.
1 reply 0 retweets 7 likes -
Replying to @sgrif @mountain_ghosts
ahh
1 reply 0 retweets 1 like -
Replying to @steveklabnik @sgrif
yeah it makes more sense when you realise it's invoking a function of two arguments, and Deref doesn't mean that fn will try to find a common deref target to make the type system happy
1 reply 0 retweets 3 likes -
Replying to @mountain_ghosts @steveklabnik
Nah, it can pick one. It's just because traits are involved (and there are multiple deref targets to choose from, though it could just pick the first in the chain tbh) https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=00257fc8db0914a33c6e000a038111e8 …
2 replies 0 retweets 2 likes -
basically, http://foo.bar () - style autoderef works in generic situations, but the kind of autoderef where &*** is automatically applied to things to coerce them is far more limited: if it's generic (or even if relying too heavily on inference) it won't work
1 reply 0 retweets 0 likes -
Yup, which is kinda silly because the same rules used to decide which type is the receiver of `.bar` can be applied whenever `&` is used for argument passing
1 reply 0 retweets 1 like -
not really: in the former situation you're looking for a type -- any type -- with the method "bar". it's a simple linear search down the deref chain in the latter you're looking for a type which satisfies certain constraints, which is much trickier
3 replies 0 retweets 1 like -
this is what I was getting at; if a function is called with two types S and T, both of which deref to multiple types that mutually satisfy a trait, this is confusing
1 reply 0 retweets 1 like
Yes. I think there are rules that we could use to arbitrarily pick one that would be consistent with the rest of the language, but that would require an RFC which I haven't written
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.