Const generic type inference works when it should not #142378
Labels
A-inference
Area: Type inference
C-bug
Category: This is a bug.
F-generic_const_exprs
`#![feature(generic_const_exprs)]`
P-low
Low priority
requires-incomplete-features
This issue requires the use of incomplete features.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I tried this code:
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=1b2f4edef4886032e1f9391f671112f4
I expected to see this happen:
Instead, this happened: It compiles successfully 🤯
The key thing is
where
bound. If it is simplified to something simpler like this:Then I do get expected compiler error.
This is basically a miscompilation, compiler should not pick arbitrary matching where bound from the context of the caller to infer types of the called function unless corresponding constant is used explicitly.
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: