-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Support const generics #8655
Comments
I also wonder, what would it take us to “just use miri”, just like we “just use chalk” today (to clarify, I personally know very little at all about how all this is supposed to work)? |
Miri seemed very entangled with compiler internals when I checked; having the shared type library might be a first step towards that though. |
Regarding the MCP, in the end we just use Chalk's representation, so 🤷♂️ |
Miri can't be used without |
I presume the long-term vision is that, as more and more of rustc is "librarified", RA will increasingly be able to depend on those libraries and (eventually) use them to lower all the way to MIR (whence Miri could be used for const eval etc, or indeed that MIR could be interpreted/lowered to machine code e.g. for #8420)? Assuming that is the vision, is there somewhere that the broad brush strokes for getting there have been sketched out (perhaps a tracking-issue or similar)? Maybe by breaking the goal into more manageable stages, contributions toward reaching it can be coordinated? |
The next step right now is the shared type library and Chalk integration in rustc. That would unblock extracting more parts of rustc. There is no overarching long-term plan right now. |
There's a bunch of stuff we need to implement to support const generics at least enough to get method resolution right in simple cases:
hir_ty
that currently assume only type parameters exist. A good place to start is probably theGenerics
helper inhir_ty
'sutil.rs
InternedConcreteConst
in ourInterner
from()
to an enum that can represent these numbersconst_eq
method onInterner
Result<Binders<Const>, ConstEvalError>
that can be either a concrete const, aBoundVar
referring to a const param, or an error if the expression is too complicated. We'll want to handle errors differently depending on the situation (while inferring bodies, we could replace them by const variables, for example). We should stick to only evaluating simple integer literals for now. We'll need to call this query during type lowering.{ N + 1 }
(whereN
is a const param), we need support in Chalk for unevaluated consts that doesn't exist yetThe text was updated successfully, but these errors were encountered: