Skip to content

Tracking issue for shared type library #16

Open
@nikomatsakis

Description

@nikomatsakis

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions