rust/src/test
Yuki Okushi 43babed7e2
Rollup merge of #74960 - nbdd0121:typeck, r=nikomatsakis
Fix regionck failure when converting Index to IndexMut

Fixes #74933

Consider an overloaded index expression `base[index]`. Without knowing whether it will be mutated, this will initially be desugared into `<U as Index<T>>::index(&base, index)` for some `U` and `T`. Let `V` be the `expr_ty_adjusted` of `index`.

If this expression ends up being used in any mutable context (or used in a function call with `&mut self` receiver before #72280), we will need to fix it up. The current code will rewrite it to `<U as IndexMut<V>>::index_mut(&mut base, index)`. In most cases this is fine as `V` will be equal to `T`, however this is not always true when `V/T` are references, as they may have different region.

This issue is quite subtle before #72280 as this code path is only used to fixup function receivers, but after #72280 we've made this a common path.

The solution is basically just rewrite it to `<U as IndexMut<T>>::index_mut(&mut base, index)`. `T` can retrieved in the fixup path using `node_substs`.
2020-08-12 12:07:08 +09:00
..
assembly compiletest: Support ignoring tests requiring missing LLVM components 2020-08-02 20:35:24 +03:00
auxiliary
codegen move Deaggregate pass to post_borrowck_cleanup 2020-08-11 17:09:15 +02:00
codegen-units instance: only polymorphize upvar substs 2020-08-09 14:53:33 +01:00
compile-fail rustc_metadata: Make crate loading fully speculative 2020-07-18 14:06:04 +04:00
debuginfo Rollup merge of #75224 - Aaron1011:fix/function-arguments-naked, r=Amanieu 2020-08-08 11:36:02 +09:00
incremental Share serialization optimization between incr and metadata 2020-07-26 18:37:03 -04:00
mir-opt move Deaggregate pass to post_borrowck_cleanup 2020-08-11 17:09:15 +02:00
pretty tests: add regression test for #74745 2020-08-02 15:33:06 +01:00
run-make proc_macro: Add API for tracked access to environment variables 2020-07-26 13:37:37 +03:00
run-make-fulldeps intra_doc_resolution_failures -> broken_intra_doc_links 2020-07-30 10:38:55 -07:00
run-pass-valgrind
rustdoc Auto merge of #74936 - GuillaumeGomez:const-rustc_const_unstable, r=jyn514 2020-08-10 17:12:42 +00:00
rustdoc-js rustdoc: Fix doc aliases with crate filtering 2020-06-23 09:27:37 +01:00
rustdoc-js-std
rustdoc-ui Auto merge of #75127 - jyn514:impl-trait, r=pnkfelix 2020-08-10 19:33:25 +00:00
rustfix
ui Rollup merge of #74960 - nbdd0121:typeck, r=nikomatsakis 2020-08-12 12:07:08 +09:00
ui-fulldeps Eliminate the SessionGlobals from librustc_ast. 2020-08-08 12:03:42 +10:00
COMPILER_TESTS.md