rust/tests
Matthias Krüger 6c898d2b03
Rollup merge of #129101 - compiler-errors:deref-on-parent-by-ref, r=lcnr
Fix projections when parent capture is by-ref but child capture is by-value in the `ByMoveBody` pass

This fixes a somewhat strange bug where we build the incorrect MIR in #129074. This one is weird, but I don't expect it to actually matter in practice since it almost certainly results in a move error in borrowck. However, let's not ICE.

Given the code:

```
#![feature(async_closure)]

// NOT copy.
struct Ty;

fn hello(x: &Ty) {
    let c = async || {
        *x;
        //~^ ERROR cannot move out of `*x` which is behind a shared reference
    };
}

fn main() {}
```

The parent coroutine-closure captures `x: &Ty` by-ref, resulting in an upvar of `&&Ty`. The child coroutine captures `x` by-value, resulting in an upvar of `&Ty`. When constructing the by-move body for the coroutine-closure, we weren't applying an additional deref projection to convert the parent capture into the child capture, resulting in an type error in assignment, which is a validation ICE.

As I said above, this only occurs (AFAICT) in code that eventually results in an error, because it is only triggered by HIR that attempts to move a non-copy value out of a ref. This doesn't occur if `Ty` is `Copy`, since we'd instead capture `x` by-ref in the child coroutine.

Fixes #129074
2024-08-15 19:32:37 +02:00
..
assembly Rollup merge of #127905 - BKPepe:powerpc-muslspe, r=wesleywiser 2024-08-15 00:02:24 +02:00
auxiliary
codegen Rollup merge of #128348 - dingxiangfei2009:allow-shadow-call-stack-sanitizer, r=tmandry 2024-08-15 19:32:35 +02:00
codegen-units Fix and enable disabled codegen-units tests 2024-08-10 14:03:27 -04:00
coverage Finish blessing coverage/mcdc tests after LLVM 19 upgrade 2024-08-01 13:36:50 +10:00
coverage-run-rustdoc
crashes Auto merge of #128714 - camelid:wf-struct-exprs, r=BoxyUwU 2024-08-10 05:27:17 +00:00
debuginfo Use the enum2$ Natvis visualiser for repr128 C-style enums 2024-08-13 19:53:21 +01:00
incremental Do not normalize constants eagerly. 2024-07-31 00:59:12 +00:00
mir-opt Use the right type when coercing fn items to pointers 2024-08-13 16:23:20 -04:00
pretty
run-make Auto merge of #128936 - bjorn3:fix_thin_archive_reading, r=jieyouxu 2024-08-15 14:13:52 +00:00
run-pass-valgrind
rustdoc Rollup merge of #128394 - GuillaumeGomez:run-button, r=t-rustdoc 2024-08-12 17:09:15 +02:00
rustdoc-gui Rollup merge of #128394 - GuillaumeGomez:run-button, r=t-rustdoc 2024-08-12 17:09:15 +02:00
rustdoc-js Add test for Self not being a generic in search index 2024-08-04 12:49:28 -07:00
rustdoc-js-std
rustdoc-json Rollup merge of #128836 - its-the-shrimp:add_test_for_107278, r=aDotInTheVoid 2024-08-09 00:03:38 +02:00
rustdoc-ui Auto merge of #129060 - matthiaskrgr:rollup-s72gpif, r=matthiaskrgr 2024-08-14 06:43:26 +00:00
ui Rollup merge of #129101 - compiler-errors:deref-on-parent-by-ref, r=lcnr 2024-08-15 19:32:37 +02:00
ui-fulldeps Bless test fallout 2024-08-03 07:57:31 -04:00
COMPILER_TESTS.md