diff options
| author | bors <bors@rust-lang.org> | 2023-04-22 09:54:21 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-04-22 09:54:21 +0000 |
| commit | f30fc0a5e2e1d2e816c264354c45a6d7da576107 (patch) | |
| tree | cd0c0bbf5ab6206228d026c3823200c775426ec3 /tests/rustdoc-js-std/parser-errors.js | |
| parent | 86d8f1268ae0fbc07ca42233a0eac4668e2af724 (diff) | |
| parent | cb3e0fbb5999429f4f4c30e505c4904c9999cdf8 (diff) | |
| download | rust-f30fc0a5e2e1d2e816c264354c45a6d7da576107.tar.gz rust-f30fc0a5e2e1d2e816c264354c45a6d7da576107.zip | |
Auto merge of #104844 - cjgillot:mention-eval-place, r=jackh726,RalfJung
Evaluate place expression in `PlaceMention`
https://github.com/rust-lang/rust/pull/102256 introduces a `PlaceMention(place)` MIR statement which keep trace of `let _ = place` statements from surface rust, but without semantics.
This PR proposes to change the behaviour of `let _ =` patterns with respect to the borrow-checker to verify that the bound place is live.
Specifically, consider this code:
```rust
let _ = {
let a = 5;
&a
};
```
This passes borrowck without error on stable. Meanwhile, replacing `_` by `_: _` or `_p` errors with "error[E0597]: `a` does not live long enough", [see playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=c448d25a7c205dc95a0967fe96bccce8).
This PR *does not* change how `_` patterns behave with respect to initializedness: it remains ok to bind a moved-from place to `_`.
The relevant test is `tests/ui/borrowck/let_underscore_temporary.rs`. Crater check found no regression.
For consistency, this PR changes miri to evaluate the place found in `PlaceMention`, and report eventual dangling pointers found within it.
r? `@RalfJung`
Diffstat (limited to 'tests/rustdoc-js-std/parser-errors.js')
0 files changed, 0 insertions, 0 deletions
