Open orium opened 3 years ago
Presumably this is just fallout from the fact that predicates in where
-clauses having higher precedence than impls
Meaning: In foo
, at the call to gen()
, the compiler has to prove the (): Distribution<K>
predicate in the where
-clause on gen
, which means proving (): Distribution<$0>
where $0
is an inference variable. It eagerly selects the (): Distribution<T>
predicate from the where
-clause of foo
to do that and thus unifies $0
with T
.
Hi. I apologize if this is a dup (I tried to search, but is it not easy to distill this into words to search for). If it's not a dup please update the title to something more meaningful.
When trying to compile (in play)
I get the error:
It it should be able to determine that the hole in
gen::<_>()
isu16
because that's the return type offoo()
. Instead the compiler thinks the hole must beT
, which is not true (in fact, if you change the call togen()
togen::<u16>()
the code compiles).This happens in stable (1.46.0) as well as nightly 1.49.0-nightly (2020-10-05 a1dfd2490a6cb456b92e).