Skip to content
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

Create a new trait CrateDefType to retrieve definiton type #80

Closed
celinval opened this issue Jun 10, 2024 · 0 comments · Fixed by rust-lang/rust#126366
Closed

Create a new trait CrateDefType to retrieve definiton type #80

celinval opened this issue Jun 10, 2024 · 0 comments · Fixed by rust-lang/rust#126366

Comments

@celinval
Copy link
Contributor

The goal would be to provide a trait to allow users to access tcx.type_of() for definitions that have a type, such as FnDef, InstanceDef, StaticDef...

Something like:

trait CrateDefType : CrateDef {
  fn ty(&self) -> Ty {
    with(|cx| cx.type_of(self.def_id()))
  }
}

I think this should be a separate trait, since not every CrateDef has a type. Thus, only the ones that do should implement the new trait.

fmease added a commit to fmease/rust that referenced this issue Jun 13, 2024
Add a new trait to retrieve StableMir definition Ty

We implement the trait only for definitions that should have a type. It's possible that I missed a few definitions, but we can add them later if needed.

Fixes rust-lang/project-stable-mir#80
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jun 13, 2024
Rollup merge of rust-lang#126366 - celinval:issue-0080-def-ty, r=oli-obk

Add a new trait to retrieve StableMir definition Ty

We implement the trait only for definitions that should have a type. It's possible that I missed a few definitions, but we can add them later if needed.

Fixes rust-lang/project-stable-mir#80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant