rust/compiler/rustc_mir_build
bors 5b270e1198 Auto merge of #126813 - compiler-errors:SliceLike, r=lcnr
Add `SliceLike` to `rustc_type_ir`, use it in the generic solver code (+ some other changes)

First, we split out `TraitRef::new_from_args` which takes *just* `ty::GenericArgsRef` from `TraitRef::new` which takes `impl IntoIterator<Item: Into<GenericArg>>`. I will explain in a minute why.

Second, we introduce `SliceLike`, which allows us to be generic over `List<T>` and `[T]`. This trait has an `as_slice()` and `into_iter()` method, and some other convenience functions. However, importantly, since types like `I::GenericArgs` now implement `SliceLike` rather than `IntoIter<Item = I::GenericArg>`, we can't use `TraitRef::new` on this directly. That's where `new_from_args` comes in.

Finally, we adjust all the code to use these slice operators. Some things get simpler, some things get a bit more annoying since we need to use `as_slice()` in a few places. 🤷

r? lcnr
2024-06-25 00:33:49 +00:00
..
src Auto merge of #126813 - compiler-errors:SliceLike, r=lcnr 2024-06-25 00:33:49 +00:00
Cargo.toml Remove some unused crate dependencies. 2024-06-10 19:55:49 +10:00
messages.ftl Fix remaining cases 2024-06-21 19:00:18 -04:00