Stream: t-compiler/wg-nll

Topic: weekly meeting 2019.01.30


pnkfelix (Jan 30 2019 at 20:20, on Zulip):

Hey @WG-compiler-nll , NLL triage meeting will start here in about 10 minutes

pnkfelix (Jan 30 2019 at 20:20, on Zulip):

I'm very late attempting some pre-meeting triage for the day. but lets see what I can do

pnkfelix (Jan 30 2019 at 20:22, on Zulip):

first, uncategorized issues that need tags

pnkfelix (Jan 30 2019 at 20:22, on Zulip):

"Unexpected borrow checker ICE" #57989 -- I just added P-high to that

pnkfelix (Jan 30 2019 at 20:24, on Zulip):

I cannot tell from a quick skim whether the code in question should compile successfully or be rejected. luckily @Matthew Jasper already has posted a PR with a test that has the answer: The code should be rejected

pnkfelix (Jan 30 2019 at 20:24, on Zulip):

so this is an NLL-sound issue, I guess.

pnkfelix (Jan 30 2019 at 20:24, on Zulip):

(added tag accordingly)

pnkfelix (Jan 30 2019 at 20:25, on Zulip):

next: "DerefMut borrow method call is too long with Deref arguments" #57376

pnkfelix (Jan 30 2019 at 20:25, on Zulip):

this is hypothesized to be a two-phase borrow (2PB) issue

pnkfelix (Jan 30 2019 at 20:26, on Zulip):

not a regression vs AST-borrowck, in any case

pnkfelix (Jan 30 2019 at 20:27, on Zulip):

I guess 2PB issues are mostly NLL-complete ones

pnkfelix (Jan 30 2019 at 20:27, on Zulip):

(apart perhaps for ones related to the unsafe-code-guidelines effort, where we are attempting to define a suitably restrictive model for programmers to adhere to...)

pnkfelix (Jan 30 2019 at 20:28, on Zulip):

the user seems to expect that the code should compile. So I'll tag this as NLL-complete

pnkfelix (Jan 30 2019 at 20:28, on Zulip):

next, unpriroritized issues

pnkfelix (Jan 30 2019 at 20:29, on Zulip):

oh my

pnkfelix (Jan 30 2019 at 20:30, on Zulip):

there's 25 open issues in that list that have no P-label

nikomatsakis (Jan 30 2019 at 20:30, on Zulip):

I guess 2PB issues are mostly NLL-complete ones

I feel like we categorize this class of thing as wont-fix, at least not with current definition of 2PB

pnkfelix (Jan 30 2019 at 20:31, on Zulip):

I guess 2PB issues are mostly NLL-complete ones

I feel like we categorize this class of thing as wont-fix, at least not with current definition of 2PB

I'm okay with that.

pnkfelix (Jan 30 2019 at 20:31, on Zulip):

the meeting is supposed to start now anyway

davidtwco (Jan 30 2019 at 20:31, on Zulip):

:wave:

pnkfelix (Jan 30 2019 at 20:32, on Zulip):

there are zero NLL issues currently tagged P-high ( or NLL-priority) that lack an assignee

pnkfelix (Jan 30 2019 at 20:32, on Zulip):

and no nominated issues

pnkfelix (Jan 30 2019 at 20:32, on Zulip):

So, we have options for ways to use this time.

Matthew Jasper (Jan 30 2019 at 20:33, on Zulip):

Discuss #57202 or #57609 ?

nikomatsakis (Jan 30 2019 at 20:35, on Zulip):

Actually

nikomatsakis (Jan 30 2019 at 20:35, on Zulip):

I'm game to discuss #57609, but I want to bring up one other thing

nikomatsakis (Jan 30 2019 at 20:35, on Zulip):

Not sure how many of us will be at the All Hands..? At the moment, we didn't allocate any dedicated time for NLL discussion

pnkfelix (Jan 30 2019 at 20:35, on Zulip):

Maybe thumbs up this comment if you'll be there

nikomatsakis (Jan 30 2019 at 20:36, on Zulip):

I don't know that we really have time for that, but it would be nice perhaps to dig into the 2PB and/or match stuff there..? Depends who is able to come

nikomatsakis (Jan 30 2019 at 20:36, on Zulip):

One other thing that's been on my mind is if we want to do some kind of "postmortem" on the NLL process

nikomatsakis (Jan 30 2019 at 20:36, on Zulip):

(not necessarily at the all hands)

nikomatsakis (Jan 30 2019 at 20:36, on Zulip):

i.e., what went well, what could have been done better, etc

pnkfelix (Jan 30 2019 at 20:36, on Zulip):

Certainly seems like it would be foolish to not allocate some NLL time for ourselves.

nikomatsakis (Jan 30 2019 at 20:37, on Zulip):

I think it was one of the first times we've really tried to do a big development initiative this way

nikomatsakis (Jan 30 2019 at 20:37, on Zulip):

yeah, there just .. aren't really any free slots available unless we cut some compiler stuff or squeeze it in

pnkfelix (Jan 30 2019 at 20:37, on Zulip):

well

nikomatsakis (Jan 30 2019 at 20:37, on Zulip):

or we extend the final day, which is presntly a half day

pnkfelix (Jan 30 2019 at 20:38, on Zulip):

I have a flight on the final day

nikomatsakis (Jan 30 2019 at 20:38, on Zulip):

(we could also do that informally, but it might be nice to talk this stuff over before the final day)

pnkfelix (Jan 30 2019 at 20:38, on Zulip):

I'd have to check the timing but it seems non-ideal to do it on last day

Santiago Pastorino (Jan 30 2019 at 20:38, on Zulip):

I have a flight on the final day

I also won't be there on last day

nikomatsakis (Jan 30 2019 at 20:38, on Zulip):

well wait

nikomatsakis (Jan 30 2019 at 20:38, on Zulip):

there is this one hour

nikomatsakis (Jan 30 2019 at 20:38, on Zulip):

currently marked Free Time

nikomatsakis (Jan 30 2019 at 20:38, on Zulip):

ah, I am supposed to be part of something then

nikomatsakis (Jan 30 2019 at 20:38, on Zulip):

er, wait, I'm not

nikomatsakis (Jan 30 2019 at 20:39, on Zulip):

so we could do it then

pnkfelix (Jan 30 2019 at 20:39, on Zulip):

is there any slot that you are not supposed to be a part of, niko ?

nikomatsakis (Jan 30 2019 at 20:39, on Zulip):

not many

pnkfelix (Jan 30 2019 at 20:39, on Zulip):

(okay so Free Time is one)

nikomatsakis (Jan 30 2019 at 20:39, on Zulip):

Free Time would give us 1 hr -- I'd prefer 2

nikomatsakis (Jan 30 2019 at 20:39, on Zulip):

but maybe 1 suffices

nikomatsakis (Jan 30 2019 at 20:39, on Zulip):

do we want to try a live post mortem?

pnkfelix (Jan 30 2019 at 20:39, on Zulip):

can you point us at schedule?

nikomatsakis (Jan 30 2019 at 20:39, on Zulip):

yeah, sorry

nikomatsakis (Jan 30 2019 at 20:39, on Zulip):

there is a google spreadsheet here

pnkfelix (Jan 30 2019 at 20:39, on Zulip):

I can try to prepare a post-mortem

pnkfelix (Jan 30 2019 at 20:40, on Zulip):

i really should do so anyway

davidtwco (Jan 30 2019 at 20:40, on Zulip):

(perhaps best for a separate topic but are there other discussions happening outside of the slots with those not in any of the teams that have things scheduled at that time?)

nikomatsakis (Jan 30 2019 at 20:40, on Zulip):

@davidtwco I don't really understand the question

pnkfelix (Jan 30 2019 at 20:40, on Zulip):

@davidtwco sorry that was a lot to parse

nikomatsakis (Jan 30 2019 at 20:41, on Zulip):

are you asking, if you don't have a meeting at time X, is there something for you to do?

nikomatsakis (Jan 30 2019 at 20:41, on Zulip):

if so, the answer is that there is some communal space I believe

nikomatsakis (Jan 30 2019 at 20:41, on Zulip):

well, why don't we take over the free time

pnkfelix (Jan 30 2019 at 20:41, on Zulip):

the column labelled "Comm space" I imagine

davidtwco (Jan 30 2019 at 20:43, on Zulip):

Yeah, that’s what I was trying to ask. There are times where there’s nothing I’m really involved in and was wondering if other discussions would be happening in those times just not in the main meeting rooms.

pnkfelix (Jan 30 2019 at 20:43, on Zulip):

@nikomatsakis am I right in inferring that you are taken during the Governance WG slot?

nikomatsakis (Jan 30 2019 at 20:44, on Zulip):

Yes, I had expected to participate in that

nikomatsakis (Jan 30 2019 at 20:44, on Zulip):

I think 1hr might suffice for a targeted meeting discussing the action plan on these changes..?

nikomatsakis (Jan 30 2019 at 20:45, on Zulip):

I don't think it suffices for a longer "retrospective"

pnkfelix (Jan 30 2019 at 20:45, on Zulip):

maybe try to get a head start during lunch, for people apart from niko

nikomatsakis (Jan 30 2019 at 20:45, on Zulip):

well

pnkfelix (Jan 30 2019 at 20:45, on Zulip):

(i.e. I imagine niko's attention will have many demands)

nikomatsakis (Jan 30 2019 at 20:45, on Zulip):

sure, we could try to do that

pnkfelix (Jan 30 2019 at 20:45, on Zulip):

but the rest of us might be able to at least talk things over ahead of time

nikomatsakis (Jan 30 2019 at 20:46, on Zulip):

do we want to try and talk over the PRs now? (or should we defer it till then?)

lqd (Jan 30 2019 at 20:47, on Zulip):

(oops were we supposed to go to Berlin All-Hands ?)

pnkfelix (Jan 30 2019 at 20:47, on Zulip):

we can either talk over the PR's, or do collective triage

nikomatsakis (Jan 30 2019 at 20:47, on Zulip):

I would like to review the latest comment by @Matthew Jasper on https://github.com/rust-lang/rust/pull/57609, which I didn't get a chance to look at

pnkfelix (Jan 30 2019 at 20:47, on Zulip):

I think discussing these PR's seems good

nikomatsakis (Jan 30 2019 at 20:47, on Zulip):

(oops were we supposed to go to Berlin All-Hands ?)

not necessarily :)

nikomatsakis (Jan 30 2019 at 20:47, on Zulip):

but a lot of us will be there so it's a decent time to talk

nikomatsakis (Jan 30 2019 at 20:48, on Zulip):

(at least on some issues)

pnkfelix (Jan 30 2019 at 20:48, on Zulip):

can you get to Berlin easily, @lqd ?

pnkfelix (Jan 30 2019 at 20:48, on Zulip):

(I imagine its not trivial)

lqd (Jan 30 2019 at 20:48, on Zulip):

not trivial indeed :)

nikomatsakis (Jan 30 2019 at 20:49, on Zulip):

I think discussing these PR's seems good

Can we start with #57609?

nikomatsakis (Jan 30 2019 at 20:49, on Zulip):

How should we proceed

pnkfelix (Jan 30 2019 at 20:50, on Zulip):

did you want to ask @Matthew Jasper questions?

nikomatsakis (Jan 30 2019 at 20:50, on Zulip):

there is a fair amount of background information, I did my best to summarize my understanding of what the PR did in this comment, though @Matthew Jasper has some corrections

nikomatsakis (Jan 30 2019 at 20:50, on Zulip):

I did have a specific question

lqd (Jan 30 2019 at 20:50, on Zulip):

@pnkfelix yeah I should have maybe asked earlier I thought it was only for the teams, so unfortunately it seems unlikely — even though I of wish I could :/

nikomatsakis (Jan 30 2019 at 20:53, on Zulip):

so @Matthew Jasper one thing, you wrote this:

No, there's no read here at the moment (you link to a fake read at (***)).

But (a) I'm not really sure on the distinction between a "fake read" and a "read" and (b) I think that point *** is the same point that I highlighted? (start of stage 5?)

nikomatsakis (Jan 30 2019 at 20:53, on Zulip):

ah but maybe you're saying that, if there is a guard, then there is no read there at all

Matthew Jasper (Jan 30 2019 at 20:54, on Zulip):

yes, there's one fake read per pattern. In the case where there's a guard, it's before the guard (and the bindings for the guard)

nikomatsakis (Jan 30 2019 at 20:54, on Zulip):

in which case my question becomes... "why not"? =)

I guess maybe because there is a read from the case where guard is false?

Matthew Jasper (Jan 30 2019 at 20:55, on Zulip):

Because the current match lowering code makes it difficult.

Matthew Jasper (Jan 30 2019 at 20:56, on Zulip):

I'm currently looking at how we can simplify it so that we can have the fake borrows just be live during the guard.

nikomatsakis (Jan 30 2019 at 20:57, on Zulip):

OK. My next question would be, where you wrote this:

As well as the above I think you're asking why () exists, because that borrow is never live across user code. The reason is to (somewhat hackily) prevent a fake borrow from being live along a () -> [ Exit match ] -> (loop) -> [Pre-match] -> () path.

if we only made the "fake borrows" (and fake reads) after creating the guard bindings, I think then that this would maybe suffice?

e.g.,

[ 1. Pre-match ]
       |
[ 2. Discriminant testing -- check discriminants ] <-+
       |                                             |
       | (once a specific arm is chosen)             |
       |                                             |
[ 3. Create "guard bindings" for arm ]               |
[ (create fake borrows) ]                            |
       |                                             |
[ 4. Execute guard code ] --(guard is false)---------+
       |
       | (guard results in true)
       |
[ (read fake borrows) ]
[ 5. Create real bindings and execute arm ]
       |
[ Exit match ]
nikomatsakis (Jan 30 2019 at 20:57, on Zulip):

the idea being that the fake borrows are specifically live only across the guard code execution

nikomatsakis (Jan 30 2019 at 20:57, on Zulip):

(which is where the user injects stuff)

nikomatsakis (Jan 30 2019 at 20:57, on Zulip):

I'm currently looking at how we can simplify it so that we can have the fake borrows just be live during the guard.

is what I wrote above what you meant by this?

Matthew Jasper (Jan 30 2019 at 20:58, on Zulip):

Yes, I think that that would be what we should go for (whatever we decide on for 2PB and what fake borrows require)

nikomatsakis (Jan 30 2019 at 20:58, on Zulip):

I also agree that seems elegant

nikomatsakis (Jan 30 2019 at 20:58, on Zulip):

So, if we do this, then we remove some of the the 2PB interaction, because the fake borrows are now created after the &mut for the guard binding

Matthew Jasper (Jan 30 2019 at 20:59, on Zulip):

Yes.

Matthew Jasper (Jan 30 2019 at 20:59, on Zulip):

At least, the part of 2PB that we are currently unsure about

nikomatsakis (Jan 30 2019 at 21:01, on Zulip):

:+1:

nikomatsakis (Jan 30 2019 at 21:01, on Zulip):

ok, well, I feel pretty satisfied with that final diagram

nikomatsakis (Jan 30 2019 at 21:01, on Zulip):

@pnkfelix are you following along? (or others?)

Santiago Pastorino (Jan 30 2019 at 21:02, on Zulip):

I'm more or less following, there's a bunch of things there that I don't know yet :)

Santiago Pastorino (Jan 30 2019 at 21:02, on Zulip):

but trying to understand :)

pnkfelix (Jan 30 2019 at 21:03, on Zulip):

So what Q’s does this leave regarding 2PB? There’s still stacked-borrows stuff, right?

pnkfelix (Jan 30 2019 at 21:03, on Zulip):

/me is trying to follow along but it is nontrivial due to home issues

nikomatsakis (Jan 30 2019 at 21:03, on Zulip):

@pnkfelix if we do this, it basically "clears the way" for us to make it an error to have a pre-existing loan when you create the (two-phase) &mut loan

Santiago Pastorino (Jan 30 2019 at 21:03, on Zulip):

this has some kind of relation to an unsoundness issues that showed up related to borrows in arm conditionals?

nikomatsakis (Jan 30 2019 at 21:04, on Zulip):

The connection to 2PB is sort of indirect. Basically, we were taking advantage of the very pattern that we planned to disallow as part of our match desugaring

Matthew Jasper (Jan 30 2019 at 21:04, on Zulip):

@pnkfelix if we do this, it basically "clears the way" for us to make it an error to have a pre-existing loan when you create the (two-phase) &mut loan

(or future-compat warning)

pnkfelix (Jan 30 2019 at 21:04, on Zulip):

Ah right

pnkfelix (Jan 30 2019 at 21:04, on Zulip):

Okay well I’m on board then

nikomatsakis (Jan 30 2019 at 21:04, on Zulip):

this has some kind of relation to an unsoundness issues that showed up related to borrows in arm conditionals?

right, the goal of these "fake borrows" is basically to limit the user from making mutations in the guard code that affect things that are being matched (rephrased for clarity)

nikomatsakis (Jan 30 2019 at 21:07, on Zulip):

OK, @Matthew Jasper, seems like we have general consensus on this direction =) sorry for being slow.

Regarding your other PR https://github.com/rust-lang/rust/pull/57202, I personally haven't done my homework to catch up on the latest. Sorry, been busy with all-hands planning and other things. But let me put it on my calendar to do Friday -- and I may do it right now after this meeting

Matthew Jasper (Jan 30 2019 at 21:07, on Zulip):

For example, we want to disallow this (without the current buggy HIR mutation check)

match *y {
    true => (),
    false if {
        y = &true;
        false
    } => (),
    false => (),
}
Santiago Pastorino (Jan 30 2019 at 21:08, on Zulip):

makes sense

Matthew Jasper (Jan 30 2019 at 21:08, on Zulip):

I think the current PR has the best approach (it's been updated to the "obvious" solution). But the alternative is still there.

nikomatsakis (Jan 30 2019 at 21:08, on Zulip):

OK

Matthew Jasper (Jan 30 2019 at 21:09, on Zulip):

Is that it for now then?

nikomatsakis (Jan 30 2019 at 21:10, on Zulip):

Seems like it

nikomatsakis (Jan 30 2019 at 21:10, on Zulip):

(PS, nice job @Matthew Jasper tackling the match stuff. Feels like a good solution.)

Matthew Jasper (Jan 30 2019 at 21:10, on Zulip):

Yes, now I've got to implement it.

pnkfelix (Jan 30 2019 at 21:16, on Zulip):

@Matthew Jasper Is the description for #57609 updated to reflect the plan-of-record and/or what's currently implemented in the commit series?

pnkfelix (Jan 30 2019 at 21:17, on Zulip):

i just like to have the description reflect reality, as it serves as the message bors ends up using on the merge commit

nikomatsakis (Jan 30 2019 at 21:21, on Zulip):

(Also, I would strongly recommend we include the flow-chart diagram somewhere in the code -- I at least find it really helpful)

Last update: Nov 21 2019 at 13:25UTC