@Keith Yeung do you think you'll have a chance to check out https://github.com/rust-lang/rust/issues/50463 ?
I was indeed looking at it yesterday
The fix I envisioned in there doesn't actually work
ok, I've not looked at all
Oh, it just hit me
The problem is likely because we treat the first assignment as initialization
huh, so we treat mutable fn args as uninitialized at the beginning?
we have a "simple case" (no pattern) and a more complex case (pattern)
mut probably gets treated like the latter?
sometimes there are things like
(a, b): (Foo, Bar)
in which case we have the actual argument, which has type
and we then destructure it into locals for
so i've switched from checking
EverInitializedPlaces in the mutability lint analysis, and the test cases all seem to pass
here's a complimentary PR to go with it: https://github.com/rust-lang/rust/pull/50697
ok :) I don't remember well enough to say if that makes sense but I can sort of imagine why it would
@pnkfelix you said that we'd need another unit test for testing out the changes in the
WriteKind::MutableBorrow(BorrowKind::Unique) branch, what kind of code generates this MIR statement?
BorrowKind::Unique arises from certain kinds of free variables in closures
I'll try to set aside time to make an example later today
@pnkfelix looks like someone is depending on the fix, do you know how to create a test case that you mentioned?
if you're too busy, i can just remove that change altogether
Hi @Keith Yeung sorry it took me so long to get back around to this. I posted a comment (some might say a shortish essay) on the PR, here
Oh I missed your followup comment where you suggested removing the change. That is actually what I ended up coming around to by the end of writing that comment on the PR. So yes, removing that part of the change is probably best at this point.
I basically added that line because I recall from a previous conversation on a GH issue that you mentioned that we were supposed to have this check there
@pnkfelix ok, i removed that part of the change, can either you or @nikomatsakis approve it? https://github.com/rust-lang/rust/pull/50697
@pnkfelix i forgot to add a
break statement in the previous PR, and i have a new one adding it: https://github.com/rust-lang/rust/pull/50958