rust/compiler/rustc_mir/src/borrow_check
Dylan DPC b2e254318d
Rollup merge of #82917 - cuviper:iter-zip, r=m-ou-se
Add function core::iter::zip

This makes it a little easier to `zip` iterators:

```rust
for (x, y) in zip(xs, ys) {}
// vs.
for (x, y) in xs.into_iter().zip(ys) {}
```

You can `zip(&mut xs, &ys)` for the conventional `iter_mut()` and
`iter()`, respectively. This can also support arbitrary nesting, where
it's easier to see the item layout than with arbitrary `zip` chains:

```rust
for ((x, y), z) in zip(zip(xs, ys), zs) {}
for (x, (y, z)) in zip(xs, zip(ys, zs)) {}
// vs.
for ((x, y), z) in xs.into_iter().zip(ys).zip(xz) {}
for (x, (y, z)) in xs.into_iter().zip((ys.into_iter().zip(xz)) {}
```

It may also format more nicely, especially when the first iterator is a
longer chain of methods -- for example:

```rust
    iter::zip(
        trait_ref.substs.types().skip(1),
        impl_trait_ref.substs.types().skip(1),
    )
    // vs.
    trait_ref
        .substs
        .types()
        .skip(1)
        .zip(impl_trait_ref.substs.types().skip(1))
```

This replaces the tuple-pair `IntoIterator` in #78204.
There is prior art for the utility of this in [`itertools::zip`].

[`itertools::zip`]: https://docs.rs/itertools/0.10.0/itertools/fn.zip.html
2021-03-27 20:37:07 +01:00
..
constraints mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
diagnostics Rollup merge of #82917 - cuviper:iter-zip, r=m-ou-se 2021-03-27 20:37:07 +01:00
region_infer Use tracing instrumentation for better bug diagnosing 2021-03-15 16:53:05 +00:00
type_check Use iter::zip in compiler/ 2021-03-26 09:32:31 -07:00
borrow_set.rs Use Option::map_or instead of .map(..).unwrap_or(..) 2021-01-14 19:23:59 +01:00
constraint_generation.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
def_use.rs Remove unused PlaceContext::NonUse(NonUseContext::Coverage) 2020-09-09 17:02:19 +02:00
facts.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
invalidation.rs Use iter::zip in compiler/ 2021-03-26 09:32:31 -07:00
location.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
member_constraints.rs fix typo in docs and comments 2020-09-21 12:14:28 +09:00
mod.rs Use iter::zip in compiler/ 2021-03-26 09:32:31 -07:00
nll.rs Fix incorrect use mut diagnostics 2021-01-29 15:37:44 -05:00
path_utils.rs Fix incorrect use mut diagnostics 2021-01-29 15:37:44 -05:00
place_ext.rs Change ty.kind to a method 2020-09-04 17:47:51 +02:00
places_conflict.rs Use iter::zip in compiler/ 2021-03-26 09:32:31 -07:00
prefixes.rs PlaceRef::ty: use method call syntax 2021-01-16 11:38:14 +01:00
renumber.rs Rename NLL* to Nll* accordingly to C-CASE 2021-01-28 16:18:25 +09:00
universal_regions.rs Use iter::zip in compiler/ 2021-03-26 09:32:31 -07:00
used_muts.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00