-
Notifications
You must be signed in to change notification settings - Fork 380
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
Borrow checker (move analysis) #2810
Conversation
1725dd3
to
5534ade
Compare
b9edd14
to
1474182
Compare
638d722
to
61c13f4
Compare
src/main/kotlin/org/rust/ide/inspections/fixes/DeriveCopyFix.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/org/rust/ide/inspections/fixes/DeriveCopyFix.kt
Outdated
Show resolved
Hide resolved
val mutCat = lpKind.mutCategory | ||
|
||
// Moving/assigning one union field automatically moves/assigns all its fields | ||
union.namedFields |
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.
This fragment isn't covered by tests
} | ||
|
||
pathAssignments.forEach { assignment -> | ||
killMoves(assignment.path, assignment.element, Execution, dfcxMoves) |
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.
This fragment isn't covered by tests
fields.mapNotNull { it.expr }.forEach { consumeExpr(it) } | ||
if (withExpr == null) return | ||
|
||
val withCmt = mc.processExpr(withExpr) |
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.
This fragment isn't covered by tests
val lpElement = extend.lpElement | ||
|
||
if (lpElement is Interior.Field) { | ||
if (baseLoanPath.ty.isAdtWithDestructor) { |
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.
This fragment isn't covered by tests
is Interior.Index -> cmt | ||
|
||
is Downcast -> { | ||
val base = category.cmt |
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.
This fragment isn't covered by tests
And maybe we can write more tests? And if so, we can move these tests to a separate file |
220a00d
to
b7006be
Compare
fee8a2c
to
ed5611a
Compare
fdc117e
to
d0942fc
Compare
de12ed7
to
a40061e
Compare
a40061e
to
cda38a2
Compare
I think we can merge it. Objections? No? Ok, let's go! |
🤔 Looks like bors is crashed |
bors r- |
Let's try again |
2810: Borrow checker (move analysis) r=vlad20012 a=ortem - Introduce `DataFlowContext` providing `GEN` and `KILL` sets and propagation; - Introduce initial part of borrow checker providing move analysis; - Add `Use of moved value` and `Cannot move` error messages to `RsBorrowCheckerInspection`; - Add `DeriveCopyFix` for such errors. ![derivecopyfix2](https://user-images.githubusercontent.com/4854600/44843336-bf33bc00-ac50-11e8-9a5a-fac2193113f6.gif) Co-authored-by: ortem <ortem00@gmail.com>
DataFlowContext
providingGEN
andKILL
sets and propagation;Use of moved value
andCannot move
error messages toRsBorrowCheckerInspection
;DeriveCopyFix
for such errors.