I think my issue is with the term "special case" here, because the underlying reason here is that trait search fundamentally works off of self, and this isn't the only way that manifests. this isn't specific to deref coercions.
-
-
Replying to @ManishEarth
Sure, but what is self other than the first argument? re-rebalancing coherence was literally about changing the trait system to stop treating self as different, and instead just treating it as the leftmost argument, and applying the same rules left to right
1 reply 0 retweets 3 likes -
Replying to @sgrif
self isn't always the first argument, though It's not for foo<T: Trait<U>, U>(x: bool, y: T, z: U), and you'll have similar problems here the UFCS call is basically eq<T: PartialEq<U>, U>(&T, &U)
1 reply 0 retweets 0 likes -
Replying to @ManishEarth
Right, which is why I wouldn't want to treat `self` as special at all, rules for dispatching both are the same. Fewest derefs left to right. (don't deref T, try derefing U repeatedly, if you find an impl stop, deref T once, ...)
1 reply 0 retweets 1 like -
Replying to @sgrif
"left to right" assumes that there's a function here *at all*, though
2 replies 0 retweets 0 likes -
Replying to @ManishEarth @sgrif
i guess you can special case for deref coercions that are happening in function call arguments only
1 reply 0 retweets 0 likes -
-
Replying to @sgrif
?? we don't? we treat deref coercions the same everywhere. autoderef is special, but it works totally differently
1 reply 0 retweets 0 likes -
Replying to @ManishEarth
Function arguments where the only place that you cannot consistently rely on `&` performing deref coercion
1 reply 0 retweets 0 likes -
Replying to @sgrif2 replies 0 retweets 0 likes
Shit that's an interesting wrinkle. "Should the order type parameters are listed in a struct definition affect type inference for struct literals" is a fun question
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.