Skip to content

Commit 0d0c330

Browse files
djkoloskiDavid Koloski
authored and
David Koloski
committed
Relax A: 'static bound for boxed Pin APIs
1 parent 502d6aa commit 0d0c330

File tree

1 file changed

+7
-23
lines changed

1 file changed

+7
-23
lines changed

library/alloc/src/boxed.rs

+7-23
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ impl<T, A: Allocator> Box<T, A> {
543543
#[inline(always)]
544544
pub const fn pin_in(x: T, alloc: A) -> Pin<Self>
545545
where
546-
A: 'static + ~const Allocator + ~const Drop,
546+
A: ~const Allocator + ~const Drop,
547547
{
548548
Self::into_pin(Self::new_in(x, alloc))
549549
}
@@ -1158,10 +1158,7 @@ impl<T: ?Sized, A: Allocator> Box<T, A> {
11581158
/// This is also available via [`From`].
11591159
#[unstable(feature = "box_into_pin", issue = "62370")]
11601160
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
1161-
pub const fn into_pin(boxed: Self) -> Pin<Self>
1162-
where
1163-
A: 'static,
1164-
{
1161+
pub const fn into_pin(boxed: Self) -> Pin<Self> {
11651162
// It's not possible to move or replace the insides of a `Pin<Box<T>>`
11661163
// when `T: !Unpin`, so it's safe to pin it directly without any
11671164
// additional requirements.
@@ -1382,10 +1379,7 @@ impl<T> From<T> for Box<T> {
13821379

13831380
#[stable(feature = "pin", since = "1.33.0")]
13841381
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
1385-
impl<T: ?Sized, A: Allocator> const From<Box<T, A>> for Pin<Box<T, A>>
1386-
where
1387-
A: 'static,
1388-
{
1382+
impl<T: ?Sized, A: Allocator> const From<Box<T, A>> for Pin<Box<T, A>> {
13891383
/// Converts a `Box<T>` into a `Pin<Box<T>>`
13901384
///
13911385
/// This conversion does not allocate on the heap and happens in place.
@@ -1951,14 +1945,10 @@ impl<T: ?Sized, A: Allocator> AsMut<T> for Box<T, A> {
19511945
* could have a method to project a Pin<T> from it.
19521946
*/
19531947
#[stable(feature = "pin", since = "1.33.0")]
1954-
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
1955-
impl<T: ?Sized, A: Allocator> const Unpin for Box<T, A> where A: 'static {}
1948+
impl<T: ?Sized, A: Allocator> const Unpin for Box<T, A> {}
19561949

19571950
#[unstable(feature = "generator_trait", issue = "43122")]
1958-
impl<G: ?Sized + Generator<R> + Unpin, R, A: Allocator> Generator<R> for Box<G, A>
1959-
where
1960-
A: 'static,
1961-
{
1951+
impl<G: ?Sized + Generator<R> + Unpin, R, A: Allocator> Generator<R> for Box<G, A> {
19621952
type Yield = G::Yield;
19631953
type Return = G::Return;
19641954

@@ -1968,10 +1958,7 @@ where
19681958
}
19691959

19701960
#[unstable(feature = "generator_trait", issue = "43122")]
1971-
impl<G: ?Sized + Generator<R>, R, A: Allocator> Generator<R> for Pin<Box<G, A>>
1972-
where
1973-
A: 'static,
1974-
{
1961+
impl<G: ?Sized + Generator<R>, R, A: Allocator> Generator<R> for Pin<Box<G, A>> {
19751962
type Yield = G::Yield;
19761963
type Return = G::Return;
19771964

@@ -1981,10 +1968,7 @@ where
19811968
}
19821969

19831970
#[stable(feature = "futures_api", since = "1.36.0")]
1984-
impl<F: ?Sized + Future + Unpin, A: Allocator> Future for Box<F, A>
1985-
where
1986-
A: 'static,
1987-
{
1971+
impl<F: ?Sized + Future + Unpin, A: Allocator> Future for Box<F, A> {
19881972
type Output = F::Output;
19891973

19901974
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {

0 commit comments

Comments
 (0)