From 7b8c4091e155e308d023d15519a441bd7b34deee Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 30 Aug 2024 15:00:30 -0700 Subject: [PATCH] Import alloc types at top of unique_ptr module --- src/unique_ptr.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/unique_ptr.rs b/src/unique_ptr.rs index e316d9d79..b56dbe885 100644 --- a/src/unique_ptr.rs +++ b/src/unique_ptr.rs @@ -3,6 +3,10 @@ use crate::fmt::display; use crate::kind::Trivial; use crate::string::CxxString; use crate::ExternType; +#[cfg(feature = "std")] +use alloc::string::String; +#[cfg(feature = "std")] +use alloc::vec::Vec; use core::ffi::c_void; use core::fmt::{self, Debug, Display}; use core::marker::PhantomData; @@ -198,12 +202,12 @@ where } #[inline] - fn read_to_end(&mut self, buf: &mut alloc::vec::Vec) -> io::Result { + fn read_to_end(&mut self, buf: &mut Vec) -> io::Result { self.pin_mut().read_to_end(buf) } #[inline] - fn read_to_string(&mut self, buf: &mut alloc::string::String) -> io::Result { + fn read_to_string(&mut self, buf: &mut String) -> io::Result { self.pin_mut().read_to_string(buf) }