rust/tests
bors 6cd6bad51f Auto merge of #101692 - cjgillot:generator-lazy-witness, r=oli-obk
Compute generator saved locals on MIR

Generators are currently type-checked by introducing a `witness` type variable, which is unified with a `GeneratorWitness(captured types)` whose purpose is to ensure that the auto traits correctly migrate from the captured types to the `witness` type.  This requires computing the captured types on HIR during type-checking, only to re-do it on MIR later.

This PR proposes to drop the HIR-based computation, and only keep the MIR one.  This is done in 3 steps.
1. During type-checking, the `witness` type variable is never unified.  This allows to stall all the obligations that depend on it until the end of type-checking.  Then, the stalled obligations are marked as successful, and saved into the typeck results for later verification.
2. At type-checking writeback, `witness` is replaced by `GeneratorWitnessMIR(def_id, substs)`.  From this point on, all trait selection involving `GeneratorWitnessMIR` will fetch the MIR-computed locals, similar to what opaque types do.  There is no lifetime to be preserved here: we consider all the lifetimes appearing in this witness type to be higher-ranked.
3. After borrowck, the stashed obligations are verified against the actually computed types, in the `check_generator_obligations` query.  If any obligation was wrongly marked as fulfilled in step 1, it should be reported here.

There are still many issues:
- ~I am not too happy having to filter out some locals from the checked bounds, I think this is MIR building that introduces raw pointers polluting the analysis;~ solved by a check specific to static variables.
- the diagnostics for captured types don't show where they are used/dropped;
- I do not attempt to support chalk.

cc `@eholk` `@jyn514` for the drop-tracking work
r? `@oli-obk` as you warned me of potential unsoundness
2023-01-28 01:05:29 +00:00
..
assembly bump failing assembly & codegen tests from LLVM 14 to LLVM 15 2023-01-17 20:02:01 +01:00
auxiliary
codegen abi: add AddressSpace field to Primitive::Pointer 2023-01-22 23:41:39 -05:00
codegen-units
debuginfo
incremental
mir-opt Bless mir-opt tests. 2023-01-27 22:01:47 +00:00
pretty Bless pretty tests. 2023-01-12 00:25:46 +01:00
run-make Make output_filenames a real query 2023-01-23 10:35:21 +00:00
run-make-fulldeps Rollup merge of #106904 - khuey:preserve_debuginfo_for_rlibs, r=davidtwco 2023-01-26 15:02:19 +01:00
run-pass-valgrind
rustdoc Add regression test for #107350 2023-01-27 12:11:01 +01:00
rustdoc-gui Rollup merge of #107336 - notriddle:notriddle/import-item-module-item, r=GuillaumeGomez 2023-01-27 12:57:57 +09:00
rustdoc-js rustdoc: update search test cases 2023-01-14 12:04:12 -07:00
rustdoc-js-std rustdoc: update search test cases 2023-01-14 12:04:12 -07:00
rustdoc-json
rustdoc-ui Add drop_tracking_mir option. 2023-01-27 18:57:34 +00:00
ui Restrict amount of ignored locals. 2023-01-27 22:01:12 +00:00
ui-fulldeps Bless ui-fulldeps. 2023-01-27 20:10:25 +00:00
COMPILER_TESTS.md