-
Notifications
You must be signed in to change notification settings - Fork 0
Maybe initialized liveness #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Maybe initialized liveness #12
Conversation
I'd rather wait until we see the PR for rust-lang#45889 first, I think. It'd be nice if we could get get this test passing. =) |
07c6dbb
to
95d95e6
Compare
47 | let wrap = Wrap { p: &mut x }; | ||
| ------ borrow of `x` occurs here | ||
... | ||
52 | x += 1; // OK, drops are inert |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still need to look into why this is an error.
ef2d660
to
c93dd18
Compare
95d95e6
to
305a883
Compare
Incidentally, although I prefer ui tests in general, I think this test might be better written as a compile-fail test, at least until such time as we have the ability to add |
c93dd18
to
74e1192
Compare
This has a lot of conflicts due to me having merged: #14 |
OK, per recent conversation on gitter, we need to:
|
0a0256d
to
99ed9e2
Compare
self.add_drop_live_constraint(initialized_child_ty, location); | ||
} | ||
|
||
if any { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if this was still necessary or not. Also, the test is still not working as expected. For one, it's still in /ui. I thought I had moved it to /compile-fail, but I might have lost that work when rebasing.
So, the problem is that In the case of the example, we have the local variable
The statement In any case, for our purposes, if we see that That said, I tried to tweak the routine in [this diff]((https://gist.github.com/nikomatsakis/a19d21a651a6e56b25ad03111666765a), but it doesn't seem quite right. It makes the test case in question pass, but it also suppresses a lot of other errors we should be reporting. The diff only adds a node to the final result if it has no child -- that is, it is a leaf node in the tree. But the name is perhaps a bit misleadling, and should maybe be called |
Oh, I see the problem with my check. The problem is that we only create move paths for the things that are individually touched, but in this case |
I have to run in a bit, but I have (maybe) a quick question. We're hitting an obstacle in this PR. We have a struct with two fields,
whereas:
It seems to me that, to find the set of maybe-init lvalues that start from (I thought we could just look at the leaves, which handles the second example, but not the first one.) |
There's no subroutine for that in |
I suppose we could also leave this as a fixme for now -- we can handle the simple case of |
It wouldn't be too hard to add such a function, but I agree that a FIXME would be ok at first. |
sure, just seems like it ought to be a PR of its own |
ok, really going afk now =) |
b3f3390
to
55e195b
Compare
f2cf20d
to
b4ed07f
Compare
let mdpe = MoveDataParamEnv { | ||
move_data: move_data, | ||
param_env: param_env, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh damn, I applied rustfmt accidentally. Let me separate that into its own commit at least.
In particular, if we see a variable is DROP-LIVE, but it is not MAYBE-INIT, then we can ignore the drop. This leavess attempt to use more complex refinements of the idea (e.g., for subpaths or subfields) to future work.
b4ed07f
to
0a7b7dd
Compare
sync with rust-lang/rust branch master
Original PR conversation is here: rust-lang#45794.