Skip to content

Commit

Permalink
Auto merge of #107844 - Zeegomo:no-drop-and-rep, r=cjgillot
Browse files Browse the repository at this point in the history
Desugaring of drop and replace at MIR build

This commit desugars the drop and replace deriving from an
assignment at MIR build, avoiding the construction of the
`DropAndReplace` terminator (which will be removed in a following PR).

In order to retain the same error messages for replaces a new
`DesugaringKind::Replace` variant is introduced.

The changes in the borrowck are also useful for future work in moving drop elaboration
before borrowck, as no `DropAndReplace` would be present there anymore.

Notes on test diffs:
*  `tests/ui/borrowck/issue-58776-borrowck-scans-children`: the assignment deriving from the desugaring kills the borrow.
*  `tests/ui/async-await/async-fn-size-uninit-locals.rs`, `tests/mir-opt/issue_41110.test.ElaborateDrops.after.mir`,  `tests/mir-opt/issue_41888.main.ElaborateDrops.after.mir`:  drop elaboration generates (or reads from) a useless drop flag due to an issue with the dataflow analysis. Will be fixed independently by rust-lang/rust#106430.

See rust-lang/rust#104488 for more context
  • Loading branch information
bors committed Mar 5, 2023
2 parents 0f190de + 3a38500 commit 7814392
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit 7814392

Please sign in to comment.