Skip to content

Commit 0cf60b6

Browse files
committed
Bound Any with 'static
This bound is already implicit through the AnyPrivate trait, but since it is not explicit, you still have to write Box<Any + 'static>, even though Any can only be 'static. Introducing the 'static bound here makes this bound explicit, making Box<Any> legal.
1 parent 88d1a22 commit 0cf60b6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/libcore/any.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ pub enum Void { }
9191
/// Every type with no non-`'static` references implements `Any`, so `Any` can
9292
/// be used as a trait object to emulate the effects dynamic typing.
9393
#[stable]
94-
pub trait Any: AnyPrivate {}
94+
pub trait Any: AnyPrivate + 'static {}
9595

9696
/// An inner trait to ensure that only this module can call `get_type_id()`.
9797
pub trait AnyPrivate {
@@ -132,7 +132,7 @@ pub trait AnyRefExt<'a> {
132132
}
133133

134134
#[stable]
135-
impl<'a> AnyRefExt<'a> for &'a Any+'a {
135+
impl<'a> AnyRefExt<'a> for &'a Any {
136136
#[inline]
137137
#[stable]
138138
fn is<T: 'static>(self) -> bool {
@@ -181,7 +181,7 @@ pub trait AnyMutRefExt<'a> {
181181
}
182182

183183
#[stable]
184-
impl<'a> AnyMutRefExt<'a> for &'a mut Any+'a {
184+
impl<'a> AnyMutRefExt<'a> for &'a mut Any {
185185
#[inline]
186186
#[unstable = "naming conventions around acquiring references may change"]
187187
fn downcast_mut<T: 'static>(self) -> Option<&'a mut T> {

0 commit comments

Comments
 (0)