Stream: wg-traits

Topic: design meeting 2019.12.30


nikomatsakis (Dec 30 2019 at 19:04, on Zulip):

Hey all -- not sure who's around today.

nikomatsakis (Dec 30 2019 at 19:04, on Zulip):

er, cc @WG-traits

Jack Huey (Dec 30 2019 at 19:05, on Zulip):

I'm around

matklad (Dec 30 2019 at 19:05, on Zulip):

:wave:

nikomatsakis (Dec 30 2019 at 19:05, on Zulip):

I'm still booting back up from holidays

Jack Huey (Dec 30 2019 at 19:05, on Zulip):

Didn't know if we wanted to skip this week or not?

nikomatsakis (Dec 30 2019 at 19:05, on Zulip):

Yeah I don't know either :)

Jack Huey (Dec 30 2019 at 19:06, on Zulip):

But there are a couple things I've thought about the past couple weeks

Jack Huey (Dec 30 2019 at 19:06, on Zulip):

Or things that have come up

Jack Huey (Dec 30 2019 at 19:06, on Zulip):

So, @nikomatsakis in your PR, i.r.t. GeneratorWitness

nikomatsakis (Dec 30 2019 at 19:07, on Zulip):

OK. I've been thinking mostly about our overall strategy and what steps I think we should be taking first

nikomatsakis (Dec 30 2019 at 19:07, on Zulip):

what does "irt" mean

Jack Huey (Dec 30 2019 at 19:07, on Zulip):

(in regards to)

Jack Huey (Dec 30 2019 at 19:07, on Zulip):

Don't know if you saw my comment

nikomatsakis (Dec 30 2019 at 19:07, on Zulip):

that there should be more docs?

Jack Huey (Dec 30 2019 at 19:08, on Zulip):

but compared to everything else, it feels very "specific", compared to everything else that is sort of abstracted

nikomatsakis (Dec 30 2019 at 19:08, on Zulip):

Ah. Yes. That's true, but I feel ok about it

nikomatsakis (Dec 30 2019 at 19:08, on Zulip):

Specifically, I think it's an indication of rust itself lacking a feature :)

nikomatsakis (Dec 30 2019 at 19:09, on Zulip):

that is, we've introduced generators as a kind of "special case" for a struct that can encapsulate lifetimes (the lifetime of the suspended generator frame)

Jack Huey (Dec 30 2019 at 19:09, on Zulip):

I guess, it's hard for me to make any suggestions about how to generalize it because I don't know anything about what it is at all

nikomatsakis (Dec 30 2019 at 19:09, on Zulip):

and we don't have the general case of that

Jack Huey (Dec 30 2019 at 19:09, on Zulip):

ah

nikomatsakis (Dec 30 2019 at 19:09, on Zulip):

so I'm kind of inclined to just code it up as is, and not try to prematurely generalize

Jack Huey (Dec 30 2019 at 19:09, on Zulip):

fair enough

nikomatsakis (Dec 30 2019 at 19:09, on Zulip):

that said, I think that for most of chalk, it won't make much difference even when/if we were to generalize

nikomatsakis (Dec 30 2019 at 19:10, on Zulip):

I suppose that the generalizaton might be to merge structs + generator-witnesses and allow both of them to have "some number" of existential types/lifetimes internally (zero for most structs)

Jack Huey (Dec 30 2019 at 19:10, on Zulip):

I think that's mostly true

Jack Huey (Dec 30 2019 at 19:10, on Zulip):

(to the first)

nikomatsakis (Dec 30 2019 at 19:11, on Zulip):

I think that's mostly true

is there some specific exception you are thinking about?

Jack Huey (Dec 30 2019 at 19:11, on Zulip):

similar to Fn, where it's seems specific too

Jack Huey (Dec 30 2019 at 19:11, on Zulip):

no, nothing in particular right now

nikomatsakis (Dec 30 2019 at 19:12, on Zulip):

Yes, I think fn + generators are the kind of specific ones

nikomatsakis (Dec 30 2019 at 19:12, on Zulip):

otoh, they're also rather unique in rust's type system

nikomatsakis (Dec 30 2019 at 19:12, on Zulip):

fn's because they have the ability to quantify over lifetimes (e.g., for<'a>)

nikomatsakis (Dec 30 2019 at 19:12, on Zulip):

and generators because of the exists<'a>

nikomatsakis (Dec 30 2019 at 19:12, on Zulip):

otherwise they're both "kind of" just structs

nikomatsakis (Dec 30 2019 at 19:13, on Zulip):

(fns also have ABI and arity to consider, that is, number of arguments, but you could make that part of the "type name" so to speak)

nikomatsakis (Dec 30 2019 at 19:14, on Zulip):

similarly I was at first inclined to combine them, since in point of fact I'm not sure that the forall/exists matters to chalk, but I think that was more confusing than just having two "somewhat specific" types

nikomatsakis (Dec 30 2019 at 19:14, on Zulip):

and I guess that the existence of binders seems like reason enough to call them out

Jack Huey (Dec 30 2019 at 19:15, on Zulip):

possibly

nikomatsakis (Dec 30 2019 at 19:15, on Zulip):

but let's step back one bit from this relatively narrow question --

nikomatsakis (Dec 30 2019 at 19:15, on Zulip):

there are a few other larger questions I'm wondering about, trying to put them into words

nikomatsakis (Dec 30 2019 at 19:16, on Zulip):

I guess I'll just dump down a few that come to mind

Jack Huey (Dec 30 2019 at 19:16, on Zulip):

sure

nikomatsakis (Dec 30 2019 at 19:16, on Zulip):
nikomatsakis (Dec 30 2019 at 19:17, on Zulip):
nikomatsakis (Dec 30 2019 at 19:17, on Zulip):
nikomatsakis (Dec 30 2019 at 19:18, on Zulip):

(some of it is rote stuff like "rename X to "Y" and some a bit more complex like "introduce a new associated type for this thing")

nikomatsakis (Dec 30 2019 at 19:18, on Zulip):

I guess bigger picture I want to kind of have the steps written down, I have to pull back up that hackmd I was creating and see how far I got

Jack Huey (Dec 30 2019 at 19:19, on Zulip):

Sounds good to me. It makes more sense given that the scheme of TypeFamily, TypeData, etc.

Jack Huey (Dec 30 2019 at 19:19, on Zulip):

I definitely think that's the next step

nikomatsakis (Dec 30 2019 at 19:20, on Zulip):

I guess this was the hackmd https://hackmd.io/J1QG2rwERAKdknM_qgrhMA

Jack Huey (Dec 30 2019 at 19:20, on Zulip):

This was sort of what I envisioned when I mentioned at one point i.r.t. issue cleanup with making a tracking issue for different "goals", including rustc integration

nikomatsakis (Dec 30 2019 at 19:20, on Zulip):

and it has a pretty fine-grained list, actually

nikomatsakis (Dec 30 2019 at 19:20, on Zulip):

yes, it maybe should move to a tracking issue, I'm not sure

nikomatsakis (Dec 30 2019 at 19:20, on Zulip):

or tracking issue(s)

Jack Huey (Dec 30 2019 at 19:21, on Zulip):

I remember seeing that hackmd, but I never read through it

nikomatsakis (Dec 30 2019 at 19:21, on Zulip):

but some of the goals needs to be further expanded

nikomatsakis (Dec 30 2019 at 19:21, on Zulip):

notab ly "chalk bug fixes and improvements", most of those are themselves top-lvel items

nikomatsakis (Dec 30 2019 at 19:21, on Zulip):

one thing to ponder is where is the best place to first integrate chalk

nikomatsakis (Dec 30 2019 at 19:22, on Zulip):

i.e., within rustc

nikomatsakis (Dec 30 2019 at 19:22, on Zulip):

I was thinking that an interesting idea might be to try and (optionally, of course) start by replacing rustc's coherence check

Jack Huey (Dec 30 2019 at 19:22, on Zulip):

So, how much of the existing chalk integration is "usable"

nikomatsakis (Dec 30 2019 at 19:22, on Zulip):

( the existing chalk integration goes straight for type-checking, which is also good )

nikomatsakis (Dec 30 2019 at 19:22, on Zulip):

So, how much of the existing chalk integration is "usable"

tbh .. probably most of it

nikomatsakis (Dec 30 2019 at 19:23, on Zulip):

I mean we have to delete a lot o fit

nikomatsakis (Dec 30 2019 at 19:23, on Zulip):

because chalk-solve does that work now

nikomatsakis (Dec 30 2019 at 19:23, on Zulip):

so hmm

nikomatsakis (Dec 30 2019 at 19:23, on Zulip):

I geuss that would be good work for me to do

nikomatsakis (Dec 30 2019 at 19:23, on Zulip):

potentially, anyway

nikomatsakis (Dec 30 2019 at 19:24, on Zulip):

I guess the answer to your question is hard to give

Jack Huey (Dec 30 2019 at 19:24, on Zulip):

I, personally, am interested in trying to help with the rustc integration. But I feel like there's still a few things in Chalk only that I need to work on

Jack Huey (Dec 30 2019 at 19:24, on Zulip):

Which I guess I can enumerate

nikomatsakis (Dec 30 2019 at 19:24, on Zulip):

I think we're not quite there but yes best would be to do the rustc integration work together probably, and not any one person :)

nikomatsakis (Dec 30 2019 at 19:25, on Zulip):

certainly a pre-req is going to be trying to connect types, for example

Jack Huey (Dec 30 2019 at 19:27, on Zulip):
nikomatsakis (Dec 30 2019 at 19:29, on Zulip):

I hadn't seen those two issues

nikomatsakis (Dec 30 2019 at 19:29, on Zulip):

Both are making me wonder about

nikomatsakis (Dec 30 2019 at 19:29, on Zulip):

the idea of extending chalk so that it can log test cases

nikomatsakis (Dec 30 2019 at 19:29, on Zulip):

so that we can readily reproduce these sorts of problems

nikomatsakis (Dec 30 2019 at 19:30, on Zulip):

I'm not too surprised about perf, I'll leave some notes of what I see from that stack trace

matklad (Dec 30 2019 at 19:30, on Zulip):

Yup, this is something I'd like to raise as well

nikomatsakis (Dec 30 2019 at 19:30, on Zulip):

@matklad do you mean the "log test cases" idea? or the two issues

Jack Huey (Dec 30 2019 at 19:30, on Zulip):

the idea of extending chalk so that it can log test cases

how?

matklad (Dec 30 2019 at 19:30, on Zulip):

Recently, I've seen couple of performance/panics problems with chalk, but did't have time to minize to get a useful repro

nikomatsakis (Dec 30 2019 at 19:30, on Zulip):

my thought was this

nikomatsakis (Dec 30 2019 at 19:30, on Zulip):

so chalk integrates with rust-analyzer via the RustIrDatabase trait

nikomatsakis (Dec 30 2019 at 19:30, on Zulip):

you could imagine a "wrapper" impl of this trait

nikomatsakis (Dec 30 2019 at 19:31, on Zulip):

that forwarded the requests to rust-analyzer, but tracked the answers that it got

matklad (Dec 30 2019 at 19:31, on Zulip):

Another one fun perf issue is https://github.com/rust-lang/chalk/issues/298

nikomatsakis (Dec 30 2019 at 19:31, on Zulip):

and uses that to dump out into a .chalk file as it goes

nikomatsakis (Dec 30 2019 at 19:31, on Zulip):

that conatins struct, trait defitions, etc

Jack Huey (Dec 30 2019 at 19:31, on Zulip):

oh that would be neat

nikomatsakis (Dec 30 2019 at 19:31, on Zulip):

(we probably also want to track goals)

nikomatsakis (Dec 30 2019 at 19:32, on Zulip):

it seems .. emintently doable to me, though it may require some tweaking of things

matklad (Dec 30 2019 at 19:32, on Zulip):

That would be neat, but I feel we also should implement an automatic shrinking infrastructure for this to be useful

matklad (Dec 30 2019 at 19:32, on Zulip):

That is, I fear that just a raw dump of everything wouldn't be much more useful than a dump of a source code

Jack Huey (Dec 30 2019 at 19:32, on Zulip):

That would be neat, but I feel we also should implement an automatic shrinking infrastructure for this to be useful

do you mean like making a minimal repro?

matklad (Dec 30 2019 at 19:33, on Zulip):

@Jack Huey rigth

Jack Huey (Dec 30 2019 at 19:33, on Zulip):

I'm not sure how much work that would take though

nikomatsakis (Dec 30 2019 at 19:34, on Zulip):

That is, I fear that just a raw dump of everything wouldn't be much more useful than a dump of a source code

I disagree :)

nikomatsakis (Dec 30 2019 at 19:34, on Zulip):

Obviously, it'd be better if we can minimize

nikomatsakis (Dec 30 2019 at 19:34, on Zulip):

But

nikomatsakis (Dec 30 2019 at 19:34, on Zulip):

Having something to reproduce the problem manually seems already pretty useful;

nikomatsakis (Dec 30 2019 at 19:34, on Zulip):

it lets me debug in just chalk

nikomatsakis (Dec 30 2019 at 19:34, on Zulip):

it lets people extract out stuff from their non-public code bases

nikomatsakis (Dec 30 2019 at 19:34, on Zulip):

they may be reluctant to post it, but it would contain very little information

nikomatsakis (Dec 30 2019 at 19:35, on Zulip):

e.g., just the names of traits and impls etc

nikomatsakis (Dec 30 2019 at 19:35, on Zulip):

but not the bodies of any functions

nikomatsakis (Dec 30 2019 at 19:35, on Zulip):

and anyway having the ability to dump the info would be a first step towards being able to minimze it

Jack Huey (Dec 30 2019 at 19:36, on Zulip):

yeah, I'll probably play with that idea when I get to perf stuff

nikomatsakis (Dec 30 2019 at 19:36, on Zulip):

anyway, I think it's the kind of thing that will be hard to prioritize, but will be a productivity multiplier if we gret something done

Jack Huey (Dec 30 2019 at 19:37, on Zulip):

Also falling into that is the idea of "fuel friendly" and such

nikomatsakis (Dec 30 2019 at 19:37, on Zulip):

(one other thing: it doesn't have to be a .chalk file, could be a different format)

nikomatsakis (Dec 30 2019 at 19:37, on Zulip):

is https://github.com/rust-lang/chalk/issues/314 from ethereum, do you know @matklad ?

matklad (Dec 30 2019 at 19:38, on Zulip):

I don't

matklad (Dec 30 2019 at 19:38, on Zulip):

But it's true that chalk panics on parity's substrate :-)

nikomatsakis (Dec 30 2019 at 19:38, on Zulip):

i.e., https://github.com/rust-lang/chalk/issues/301 ?

Jack Huey (Dec 30 2019 at 19:38, on Zulip):

@nikomatsakis you took what I said in my comment and put it into more words :joy:

nikomatsakis (Dec 30 2019 at 19:38, on Zulip):

does rust-analyzer still truncate with a very low threshold?

matklad (Dec 30 2019 at 19:39, on Zulip):

@nikomatsakis yep, that's one of the issue

nikomatsakis (Dec 30 2019 at 19:39, on Zulip):

it's a useful stress test though probably not really viable long term ..

matklad (Dec 30 2019 at 19:40, on Zulip):

the other I remeber is a crash on libp2p, which has like 17 where clause

matklad (Dec 30 2019 at 19:40, on Zulip):

does rust-analyzer still truncate with a very low threshold?

I think yes

matklad (Dec 30 2019 at 19:41, on Zulip):
const CHALK_SOLVER_MAX_SIZE: usize = 4;
nikomatsakis (Dec 30 2019 at 19:43, on Zulip):

On a different note, one other thing that I did in my chalk-ir 'proposed book chapter' is a lot of renaming

nikomatsakis (Dec 30 2019 at 19:44, on Zulip):

I think I probalby ought to land that, but I should probably move some of the "open questions" and things to some other place

nikomatsakis (Dec 30 2019 at 19:45, on Zulip):

I guess I'm debating a bit how to keep everything organized

nikomatsakis (Dec 30 2019 at 19:45, on Zulip):

seems like the https://github.com/rust-lang/wg-traits repo is underutilized to me

Jack Huey (Dec 30 2019 at 19:45, on Zulip):

Yeah, I think that only is used for minutes at this point?

Jack Huey (Dec 30 2019 at 19:45, on Zulip):

And even then, barely

nikomatsakis (Dec 30 2019 at 19:45, on Zulip):

right

Jack Huey (Dec 30 2019 at 19:46, on Zulip):

past sprints, as well as draft RFCs and other documents

nikomatsakis (Dec 30 2019 at 19:47, on Zulip):

I would like it to be more of a "coordination point" for tracking our plans I think, at a higher-level. I'm thinking just now about what the "top level" goals are

Jack Huey (Dec 30 2019 at 19:47, on Zulip):

I think if we want to put goals for rustc integration, it makes sense here?

Jack Huey (Dec 30 2019 at 19:47, on Zulip):

or I guess, goals in general?

nikomatsakis (Dec 30 2019 at 19:48, on Zulip):

right

nikomatsakis (Dec 30 2019 at 19:48, on Zulip):

I'd like you to be able to come there and get a feeling for the big goals, which probably span multiple repos

nikomatsakis (Dec 30 2019 at 19:48, on Zulip):

not to mention of course some note of what our calendar is and where you could jump in

nikomatsakis (Dec 30 2019 at 19:48, on Zulip):

we are obviously not doing sprints anymore but we could try that again, still seems like a useful structure

Jack Huey (Dec 30 2019 at 19:49, on Zulip):

The big thing with sprints is you need to know what to do and actually have someone to do it

Jack Huey (Dec 30 2019 at 19:49, on Zulip):

but they can be useful

Jack Huey (Dec 30 2019 at 19:50, on Zulip):

guess it goes back to just figuring out goals

nikomatsakis (Dec 30 2019 at 19:50, on Zulip):

I'm trying now to chart out the "highest level goals" in this section of the hackmd

Jack Huey (Dec 30 2019 at 19:53, on Zulip):

Also, @nikomatsakis when you have a bit of time, can you go through the issues on github (especially some of the older ones), and see if they're still relevant? (and/or need to be updated/reworded)

Jack Huey (Dec 30 2019 at 19:54, on Zulip):

Some seem like duplicates of others, or don't really have "actionable" goals

nikomatsakis (Dec 30 2019 at 19:55, on Zulip):

yeah, indeed

nikomatsakis (Dec 30 2019 at 19:55, on Zulip):

I think that most of the older ones are probably ultimately better subsumed into this 'roadmapping' procss

Jack Huey (Dec 30 2019 at 19:55, on Zulip):

Right

Jack Huey (Dec 30 2019 at 19:56, on Zulip):

I already went through them a few weeks ago and left a couple comments

Jack Huey (Dec 30 2019 at 19:57, on Zulip):

But some I just don't know the context at the time, and they don't have anything actionable, so I can't say what "progress" (if any) has/hasn't been made

Jack Huey (Dec 30 2019 at 19:58, on Zulip):

I'm also going to put some thought into some meaningful labels for issues

nikomatsakis (Dec 30 2019 at 20:00, on Zulip):

ok, gotta run for a bit

Jack Huey (Dec 30 2019 at 20:00, on Zulip):

Good meeting!

David Barsky (Dec 30 2019 at 20:44, on Zulip):

No rush to respond, but would it be helpful if I send a very small PR that introduced tracing? that being said, i don't see too much use of log in chalk yet, but i haven't done much research yet

nikomatsakis (Dec 30 2019 at 22:25, on Zulip):

@David Barsky probably, yes! Maybe we can do a design meeting around tracing -- or just some async chatter, even better, to try and convey what we would like to capture

matklad (Dec 30 2019 at 22:33, on Zulip):

Somewhat related: rust-analyzer has a home spun hierarchical profiling:

      685ms - get_inlay_hints
          683ms - SourceAnalyzer::new
              683ms - infer_query
                  214ms - trait_solve_query
                      212ms - impl_datum (108 calls)
                   36ms - trait_solve_query
                       27ms - impl_datum (2764 calls)
                   21ms - trait_solve_query
                       16ms - impl_datum (449 calls)
                        1ms - parse_query (1 calls)

Long term, it would be cool if both rust-analyzer and chalk internals could be profiled using the same framework. Maybe the tracing crate is an answer here?

matklad (Dec 30 2019 at 22:35, on Zulip):

I am somewhat intimidated by tracing size though: the thing in rust analyzer is about 300 lines, and I am quite happy with it :)

https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_prof/src/lib.rs

nikomatsakis (Dec 30 2019 at 23:12, on Zulip):

from what @David Barsky tells me tracing can do anything at all :)

David Barsky (Dec 31 2019 at 00:04, on Zulip):

tracing is _not_ small by any means, but it's meant to be a decently modular library (some might argue _too_ modular) that allows for most decisions to be revisited by others. more concretely, it lets folks swap it out core components to function in a no-std environment, or specialize a lot of behavior to their specific performance needs.

David Barsky (Dec 31 2019 at 00:04, on Zulip):

some of those knobs could be better documented though.

David Barsky (Dec 31 2019 at 00:04, on Zulip):

i'll create a new topic for this.

Last update: Jun 07 2020 at 10:40UTC