-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Unrelated const generic selected during type inference #103741
Comments
This is probably related to https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Why.20does.20an.20explicit.20.60Into.60.20bound.20prevent.20the.20no-op.20impl.3F/near/306742934 Where-clauses are always preferred over non-where clauses -- in this case, you should be able to fix this by using a turbofish. |
I'm still a little confused why it would be considered a candidate at all. I'd understand if there were two possible ambiguous impls, but As to using a turbofish, I don't believe this is possible in the original issue reported to portable SIMD, which is inside the |
This is my theory, but it seems very likely given the circumstances -- When you call While checking argument compatibility for Therefore we try to check if That might seem silly in this example, but the ordering of these operations are required for function argument inference and coercion to work properly, so it's probably going to be hard to fix without breaking other types of function calls. Hope that makes sense. |
In that case, I'm surprised that adding |
It's not filtered out immediately, though it's likely dropped due to special selection logic that filters out non-global param-env candidates.
|
Closing as a duplicate of #24066. If you feel it's worth keeping this open anyway, I can of course reopen it. |
I tried this code:
playground link
I expected to see this happen: it compiles
Instead, this happened: it errors
I'm not sure why
UNRELATED_LANES
is selected for the second parameter ofSimd
, when it's not used at all. This was discovered in rust-lang/portable-simd#292.Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: