diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-07-23 19:10:12 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-07-26 13:12:20 -0700 |
| commit | e5da6a71a6a0b46dd3630fc8326e6d5906a1fde6 (patch) | |
| tree | 9ec196a49577039b0800125f2cef1f8afa925ece /src/libcore/tuple | |
| parent | 7aa407958b8ab2aec16b0182f0103ad92380b5dc (diff) | |
| download | rust-e5da6a71a6a0b46dd3630fc8326e6d5906a1fde6.tar.gz rust-e5da6a71a6a0b46dd3630fc8326e6d5906a1fde6.zip | |
std: Stabilize unit, bool, ty, tuple, arc, any
This commit applies stability attributes to the contents of these modules,
summarized here:
* The `unit` and `bool` modules have become #[unstable] as they are purely meant
for documentation purposes and are candidates for removal.
* The `ty` module has been deprecated, and the inner `Unsafe` type has been
renamed to `UnsafeCell` and moved to the `cell` module. The `marker1` field
has been removed as the compiler now always infers `UnsafeCell` to be
invariant. The `new` method i stable, but the `value` field, `get` and
`unwrap` methods are all unstable.
* The `tuple` module has its name as stable, the naming of the `TupleN` traits
as stable while the methods are all #[unstable]. The other impls in the module
have appropriate stability for the corresponding trait.
* The `arc` module has received the exact same treatment as the `rc` module
previously did.
* The `any` module has its name as stable. The `Any` trait is also stable, with
a new private supertrait which now contains the `get_type_id` method. This is
to make the method a private implementation detail rather than a public-facing
detail.
The two extension traits in the module are marked #[unstable] as they will not
be necessary with DST. The `is` method is #[stable], the as_{mut,ref} methods
have been renamed to downcast_{mut,ref} and are #[unstable].
The extension trait `BoxAny` has been clarified as to why it is unstable as it
will not be necessary with DST.
This is a breaking change because the `marker1` field was removed from the
`UnsafeCell` type. To deal with this change, you can simply delete the field and
only specify the value of the `data` field in static initializers.
[breaking-change]
Diffstat (limited to 'src/libcore/tuple')
| -rw-r--r-- | src/libcore/tuple/mod.rs | 25 | ||||
| -rw-r--r-- | src/libcore/tuple/unit.rs | 2 |
2 files changed, 23 insertions, 4 deletions
diff --git a/src/libcore/tuple/mod.rs b/src/libcore/tuple/mod.rs index 4f34c64de1b..ead35647180 100644 --- a/src/libcore/tuple/mod.rs +++ b/src/libcore/tuple/mod.rs @@ -60,7 +60,10 @@ //! ``` #![doc(primitive = "tuple")] +#![stable] +#[unstable = "this is just a documentation module and should not be part \ + of the public api"] pub use unit; use clone::Clone; @@ -79,41 +82,51 @@ macro_rules! tuple_impls { )+) => { $( #[allow(missing_doc)] + #[stable] pub trait $Tuple<$($T),+> { - $(fn $valN(self) -> $T;)+ - $(fn $refN<'a>(&'a self) -> &'a $T;)+ - $(fn $mutN<'a>(&'a mut self) -> &'a mut $T;)+ + $( + #[unstable = "may rename pending accessor naming conventions"] + fn $valN(self) -> $T; + #[unstable = "may rename pending accessor naming conventions"] + fn $refN<'a>(&'a self) -> &'a $T; + #[unstable = "may rename pending accessor naming conventions"] + fn $mutN<'a>(&'a mut self) -> &'a mut $T; + )+ } impl<$($T),+> $Tuple<$($T),+> for ($($T,)+) { $( #[inline] #[allow(unused_variable)] + #[unstable = "may rename pending accessor naming conventions"] fn $valN(self) -> $T { let ($($x,)+) = self; $ret } #[inline] #[allow(unused_variable)] + #[unstable = "may rename pending accessor naming conventions"] fn $refN<'a>(&'a self) -> &'a $T { let ($(ref $x,)+) = *self; $ret } #[inline] #[allow(unused_variable)] + #[unstable = "may rename pending accessor naming conventions"] fn $mutN<'a>(&'a mut self) -> &'a mut $T { let ($(ref mut $x,)+) = *self; $ret } )+ } - #[unstable] + #[unstable = "waiting for Clone to stabilize"] impl<$($T:Clone),+> Clone for ($($T,)+) { fn clone(&self) -> ($($T,)+) { ($(self.$refN().clone(),)+) } } + #[unstable = "waiting for PartialEq to stabilize"] impl<$($T:PartialEq),+> PartialEq for ($($T,)+) { #[inline] fn eq(&self, other: &($($T,)+)) -> bool { @@ -125,8 +138,10 @@ macro_rules! tuple_impls { } } + #[unstable = "waiting for Eq to stabilize"] impl<$($T:Eq),+> Eq for ($($T,)+) {} + #[unstable = "waiting for PartialOrd to stabilize"] impl<$($T:PartialOrd + PartialEq),+> PartialOrd for ($($T,)+) { #[inline] fn partial_cmp(&self, other: &($($T,)+)) -> Option<Ordering> { @@ -150,6 +165,7 @@ macro_rules! tuple_impls { } } + #[unstable = "waiting for Ord to stabilize"] impl<$($T:Ord),+> Ord for ($($T,)+) { #[inline] fn cmp(&self, other: &($($T,)+)) -> Ordering { @@ -157,6 +173,7 @@ macro_rules! tuple_impls { } } + #[stable] impl<$($T:Default),+> Default for ($($T,)+) { #[inline] fn default() -> ($($T,)+) { diff --git a/src/libcore/tuple/unit.rs b/src/libcore/tuple/unit.rs index a60b3d098d3..7f89f0e5ae3 100644 --- a/src/libcore/tuple/unit.rs +++ b/src/libcore/tuple/unit.rs @@ -9,6 +9,8 @@ // except according to those terms. #![doc(primitive = "unit")] +#![unstable = "this module is purely for documentation and it will likely be \ + removed from the public api"] //! The `()` type, sometimes called "unit" or "nil". //! |
