]> git.lizzy.rs Git - rust.git/commit - src/tools/miri
Auto merge of #76306 - tmiasko:nrvo-debuginfo, r=ecstatic-morse
authorbors <bors@rust-lang.org>
Sun, 13 Sep 2020 00:33:04 +0000 (00:33 +0000)
committerbors <bors@rust-lang.org>
Sun, 13 Sep 2020 00:33:04 +0000 (00:33 +0000)
commit498dab02562a67d503fc1cf0eca0968f44cfecfa
treeaa15f594372621dff452e4d0950ce11cc4a0ebeb
parentdbb73f8f79ab176a897d5a95e696adb71b957cbe
parent01510612ee20d14a3397427891a4042a34d53956
Auto merge of #76306 - tmiasko:nrvo-debuginfo, r=ecstatic-morse

NRVO: Allow occurrences of the return place in var debug info

The non-use occurrence of the return place in var debug info does not
currently inhibit NRVO optimization, but it will fail assertion in
`visit_place` when optimization is performed.

Relax assertion check to allow the return place in var debug info.

This case might be impossible to hit in optimization pipelines as of
now, but can be encountered in customized mir-opt-level=2 pipeline with
copy propagation disabled. For example in:

```rust
pub fn b(s: String) -> String {
    a(s)
}

#[inline]
pub fn a(s: String) -> String {
    let x = s;
    let y = x;
    y
}
```