Stream: wg-traits

Topic: chalk-rustc integration discussion


nikomatsakis (Mar 19 2019 at 19:00, on Zulip):

Hey @WG-traits, we were planning to talk about chalk-rustc integration on Zoom. It'll be recorded.

nikomatsakis (Mar 19 2019 at 19:01, on Zulip):

@scalexm if you happen to be around, I've been looking through the code and I might have a few questions I could send your way :)

nikomatsakis (Mar 19 2019 at 19:01, on Zulip):

(even if you can't attend, I know this time is bad for ya)

Aaron Turon (Mar 19 2019 at 19:01, on Zulip):

i'll try to take notes live here

Aaron Turon (Mar 19 2019 at 19:01, on Zulip):

here's the zoom link

scalexm (Mar 19 2019 at 19:02, on Zulip):

@nikomatsakis I’m around but I’m on my phone so I don’t think I can use zoom :/

nikomatsakis (Mar 19 2019 at 20:32, on Zulip):

ok @scalexm so we didn't get into it in the call, but I do have some questions

nikomatsakis (Mar 19 2019 at 20:32, on Zulip):

first question, where is the code that tries to iterate towards a fixed point to find the set of "implied bounds"-related rules?

nikomatsakis (Mar 19 2019 at 20:32, on Zulip):

oh, I guess that's part of the environment(def_id) query?

scalexm (Mar 19 2019 at 20:32, on Zulip):

@nikomatsakis right

scalexm (Mar 19 2019 at 20:32, on Zulip):

Err

nikomatsakis (Mar 19 2019 at 20:32, on Zulip):

also, in terms of starting points for @Aaron Turon, we were thinking during the call that maybe the best thing

scalexm (Mar 19 2019 at 20:32, on Zulip):

No

scalexm (Mar 19 2019 at 20:32, on Zulip):

program_clauses_for_environment

scalexm (Mar 19 2019 at 20:33, on Zulip):

That’s this one

nikomatsakis (Mar 19 2019 at 20:33, on Zulip):

ah

nikomatsakis (Mar 19 2019 at 20:33, on Zulip):

I overlooked that

nikomatsakis (Mar 19 2019 at 20:33, on Zulip):

thanks

nikomatsakis (Mar 19 2019 at 20:33, on Zulip):

also, in terms of starting points for Aaron Turon, we were thinking during the call that maybe the best thing

right, so we were thinking that maybe a good starting point

nikomatsakis (Mar 19 2019 at 20:33, on Zulip):

might be to try and "clone" the current setup for Sized impls

nikomatsakis (Mar 19 2019 at 20:33, on Zulip):

in order to add rules for Clone or Copy or some such thing

nikomatsakis (Mar 19 2019 at 20:34, on Zulip):

i.e., not try to solve the hard problems, but extend the system to try and understand it better, as a starting point

scalexm (Mar 19 2019 at 20:34, on Zulip):

Yes that’d be cool

nikomatsakis (Mar 19 2019 at 20:34, on Zulip):

do you have a suggestion there?

nikomatsakis (Mar 19 2019 at 20:34, on Zulip):

like, is there a specific place you would think is good to start?

scalexm (Mar 19 2019 at 20:34, on Zulip):

I tried to start something like that for Unsize in my fixup PR

scalexm (Mar 19 2019 at 20:34, on Zulip):

I think adding more built-in impls is a good start yes

nikomatsakis (Mar 19 2019 at 20:37, on Zulip):

I was thinking on the call that the current hack around ?T: Sized is .. in some ways probably not so bad

scalexm (Mar 19 2019 at 20:37, on Zulip):

We might want to merge that fixup PR btw as I separated some code into multiple modules, I thought it was cleaner at the time I wrote it

nikomatsakis (Mar 19 2019 at 20:37, on Zulip):

we should maybe just try to keep it in mind to make sure we're not violating some core assumption somewhere -- but I think with the current engine it mostly works out ok

nikomatsakis (Mar 19 2019 at 20:37, on Zulip):

but of course we would prefer to reorder our clauses to avoid trying to solve that goal

nikomatsakis (Mar 19 2019 at 20:37, on Zulip):

ok, I just thought of a potential complication :P

nikomatsakis (Mar 19 2019 at 20:38, on Zulip):

but I think we should be able to work something like that into the engine

nikomatsakis (Mar 19 2019 at 20:38, on Zulip):

We might want to merge that fixup PR btw as I separated some code into multiple modules, I thought it was cleaner at the time I wrote it

ah ok I was planning to spend a bit of time on the questions you raised, but we could also merge the PR first

nikomatsakis (Mar 19 2019 at 20:38, on Zulip):

and worry about the refactorings later

scalexm (Mar 19 2019 at 20:39, on Zulip):

I meant, spend some time on said questions then merge the PR :p

scalexm (Mar 19 2019 at 20:40, on Zulip):

But I believe there was only one question for that PR: how to refactor the unification code to avoid the scopes/variance swap hack

nikomatsakis (Mar 19 2019 at 20:42, on Zulip):

right

nikomatsakis (Mar 19 2019 at 20:43, on Zulip):

that was the main one I wanted to look at

nikomatsakis (Mar 19 2019 at 20:43, on Zulip):

maybe..right now?

scalexm (Mar 19 2019 at 20:44, on Zulip):

I’m going to sleep soon, but if you have some ideas you can write them down somewhere and I’ll have a look tomorrow

scalexm (Mar 19 2019 at 20:47, on Zulip):

Also @nikomatsakis I remember I left a comment in a commit in the fixup PR: https://github.com/rust-lang/rust/commit/0b60e9dbfb9d379857b433b87f896b84d115b2bc

scalexm (Mar 19 2019 at 20:48, on Zulip):

See the « FIXME » for unsizing to dyn Trait

scalexm (Mar 19 2019 at 20:48, on Zulip):

I was wondering if there was a way to correctly handle the higher-ranked binders in a general way

scalexm (Mar 19 2019 at 20:50, on Zulip):

e.g., if you have a rule like this one:

forall<‘a, T> { Implemented(T: Unsize<dyn Trait<‘a>>) :- Implemented(T: Trait<‘a>) }
scalexm (Mar 19 2019 at 20:50, on Zulip):

Then I think it won’t handle the case when you want to prove Unsize<for<‘b> dyn Trait<‘b>>

scalexm (Mar 19 2019 at 20:54, on Zulip):

Or maybe that may work because we would instantiate a placeholder region !'b, and the type dyn Trait<'!b> would then correctly unify with dyn Trait<?’a> in the above rule

scalexm (Mar 19 2019 at 21:04, on Zulip):

@nikomatsakis I have the whole evening free tomorrow, we could discuss the PR and other things if needed

nikomatsakis (Mar 19 2019 at 21:12, on Zulip):

ok, we'll see, my day is fairly booked somehow :) I will at least try to give some feedback early on

Aaron Turon (Mar 19 2019 at 22:11, on Zulip):

@nikomatsakis plausibly i could sync up with @scalexm tomorrow and get more pointers to get started?

nikomatsakis (Mar 19 2019 at 22:16, on Zulip):

@Aaron Turon I was going to suggest the same thing

nikomatsakis (Mar 19 2019 at 22:16, on Zulip):

Video posted

Aaron Turon (Mar 19 2019 at 22:26, on Zulip):

@scalexm i'll try to be around early west coast time to catch you here!

Aaron Turon (Mar 19 2019 at 22:32, on Zulip):

@tmandry lemme know how involved you'd like to be on this initial effort!

tmandry (Mar 20 2019 at 01:38, on Zulip):

@Aaron Turon hmm, @nikomatsakis mentioned something about adding builtin impls to the system, maybe we can each do some of those to get (re-)oriented in the code? (or maybe they're so trivial it doesn't make sense)

tmandry (Mar 20 2019 at 01:40, on Zulip):

beyond that I'd like to help with some tasks, but probably won't be working on this full-time or anything right now

scalexm (Mar 20 2019 at 15:45, on Zulip):

(deleted)

Aaron Turon (Mar 20 2019 at 18:48, on Zulip):

@tmandry that sounds like a great idea to me!

Aaron Turon (Mar 20 2019 at 18:48, on Zulip):

even if they are "trivial" i think it's useful as a chance for both of us to dig into the code

tmandry (Mar 20 2019 at 18:50, on Zulip):

ok, great :) I guess whoever gets to it first can pick a few types to add..?

tmandry (Mar 20 2019 at 18:50, on Zulip):

is there a list of builtin impls somewhere?

Aaron Turon (Mar 20 2019 at 18:51, on Zulip):

there was a "TODO" list in the code @nikomatsakis was pointing at, lemme see if i can find it

Aaron Turon (Mar 20 2019 at 18:51, on Zulip):

and we can divvy :)

Aaron Turon (Mar 20 2019 at 18:53, on Zulip):

@tmandry https://github.com/rust-lang/rust/blob/master/src/librustc_traits/chalk_context/program_clauses.rs#L400

Aaron Turon (Mar 20 2019 at 18:55, on Zulip):

@scalexm so, given the overview that @nikomatsakis provided us yesterday, i think it actually makes the most sense for @tmandry and i to just try to dive in and ask questions here as we go, if that works ok for you?

Aaron Turon (Mar 20 2019 at 18:55, on Zulip):

@tmandry you wanna start with Copy/Clone, and i'll take Sized, and we can go from there?

Aaron Turon (Mar 20 2019 at 18:55, on Zulip):

i don't think these are trivial since each of these "built ins" involves some custom logic

Aaron Turon (Mar 20 2019 at 18:55, on Zulip):

which we'll have to crib from the old trait system

scalexm (Mar 20 2019 at 18:56, on Zulip):

@Aaron Turon yes that’s ok!

tmandry (Mar 20 2019 at 18:57, on Zulip):

@Aaron Turon sounds good!

Last update: Nov 18 2019 at 00:45UTC