rust/compiler/rustc_borrowck/src
Esteban Küber 03c88aaf21 Tweak .clone() suggestion to work in more cases
When going through auto-deref, the `<T as Clone>` impl sometimes needs
to be specified for rustc to actually clone the value and not the
reference.

```
error[E0507]: cannot move out of dereference of `S`
  --> $DIR/needs-clone-through-deref.rs:15:18
   |
LL |         for _ in self.clone().into_iter() {}
   |                  ^^^^^^^^^^^^ ----------- value moved due to this method call
   |                  |
   |                  move occurs because value has type `Vec<usize>`, which does not implement the `Copy` trait
   |
note: `into_iter` takes ownership of the receiver `self`, which moves value
  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
help: you can `clone` the value and consume it, but this might not be your desired behavior
   |
LL |         for _ in <Vec<usize> as Clone>::clone(&self.clone()).into_iter() {}
   |                  ++++++++++++++++++++++++++++++            +
```

CC #109429.
2023-12-04 21:54:32 +00:00
..
constraints Replace no_ord_impl with orderable. 2023-11-22 18:38:17 +11:00
diagnostics Tweak .clone() suggestion to work in more cases 2023-12-04 21:54:32 +00:00
polonius move remaining legacy polonius fact generation out of NLL module 2023-11-26 13:03:32 +00:00
region_infer move and maintain live loans in LivenessValues 2023-12-01 14:04:54 +00:00
type_check Auto merge of #118470 - nnethercote:cleanup-error-handlers, r=compiler-errors 2023-12-02 02:48:34 +00:00
util Move some utils out of rustc_const_eval 2023-04-16 12:05:54 +02:00
borrow_set.rs Fix clippy::needless_borrow in the compiler 2023-11-21 20:13:40 +01:00
borrowck_errors.rs Use targetted diagnostic for borrow across yield error 2023-10-27 13:05:49 +00:00
consumers.rs Fix redundant explicit link in rustc_borrowck 2023-08-19 02:22:13 +08:00
dataflow.rs improve NLL/polonius scope equality assertion 2023-12-01 14:04:54 +00:00
def_use.rs rename BorrowKind::Shallow to Fake 2023-11-08 22:55:28 +01:00
facts.rs introduce Polonius enum for -Zpolonius 2023-10-04 16:16:12 +00:00
lib.rs Auto merge of #118470 - nnethercote:cleanup-error-handlers, r=compiler-errors 2023-12-02 02:48:34 +00:00
location.rs Replace no_ord_impl with orderable. 2023-11-22 18:38:17 +11:00
member_constraints.rs remove unused muts 2023-04-28 20:19:48 +02:00
nll.rs Auto merge of #118470 - nnethercote:cleanup-error-handlers, r=compiler-errors 2023-12-02 02:48:34 +00:00
path_utils.rs Remove Upvar duplication 2023-11-26 13:19:10 -05:00
place_ext.rs use PlaceRef abstractions more consistently 2023-06-25 20:38:01 -04:00
places_conflict.rs rename BorrowKind::Shallow to Fake 2023-11-08 22:55:28 +01:00
prefixes.rs Add docs, remove code, change subtyper code 2023-10-02 23:39:44 +03:00
renumber.rs add fixme to RegionCtxt 2023-11-13 14:13:54 +00:00
session_diagnostics.rs s/generator/coroutine/ 2023-10-20 21:14:01 +00:00
universal_regions.rs Rollup merge of #118302 - mu001999:dead_code/clean, r=cjgillot 2023-11-26 15:44:54 +01:00
used_muts.rs Fix clippy::needless_borrow in the compiler 2023-11-21 20:13:40 +01:00