rust/tests
Matthias Krüger 21e7463bf8
Rollup merge of #112019 - jieyouxu:issue-111554, r=compiler-errors
Don't suggest changing `&self` and `&mut self` in function signature to be mutable when taking `&mut self` in closure

Current suggestion for when taking a mutable reference to `self` in a closure (as an upvar) will produce a machine-applicable suggestion to change the `self` in the function signature to `mut self`, but does not account for the specialness of implicit self in that it can already have `&` and `&mut` (see #111554). This causes the function signature to become `test(&mut mut self)` which does not seem desirable.

```
error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable
   --> src/sound_player.rs:870:11
    |
869 |     pub fn test(&mut self) {
    |                      ---- help: consider changing this to be mutable: `mut self`
870 |     || test2(&mut self);
    |              ^^^^^^^^^ cannot borrow as mutable
```

This PR suppresses the "changing this to be mutable" suggestion if the implicit self is either `ImplicitSelfKind::ImmRef` or `ImplicitSelfKind::MutRef`.

Fixes #111554.
2023-06-06 12:00:33 +02:00
..
assembly Fix linkage for large binaries on mips64 platforms ... 2023-05-29 10:57:03 -06:00
auxiliary
codegen Use load-store instead of memcpy for short integer arrays 2023-06-04 00:51:49 -07:00
codegen-units
debuginfo Add multiple borrow test. 2023-05-13 10:32:32 +00:00
incremental Implement custom diagnostic for ConstParamTy 2023-06-01 18:21:42 +00:00
mir-opt Auto merge of #112240 - cjgillot:recurse-inline, r=scottmcm 2023-06-04 03:39:24 +00:00
pretty
run-make Verify that (almost) all ret instructions have been replaced 2023-06-05 17:33:26 +02:00
run-make-fulldeps Move BodyWithBorrowckFacts to consumers 2023-05-23 14:36:36 +02:00
run-pass-valgrind
rustdoc Auto merge of #110945 - wackbyte:doc-vis-on-inherent-assoc-types, r=jsha 2023-06-05 04:54:21 +00:00
rustdoc-gui Migrate GUI colors test to original CSS color format 2023-06-04 15:55:30 +02:00
rustdoc-js Rollup merge of #110780 - notriddle:notriddle/slice-index, r=GuillaumeGomez 2023-05-06 09:09:31 +09:00
rustdoc-js-std
rustdoc-json Serialize all enums as externally tagged to guarantee compatibility with binary formats such as bincode or postcard 2023-05-22 18:22:08 +01:00
rustdoc-ui rustdoc: get unnormalized link destination for suggestions 2023-05-26 18:38:46 -07:00
ui Rollup merge of #112019 - jieyouxu:issue-111554, r=compiler-errors 2023-06-06 12:00:33 +02:00
ui-fulldeps Use translatable diagnostics in rustc_const_eval 2023-06-01 14:45:18 +00:00
COMPILER_TESTS.md