Model coherence in a-mir-formality - Rust Project Goals (original) (raw)

Summary

We will model coherence (including negative impls) in a-mir-formality and compare its behavior against rustc. This will require extending a-mir-formality with the ability to run Rust tests.

Motivation

Over the next six months we will test a-mir-formality's model of coherence against the new trait solver. To do this, we will extend it with the ability to run (small, simple) Rust files as tests and then build a tool to compare its behavior against rustc. This is working towards our ultimate goal for a-mir-formality being an "executable spec and playground" for the Rust type system. There are a number of things that need to happen for that goal to be truly realized in practice but the biggest of them is to be able to compare behavior against rustc.

The status quo

a-mir-formality has a sketch of a model of the Rust type system but tests must be written in a "Rust-like" dialect. This dialect is great for precisely controlling the input but makes it impossible to compare mir-formality's behavior to rustc in any systematic way.

The next 6 months

Our goal for the next 6 months is to use a-mir-formality to document and explore Rust's coherence system. Towards this end we will do two major initiatives:

We will use the ability to run tests to compare the behavior of a-mir-formality against rustc, looking for discrepancies between the model and rustc's actual behavior.

The "shiny future" we are working towards

We are working towards a future where

Design axioms

The primary "axiom" in choosing this goal is that there's nothing like the magic of running code -- in other words, the best way to make the shiny future come true is going to be making it easy to write tests and play with a-mir-formality. Right now the barrier to entry is still too high.

Ownership and team asks

Task Owner(s) or team(s) Notes
Discussion and moral support Team types

Modeling and documenting coherence rules

Task Owner(s) or team(s) Notes
Author explainer for coherence model Niko Matsakis

Running Rust tests in a-mir-formality

Task Owner(s) or team(s) Notes
Mentorship Niko Matsakis
Implementation Help wanted

Stretch goal: modeling Rust borrow checker

As a stretch goal, we can extend a-mir-formality to model the bodies of functions and try to model the Rust borrow checker.

Task Owner(s) or team(s) Notes
Mentorship Niko Matsakis
Implementation Help wanted

Definitions

Definitions for terms used above:

Frequently asked questions

What do I do with this space?

This is a good place to elaborate on your reasoning above -- for example, why did you put the design axioms in the order that you did? It's also a good place to put the answers to any questions that come up during discussion. The expectation is that this FAQ section will grow as the goal is discussed and eventually should contain a complete summary of the points raised along the way.