diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-07-16 22:30:54 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-16 22:30:54 +0200 |
| commit | ddc32d1633b796a3fdbe09724407fa814fa8ed56 (patch) | |
| tree | 06c773ed64c09e48c7a00227f5a0a282259aad26 | |
| parent | 4805c215c8e1df5073898436ae6941b409d54c7c (diff) | |
| parent | aeb949753e80ca741df89612e446a77d1c16e3ab (diff) | |
| download | rust-ddc32d1633b796a3fdbe09724407fa814fa8ed56.tar.gz rust-ddc32d1633b796a3fdbe09724407fa814fa8ed56.zip | |
Rollup merge of #99317 - yanchith:borrow-vec-ta-as-slice-t, r=Mark-Simulacrum
Borrow Vec<T, A> as [T] Hello all, When `Vec` was parametrized with `A`, the `Borrow` impls were omitted and currently `Vec<T, A>` can't be borrowed as `[T]`. This PR fixes that. This was probably missed, because the `Borrow` impls are in a different file - `src/alloc/slice.rs`. We briefly discussed this here: https://github.com/rust-lang/wg-allocators/issues/96 and I was told to go ahead and make a PR :) I tested this by building the toolchain and building my code that needed the `Borrow` impl against it, but let me know if I should add any tests to this PR.
| -rw-r--r-- | library/alloc/src/slice.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/library/alloc/src/slice.rs b/library/alloc/src/slice.rs index 4a9cecd9b4e..63d4d945290 100644 --- a/library/alloc/src/slice.rs +++ b/library/alloc/src/slice.rs @@ -836,14 +836,14 @@ impl<T: Clone, V: Borrow<[T]>> Join<&[T]> for [V] { //////////////////////////////////////////////////////////////////////////////// #[stable(feature = "rust1", since = "1.0.0")] -impl<T> Borrow<[T]> for Vec<T> { +impl<T, A: Allocator> Borrow<[T]> for Vec<T, A> { fn borrow(&self) -> &[T] { &self[..] } } #[stable(feature = "rust1", since = "1.0.0")] -impl<T> BorrowMut<[T]> for Vec<T> { +impl<T, A: Allocator> BorrowMut<[T]> for Vec<T, A> { fn borrow_mut(&mut self) -> &mut [T] { &mut self[..] } |
