-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add a conversion method for going from smir::Ty to rustc::Ty #46
Comments
BTW, for |
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Dec 6, 2023
Rollup merge of rust-lang#118516 - celinval:smir-variants, r=ouz-a Add ADT variant infomation to StableMIR and finish implementing TyKind::internal() Introduce a `VariantDef` type and a mechanism to retrieve the definition from an `AdtDef`. The `VariantDef` representation itself is just a combination of `AdtDef` and `VariantIdx`, which allow us to retrieve further information of a variant. I don't think we need to cache extra information for now, and we can translate on an on demand manner. I am leaving the fields public today due to rust-lang/project-stable-mir#56, but they shouldn't. For this PR, I've only added a method to retrieve the variant name, and its fields. I also added an implementation of `RustcInternal` that allow users to retrieve more information using Rust internal APIs. I have also finished the implementation of `RustcInternal` for `TyKind` which fixes rust-lang/project-stable-mir#46. ## Motivation Both of these changes are needed in order to properly interpret things like projections. For example, - The variant definition is used to find out which variant we are downcasting to. - Being able to create `Ty` from `TyKind` helps for example processing each stage of a projection, like the code in `place.ty()`.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In order to be able to invoke some rustc operations (like
Instance::resolve
), we need the rustc version ofGenericArgs
, which containsTy
,Lifetime
andConst
. We should add functionality in therustc_smir
crate for converting back to these three rustc types when starting out with a smir type. This will mostly involve writing the inverse of theirStable::stable
method.Tasks
The text was updated successfully, but these errors were encountered: