diff --git a/library/alloc/src/boxed.rs b/library/alloc/src/boxed.rs index f56e3af4ff2..d814c525ceb 100644 --- a/library/alloc/src/boxed.rs +++ b/library/alloc/src/boxed.rs @@ -327,7 +327,10 @@ impl Box { /// `x` will be pinned in memory and unable to be moved. #[unstable(feature = "allocator_api", issue = "32838")] #[inline(always)] - pub fn pin_in(x: T, alloc: A) -> Pin { + pub fn pin_in(x: T, alloc: A) -> Pin + where + A: 'static, + { Self::new_in(x, alloc).into() } @@ -802,7 +805,10 @@ impl Box { /// /// This is also available via [`From`]. #[unstable(feature = "box_into_pin", issue = "62370")] - pub fn into_pin(boxed: Self) -> Pin { + pub fn into_pin(boxed: Self) -> Pin + where + A: 'static, + { // It's not possible to move or replace the insides of a `Pin>` // when `T: !Unpin`, so it's safe to pin it directly without any // additional requirements. @@ -1010,7 +1016,10 @@ impl From for Box { } #[stable(feature = "pin", since = "1.33.0")] -impl From> for Pin> { +impl From> for Pin> +where + A: 'static, +{ /// Converts a `Box` into a `Pin>` /// /// This conversion does not allocate on the heap and happens in place. @@ -1413,10 +1422,13 @@ impl AsMut for Box { * could have a method to project a Pin from it. */ #[stable(feature = "pin", since = "1.33.0")] -impl Unpin for Box {} +impl Unpin for Box where A: 'static {} #[unstable(feature = "generator_trait", issue = "43122")] -impl + Unpin, R, A: AllocRef> Generator for Box { +impl + Unpin, R, A: AllocRef> Generator for Box +where + A: 'static, +{ type Yield = G::Yield; type Return = G::Return; @@ -1426,7 +1438,10 @@ impl + Unpin, R, A: AllocRef> Generator for Box, R, A: AllocRef> Generator for Pin> { +impl, R, A: AllocRef> Generator for Pin> +where + A: 'static, +{ type Yield = G::Yield; type Return = G::Return; @@ -1436,7 +1451,10 @@ impl, R, A: AllocRef> Generator for Pin> { } #[stable(feature = "futures_api", since = "1.36.0")] -impl Future for Box { +impl Future for Box +where + A: 'static, +{ type Output = F::Output; fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll {