Skip to content

Commit

Permalink
Rollup merge of rust-lang#82862 - athre0z:generalize-vec-write-impl, …
Browse files Browse the repository at this point in the history
…r=TimDiekmann

Generalize Write impl for Vec<u8> to Vec<u8, A>

As discussed in the [issue tracker for the wg-allocators working group][1], updating this impl for allocator support was most likely just forgotten previously. This PR fixes this.

r? ``@TimDiekmann``

[1]: rust-lang/wg-allocators#86
  • Loading branch information
Dylan-DPC authored Mar 8, 2021
2 parents 4a44436 + ab8995b commit 68456f7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion library/std/src/io/impls.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#[cfg(test)]
mod tests;

use crate::alloc::Allocator;
use crate::cmp;
use crate::fmt;
use crate::io::{
Expand Down Expand Up @@ -357,7 +358,7 @@ impl Write for &mut [u8] {
/// Write is implemented for `Vec<u8>` by appending to the vector.
/// The vector will grow as needed.
#[stable(feature = "rust1", since = "1.0.0")]
impl Write for Vec<u8> {
impl<A: Allocator> Write for Vec<u8, A> {
#[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
self.extend_from_slice(buf);
Expand Down

0 comments on commit 68456f7

Please sign in to comment.