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

Tracking issue for shared type library #16

Open
19 of 26 tasks
nikomatsakis opened this issue Mar 27, 2020 · 1 comment
Open
19 of 26 tasks

Tracking issue for shared type library #16

nikomatsakis opened this issue Mar 27, 2020 · 1 comment
Labels
roadmap-tracking-issue Tracks an item on our types team roadmap.

Comments

@nikomatsakis
Copy link
Contributor

nikomatsakis commented Mar 27, 2020

This is a tracking issue for the goal of creating a shared library that represents Rust types. This library should be used by rustc, chalk, and rust-analyzer, and would permit us to pass data and goals between rustc and chalk without any "bridging" cost. It will also permit one to write type-based analyses (like chalk itself!) that do not depend on rustc internals.

What follows is a list of steps to be taken. Those steps with open issues are actionable and ready to go. Those without open issues may be uncertain or maybe we just didn't write up any notes yet -- feel free to ping on Zulip to inquire after the status.

General work items

  • Initial design meeting proposal
  • Propose renaming "type fold" to "type map" (in both rustc/chalk)
  • Propose renaming "type visitor" to "type folder" (in both rustc/chalk, although we don't have a trait like this in chalk yet)
  • Complete comparison spreadsheet that describes names for things in rustc, chalk and what should go into shared library

Rust work items

  • Refactor code in rustc using ty.kind to use a method ty.kind(tcx) (but see bikeshed point above)
  • Extend rustc's Binder type to contain a list of "kinds" for the bound items (discussion)
  • return TyKind by value (maybe) as proposed in Make TyKind Copy and change ty.kind() to return TyKind instead of &TyKind compiler-team#363
  • Extend rustc's late-bound types to contain an index
  • Start to move types into library to figure out what is missing
  • Introduce custom derive for Fold trait
  • Extend Rustc's folder trait to have a Result associated type
  • Extend Rustc's visit trait to not hard-code a boolean result?
  • Extend Rustc's TyKind variant to collapse the various scalars into one

Chalk work items

Things to explore

  • Align on a single model of canonicalization -- what gets canonicalized? What about universe canonicalization?

XXX hackmd where sketched a plan, need to incorporate above

bors added a commit to rust-lang-ci/rust that referenced this issue Sep 4, 2020
Refractor ty.kind -> ty.kind() and ty.flags -> ty.flags()

First step for the ["shared library to represent Rust types"](https://rust-lang.github.io/compiler-team/minutes/design-meeting/2020-03-12-shared-library-for-types/) work (rust-lang/types-team#16).

This PR makes the `TyS::kind` field private and adds a `kind()` method to access it.
As noted [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/144729-wg-traits/topic/Looking.20to.20contribute/near/205185412), this refractoring might require a MCP. I am perfectly fine with having to wait until MCP is accepted and resolving the conflicts that pop up afterwards.

r? @nikomatsakis
bors added a commit to rust-lang/chalk that referenced this issue Nov 28, 2021
Introduce `Folder::Error`

Equivalent to rust-lang/rust#85469, cc rust-lang/compiler-team#432 rust-lang/types-team#16.

This compiles, but there are implementations of `Folder` that still use `Fallible<T>` instead of `Result<T, Self::Error>`. I can make that change if it is deemed beneficial.

r? `@jackh726`
@jackh726 jackh726 added the roadmap-tracking-issue Tracks an item on our types team roadmap. label Feb 6, 2023
@jackh726
Copy link
Member

Michael has made many PRs towards this effort!:
rust-lang/rust#116828
rust-lang/rust#116912
rust-lang/rust#116946
rust-lang/rust#116951
rust-lang/rust#116993
rust-lang/rust#117008
rust-lang/rust#117578
rust-lang/rust#117580
rust-lang/rust#117582
rust-lang/rust#117851

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
roadmap-tracking-issue Tracks an item on our types team roadmap.
Projects
None yet
Development

No branches or pull requests

2 participants