Stream: wg-traits

Topic: weekly meeting 2018-10-08


nikomatsakis (Oct 08 2018 at 18:31, on Zulip):

Hello all :) welcome to the "30 min late" weekly meeting

nikomatsakis (Oct 08 2018 at 18:32, on Zulip):

This meeting is meant to be a bit informal so I didn't prepare an agenda in advance or anything

Sunjay Varma (Oct 08 2018 at 18:32, on Zulip):

Hello! :wave:

nikomatsakis (Oct 08 2018 at 18:33, on Zulip):

@dhardy you mentioned wanting to work on trait object upcast, I think that's an interesting idea: my main concern has been working on integrating chalk but actually there are a few topics that might be worth looking at which are — at least somewhat — independent

nikomatsakis (Oct 08 2018 at 18:33, on Zulip):

I was thinking of trait aliases too

dhardy (Oct 08 2018 at 18:33, on Zulip):

Yes, I thought it's somewhat independent... trait objects are a different thing from traits

dhardy (Oct 08 2018 at 18:34, on Zulip):

I'm still struggling to find my way around the compiler so haven't got anywhere

nikomatsakis (Oct 08 2018 at 18:34, on Zulip):

I forget, was it you that I was talking about on this topic before?

nikomatsakis (Oct 08 2018 at 18:34, on Zulip):

There was someone :)

dhardy (Oct 08 2018 at 18:34, on Zulip):

Not sure but probably not. I made some comments on the linked GH issue

nikomatsakis (Oct 08 2018 at 18:34, on Zulip):

There are various complexities to deal with, and I had been talking to someone about drafting up an RFC

nikomatsakis (Oct 08 2018 at 18:34, on Zulip):

we had created this repo

nikomatsakis (Oct 08 2018 at 18:35, on Zulip):

but as you can see — its contents are empty :)

nikomatsakis (Oct 08 2018 at 18:35, on Zulip):

so evidently we didn't get too far

nikomatsakis (Oct 08 2018 at 18:35, on Zulip):

I think trait object upcast involves figuring out a few things — e.g., we have to talk about the runtime representation we'll be using etc — but it's probably worth looking for some easy "subproblems" to start with

dhardy (Oct 08 2018 at 18:36, on Zulip):

Does it need an RFC? There are are some questions about how exactly vtables and upcasts work, but seems like the only questions are technical (can this be done) rather than design (what should be done)?

nikomatsakis (Oct 08 2018 at 18:37, on Zulip):

It's borderline perhaps, but I think an RFC would be helpful, or at minimum a design document.

nikomatsakis (Oct 08 2018 at 18:37, on Zulip):

We tend to skimp those and I don't like it

nikomatsakis (Oct 08 2018 at 18:37, on Zulip):

it also feels tied up in questions about how to handle things like &(A + B)

nikomatsakis (Oct 08 2018 at 18:37, on Zulip):

(where A and B are arbitrary traits)

nikomatsakis (Oct 08 2018 at 18:38, on Zulip):

or rather &dyn (A+B), I suppose

varkor (Oct 08 2018 at 18:38, on Zulip):

(a bit late to the party: by "trait aliases", are we talking about aliases for bounds or traits?)

dhardy (Oct 08 2018 at 18:38, on Zulip):

Okay. I'd prefer to have some progress on an implementation before writing one but might get to that later (when I have a better idea how the internals work).

nikomatsakis (Oct 08 2018 at 18:38, on Zulip):

@varkor I was talking about RFC 1733

varkor (Oct 08 2018 at 18:38, on Zulip):

I think @Alexander Regueiro was also talking about trait object upcasting

dhardy (Oct 08 2018 at 18:38, on Zulip):

&dyn A + B is a multi-trait object, regarding which there are quite a few comments in https://github.com/rust-lang/rfcs/issues/2035

nikomatsakis (Oct 08 2018 at 18:41, on Zulip):

Well, I've not given trait object upcasting a lot of thought, I have to confess, at least not recently. I think the place to start is to figure even what the problems are. =) There are some key language-level choices, though.

nikomatsakis (Oct 08 2018 at 18:41, on Zulip):

For example, is upcasting a kind of coercion or a subtyping operation.

nikomatsakis (Oct 08 2018 at 18:41, on Zulip):

subtyping meaning "no change is needed at runtime"

nikomatsakis (Oct 08 2018 at 18:41, on Zulip):

I suspect we will go with a coercion

nikomatsakis (Oct 08 2018 at 18:41, on Zulip):

but i'm not sure

nikomatsakis (Oct 08 2018 at 18:42, on Zulip):

that would imply that e.g. Vec<Arc<dyn Trait>> cannot be upcast to Vec<Arc<dyn Supertrait>>

nikomatsakis (Oct 08 2018 at 18:42, on Zulip):

in any case, @eddyb and @kimundi had an early RFC about this that is worth revisiting

nikomatsakis (Oct 08 2018 at 18:43, on Zulip):

(My general hope was that we could approach the RFC writing and implementation in tandem, sketch out a rough plan, working on it, and revising as we go — which is actually something I'd like to move towards more generally, but that's neither here nor there)

nikomatsakis (Oct 08 2018 at 18:44, on Zulip):

ok, so, in the past we had this dropbox paper document for kind of tracking things

dhardy (Oct 08 2018 at 18:44, on Zulip):

Upcast of Vec<dyn Trait> to Vec<dyn Supertrait> is in any case unsound (because it allows users to push dyn Othersubtrait objects)

nikomatsakis (Oct 08 2018 at 18:44, on Zulip):

it is not unsound

nikomatsakis (Oct 08 2018 at 18:45, on Zulip):

we have a notion of variance already for the existing region-based subtyping

nikomatsakis (Oct 08 2018 at 18:45, on Zulip):

note that if you own the Vec<dyn Trait> and you upcast it

nikomatsakis (Oct 08 2018 at 18:45, on Zulip):

no harm is done

nikomatsakis (Oct 08 2018 at 18:45, on Zulip):

because there exists no alias

nikomatsakis (Oct 08 2018 at 18:45, on Zulip):

that is, nobody to "remember" the old type :)

dhardy (Oct 08 2018 at 18:45, on Zulip):

True, you have to keep an alias to the old type

nikomatsakis (Oct 08 2018 at 18:45, on Zulip):

if you have an &mut Vec<dyn Trait>, that is not the case, but then we enforce invariance

nikomatsakis (Oct 08 2018 at 18:46, on Zulip):

(in particular, &mut T <: &mut T)

nikomatsakis (Oct 08 2018 at 18:46, on Zulip):

(but &T <: &U :- T <: U)

varkor (Oct 08 2018 at 18:46, on Zulip):

re. tracking: it'd be good to not only have a list of the current objectives wrt chalk, but also what chalk currently supports (and doesn't), to track its overall state

varkor (Oct 08 2018 at 18:48, on Zulip):

(I'm still planning to tackle const generics in chalk, once I get some time, but it's not yet one of the pressing issues, for example)

nikomatsakis (Oct 08 2018 at 18:48, on Zulip):

I think I will remove the old table, and we'll try to sketch a new one. But I would like to have a clear roadmap showing the various "active goals" and the work towards them. @scalexm, @tmandry and I drew up some intermediate steps for Chalk integration but I think they've not made their way into this document, so perhaps that can be a goal for next time. I think @varkor that steps within chalk just fit into that general framework (they may be separate "topline" goals, in some cases — for example, I'd like to push harder on modeling specialization at the chalk level etc)

nikomatsakis (Oct 08 2018 at 18:48, on Zulip):

I'm not sure whether Dropbox paper is the right form for this sort of planning though

nikomatsakis (Oct 08 2018 at 18:49, on Zulip):

I'm going to start by moving the existing tracking somewhere else, since it's outdated, but I don't necessarily want to lose it

Diogo Sousa (Oct 08 2018 at 18:50, on Zulip):

@nikomatsakis I want to start doing some chalk work but I'm not currently familiar with rustc or chalk. What would be something good for me to get started? Whatever can add some value to chalk would be nice.

tmandry (Oct 08 2018 at 18:50, on Zulip):

fwiw Paper actually lets you set action items for people and "due dates" in a doc, not sure if we'd want to use that feature but it might help keep people more organized

Sunjay Varma (Oct 08 2018 at 18:51, on Zulip):

Should we resurrect the old paper document for WG-traits?

nikomatsakis (Oct 08 2018 at 18:51, on Zulip):

@Sunjay Varma the paper link is here

tmandry (Oct 08 2018 at 18:51, on Zulip):

@Sunjay Varma niko linked to it above ^

nikomatsakis (Oct 08 2018 at 18:52, on Zulip):

I've cleared out the existing content, but it is available in the history from what I can see

tmandry (Oct 08 2018 at 18:52, on Zulip):

oh i see

nikomatsakis (Oct 08 2018 at 18:52, on Zulip):

I was finding it a bit overwhelming :)

nikomatsakis (Oct 08 2018 at 18:52, on Zulip):

I think maybe the main thing for this meeting that would be good is to just brainstorm a bit the topline goals and try to prioritize them a bit

nikomatsakis (Oct 08 2018 at 18:52, on Zulip):

@Diogo Sousa btw, I think that's the question we're aiming to answer a bit in this meeting and over the next few weeks :)

nikomatsakis (Oct 08 2018 at 18:54, on Zulip):

ok, I added a bit to the paper brainstorming some possible goals:

nikomatsakis (Oct 08 2018 at 18:56, on Zulip):

So I guess it would be useful for now to have this:

Diogo Sousa (Oct 08 2018 at 18:57, on Zulip):

What is the current state of chalk? I mean, what are the missing pieces to have chalk fully able to check (all rust) programs?

nikomatsakis (Oct 08 2018 at 18:57, on Zulip):

some kind of idea of how many people are maybe interesting in doing things :)

Diogo Sousa (Oct 08 2018 at 18:57, on Zulip):

(sorry, I don't have a lot of context yet)

nikomatsakis (Oct 08 2018 at 18:58, on Zulip):

I'm not 100% sure. In some sense, chalk is more complete, but it doesn't model specialization right now, nor does it have a notion of trait objects, and probably some other Rust "special cases" we'll have to decide how to handle.

nikomatsakis (Oct 08 2018 at 18:58, on Zulip):

You have to have a full picture of how it fits together: chalk is really a shorthand that refers in some sense to a lot of things

nikomatsakis (Oct 08 2018 at 18:59, on Zulip):

e.g., there is an underlying chalk-engine crate, and it is basically complete, but it relies on some front-end lowering Rust traits + impls into the form it expects

nikomatsakis (Oct 08 2018 at 18:59, on Zulip):

the chalk crate itself is not something rustc will ever directly depend on

nikomatsakis (Oct 08 2018 at 18:59, on Zulip):

it's kind of an elaborate unit testing harness that demonstates how trait lowering can work

nikomatsakis (Oct 08 2018 at 19:00, on Zulip):

(maybe eventually we'll be able to pull some of that code into common crates shared with rustc, though, but it's not an immediate goal)

nikomatsakis (Oct 08 2018 at 19:00, on Zulip):

there is some stuff written up in the rustc-guide under the "trait-solving (new style)" chapter

nikomatsakis (Oct 08 2018 at 19:00, on Zulip):

that may help to "set the scene"

Sunjay Varma (Oct 08 2018 at 19:01, on Zulip):

Preliminary chalk integration
- Goal: to type-check a very simple program using chalk

I am interested in working (at least in some small part) on this. It's one of the things I wished I had gotten to a few months ago :smile:

nikomatsakis (Oct 08 2018 at 19:01, on Zulip):

so in terms of completing chalk, what we are kind of talking about is extending that unit testing harness to figure out how to lower more things

Josh Huber (Oct 08 2018 at 19:02, on Zulip):

Well, I'm here and interested in doing things. You may or may not have seen this, but: I have some experience with Rust and limited experience with rustc. I'm hoping to get involved here as a way to learn more and help out, though. :)

Sunjay Varma (Oct 08 2018 at 19:03, on Zulip):

@Diogo Sousa I put some links at the top of the document that are helpful for context

nikomatsakis (Oct 08 2018 at 19:03, on Zulip):

I'm thinking a bit more; I think probably the thing to do is to try to move some of this "overall plan" state into GH in the form of issues and labels. I've found that ultimately that's the most effective way to drive things.

scalexm (Oct 08 2018 at 19:03, on Zulip):

@nikomatsakis basically the most important things when it comes to completing chalk are trait objects and type outlive requirements

Diogo Sousa (Oct 08 2018 at 19:03, on Zulip):

I see. I will try to explore the current state of things this week. Thanks @nikomatsakis!

Right now I have an airplane to catch, but after that I will read the rest of the topic.

Diogo Sousa (Oct 08 2018 at 19:03, on Zulip):

thanks @Sunjay Varma, I will look into those.

scalexm (Oct 08 2018 at 19:03, on Zulip):

(I think specialization and const generics might wait a bit)

nikomatsakis (Oct 08 2018 at 19:04, on Zulip):

Can those of you who are attending add some info to this section of the minutes?

nikomatsakis (Oct 08 2018 at 19:04, on Zulip):

@scalexm what do you mean by "type outlive requirements"?

nikomatsakis (Oct 08 2018 at 19:04, on Zulip):

I don't feel like that is chalk's job

nikomatsakis (Oct 08 2018 at 19:04, on Zulip):

so i'm not 100% sure if I know what you mean

nikomatsakis (Oct 08 2018 at 19:04, on Zulip):

or do you mean just "Adding that as a kind of domain goal"?

scalexm (Oct 08 2018 at 19:04, on Zulip):

mmh I think we need some "implied" outlive requirements in chalk no?

nikomatsakis (Oct 08 2018 at 19:05, on Zulip):

Hmm.

scalexm (Oct 08 2018 at 19:05, on Zulip):

or maybe not

scalexm (Oct 08 2018 at 19:05, on Zulip):

I'm not sure now

nikomatsakis (Oct 08 2018 at 19:05, on Zulip):

because we are no longer "elaborating" the type context but moving over to implied bounds?

nikomatsakis (Oct 08 2018 at 19:05, on Zulip):

I guess the answer is "maybe", I think we can probably avoid it to start, it's certainly (imo) not needed to get our first program working

scalexm (Oct 08 2018 at 19:06, on Zulip):

like, I remember translating StreamingIterator to chalk there: https://gist.github.com/scalexm/e3e4ecefe970a2df861cc158e50c363c

nikomatsakis (Oct 08 2018 at 19:06, on Zulip):

but I would like to talk over how to handle outlives at some point and how to model it in a better way. This is somewhat tied in with NLL + polonius etc though.

scalexm (Oct 08 2018 at 19:07, on Zulip):

and I needed to hack in an implied outlive requirement in order to model it well

nikomatsakis (Oct 08 2018 at 19:07, on Zulip):

right, I guess I am basically thinking that we can add some kind of T: 'a thing to chalk, but it basically just gets propagated back up and left for rustc to handle

Josh Huber (Oct 08 2018 at 19:07, on Zulip):

(Niko - this is Josh. I've been to the Kendall square Rust lunch a few times, and we talked about getting involved, and you suggested poking at a working group. So here we are. :)

nikomatsakis (Oct 08 2018 at 19:07, on Zulip):

(which is what the trait solver does today)

scalexm (Oct 08 2018 at 19:07, on Zulip):

@nikomatsakis yeah ok so just add T: 'a goal basically then

nikomatsakis (Oct 08 2018 at 19:09, on Zulip):

I'm debating how to proceed :) I think what I want to do is to try and move these "top-line goal" ideas into github, opening up various issues and using labels etc to track. I've found ultimately it's best to lean on GH for these sorts of things. I don't think I want to do that synchronously right here, but it'd be good to grab a smaller group and do it live in the next day or two. Then we can try to advertise those work items and people can sign up

nikomatsakis (Oct 08 2018 at 19:09, on Zulip):

and we can 'check in' on progress next Monday as well as revisiting the overall structure?

tmandry (Oct 08 2018 at 19:10, on Zulip):

works for me

nikomatsakis (Oct 08 2018 at 19:10, on Zulip):

maybe we should pick a time for that

nikomatsakis (Oct 08 2018 at 19:12, on Zulip):

I guess I would probably aim to do more of that planning tomorrow at 10am EST (but as I said I don't think it's something where a ton of people need to be present)

nikomatsakis (Oct 08 2018 at 19:12, on Zulip):

in particular, I think it only makes sense if you already have a pretty good grasp of rustc + chalk etc...

tmandry (Oct 08 2018 at 19:13, on Zulip):

I can make it then

nikomatsakis (Oct 08 2018 at 19:14, on Zulip):

ok

Sunjay Varma (Oct 08 2018 at 19:14, on Zulip):

I can make it

nikomatsakis (Oct 08 2018 at 19:14, on Zulip):

great, let's reconvene then, and once we've got some issues chopped up we can post them to zulip/internals ?

nikomatsakis (Oct 08 2018 at 19:15, on Zulip):

sorry for being 30 min late today again btw :) though actually I think we should shoot to keep these meetings 30min if at all possible

nikomatsakis (Oct 08 2018 at 19:15, on Zulip):

I'm all about the 30min meeting these days :)

tmandry (Oct 08 2018 at 19:16, on Zulip):

sounds good :wave:

Josh Huber (Oct 08 2018 at 19:17, on Zulip):

that sounds great to me. i'm mostly going to sit back and see what sorts of things you come up with and see if there's tasklets that'd be a good way for me to get started. so I suppose I'll just return next Monday!

Alexander Regueiro (Oct 08 2018 at 19:20, on Zulip):

@varkor I have been yes. Haven't gotten around to writing up a document still, but there's a repo for an RFC there. Needs some brainstorming.

davidtwco (Oct 08 2018 at 20:03, on Zulip):

@nikomatsakis could you create a calendar event for this meeting like the NLL group?

nikomatsakis (Oct 08 2018 at 20:03, on Zulip):

I have one, I can add people to it as needed (I'll add you, @davidtwco)

Sunjay Varma (Oct 09 2018 at 14:03, on Zulip):

:wave:

nikomatsakis (Oct 09 2018 at 14:05, on Zulip):

hello @Sunjay Varma , I started this topic

Last update: Nov 12 2019 at 16:15UTC