Skip to content

Commit 00e1a69

Browse files
ftxqxdalexcrichton
authored andcommitted
Clarify Any docs
The `Any` docs previously did not state that only `'static` types implement it.
1 parent 42d538e commit 00e1a69

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/libcore/any.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! Traits for dynamic typing of any type (through runtime reflection)
11+
//! Traits for dynamic typing of any `'static` type (through runtime reflection)
1212
//!
1313
//! This module implements the `Any` trait, which enables dynamic typing
14-
//! of any type, through runtime reflection.
14+
//! of any `'static` type through runtime reflection.
1515
//!
1616
//! `Any` itself can be used to get a `TypeId`, and has more features when used as a trait object.
1717
//! As `&Any` (a borrowed trait object), it has the `is` and `as_ref` methods, to test if the
@@ -32,8 +32,10 @@ pub enum Void { }
3232
// Any trait
3333
///////////////////////////////////////////////////////////////////////////////
3434

35-
/// The `Any` trait is implemented by all types, and can be used as a trait object
36-
/// for dynamic typing
35+
/// The `Any` trait is implemented by all `'static` types, and can be used for dynamic typing
36+
///
37+
/// Every type with no non-`'static` references implements `Any`, so `Any` can be used as a trait
38+
/// object to emulate the effects dynamic typing.
3739
pub trait Any {
3840
/// Get the `TypeId` of `self`
3941
fn get_type_id(&self) -> TypeId;

0 commit comments

Comments
 (0)