Navigation Menu

Skip to content

Commit

Permalink
Bound Any with 'static
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
reem committed Oct 1, 2014
1 parent 88d1a22 commit 0cf60b6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/libcore/any.rs
Expand Up @@ -91,7 +91,7 @@ pub enum Void { }
/// Every type with no non-`'static` references implements `Any`, so `Any` can
/// be used as a trait object to emulate the effects dynamic typing.
#[stable]
pub trait Any: AnyPrivate {}
pub trait Any: AnyPrivate + 'static {}

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

#[stable]
impl<'a> AnyRefExt<'a> for &'a Any+'a {
impl<'a> AnyRefExt<'a> for &'a Any {
#[inline]
#[stable]
fn is<T: 'static>(self) -> bool {
Expand Down Expand Up @@ -181,7 +181,7 @@ pub trait AnyMutRefExt<'a> {
}

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

5 comments on commit 0cf60b6

@bors
Copy link
Contributor

@bors bors commented on 0cf60b6 Oct 1, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from alexcrichton
at reem@0cf60b6

@bors
Copy link
Contributor

@bors bors commented on 0cf60b6 Oct 1, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging reem/rust/any-static-bound = 0cf60b6 into auto

@bors
Copy link
Contributor

@bors bors commented on 0cf60b6 Oct 1, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reem/rust/any-static-bound = 0cf60b6 merged ok, testing candidate = fe93a54

@bors
Copy link
Contributor

@bors bors commented on 0cf60b6 Oct 1, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 0cf60b6 Oct 1, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = fe93a54

Please sign in to comment.