From ba91518a6dbc460e095fe673340ebc477fa9d596 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Fri, 28 Jun 2013 14:33:58 -0700 Subject: [PATCH 1/2] Rename #[non_sendable] to #[no_send] --- src/libextra/rc.rs | 4 ++-- src/librustc/middle/ty.rs | 4 ++-- src/test/compile-fail/non_owned-enum.rs | 2 +- src/test/compile-fail/non_owned-struct.rs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libextra/rc.rs b/src/libextra/rc.rs index 009d68ac02601..31fed541bb123 100644 --- a/src/libextra/rc.rs +++ b/src/libextra/rc.rs @@ -36,7 +36,7 @@ struct RcBox { /// Immutable reference counted pointer type #[unsafe_no_drop_flag] -#[non_sendable] +#[no_send] pub struct Rc { priv ptr: *mut RcBox, } @@ -168,7 +168,7 @@ struct RcMutBox { /// Mutable reference counted pointer type #[non_owned] -#[non_sendable] +#[no_send] #[mutable] #[unsafe_no_drop_flag] pub struct RcMut { diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 175529be20629..03a73c847ee6e 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -1969,7 +1969,7 @@ static TC_ONCE_CLOSURE: TypeContents = TypeContents{bits: 0b0001_0000_0000}; /// An enum with no variants. static TC_EMPTY_ENUM: TypeContents = TypeContents{bits: 0b0010_0000_0000}; -/// Contains a type marked with `#[non_sendable]` +/// Contains a type marked with `#[no_send]` static TC_NON_SENDABLE: TypeContents = TypeContents{bits: 0b0100_0000_0000}; /// Is a bare vector, str, function, trait, etc (only relevant at top level). @@ -2207,7 +2207,7 @@ pub fn type_contents(cx: ctxt, ty: t) -> TypeContents { if has_attr(cx, did, "mutable") { tc = tc + TC_MUTABLE; } - if has_attr(cx, did, "non_sendable") { + if has_attr(cx, did, "no_send") { tc = tc + TC_NON_SENDABLE; } tc diff --git a/src/test/compile-fail/non_owned-enum.rs b/src/test/compile-fail/non_owned-enum.rs index 20b571ad61410..b436bfb8b0fdb 100644 --- a/src/test/compile-fail/non_owned-enum.rs +++ b/src/test/compile-fail/non_owned-enum.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[non_sendable] +#[no_send] enum Foo { A } fn bar(_: T) {} diff --git a/src/test/compile-fail/non_owned-struct.rs b/src/test/compile-fail/non_owned-struct.rs index d4b8e6755a126..542c3aa212bb9 100644 --- a/src/test/compile-fail/non_owned-struct.rs +++ b/src/test/compile-fail/non_owned-struct.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[non_sendable] +#[no_send] struct Foo { a: int } fn bar(_: T) {} From 264da39d00c6f596d7e0492737d7c487a4bd9ea7 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Fri, 28 Jun 2013 14:36:33 -0700 Subject: [PATCH 2/2] Rename #[mutable] to #[no_freeze] --- src/libextra/arc.rs | 3 ++- src/libextra/arena.rs | 3 ++- src/libextra/rc.rs | 3 ++- src/librustc/middle/ty.rs | 2 +- src/libstd/cell.rs | 3 ++- src/test/compile-fail/mutable-enum.rs | 2 +- src/test/compile-fail/mutable-struct.rs | 2 +- 7 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/libextra/arc.rs b/src/libextra/arc.rs index 2fb03fecb5988..30067c92300cc 100644 --- a/src/libextra/arc.rs +++ b/src/libextra/arc.rs @@ -276,7 +276,8 @@ struct RWARCInner { lock: RWlock, failed: bool, data: T } * * Unlike mutex_arcs, rw_arcs are safe, because they cannot be nested. */ -#[mutable] +#[mutable] // XXX remove after snap +#[no_freeze] struct RWARC { x: UnsafeAtomicRcBox>, } diff --git a/src/libextra/arena.rs b/src/libextra/arena.rs index 2f18b0562e0fe..2c6e7a30448ce 100644 --- a/src/libextra/arena.rs +++ b/src/libextra/arena.rs @@ -65,7 +65,8 @@ struct Chunk { is_pod: bool, } -#[mutable] +#[mutable] // XXX remove after snap +#[no_freeze] pub struct Arena { // The head is separated out from the list as a unbenchmarked // microoptimization, to avoid needing to case on the list to diff --git a/src/libextra/rc.rs b/src/libextra/rc.rs index 31fed541bb123..613c0b1ae417f 100644 --- a/src/libextra/rc.rs +++ b/src/libextra/rc.rs @@ -169,7 +169,8 @@ struct RcMutBox { /// Mutable reference counted pointer type #[non_owned] #[no_send] -#[mutable] +#[mutable] // XXX remove after snap +#[no_freeze] #[unsafe_no_drop_flag] pub struct RcMut { priv ptr: *mut RcMutBox, diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 03a73c847ee6e..f1172fb1da65f 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -2204,7 +2204,7 @@ pub fn type_contents(cx: ctxt, ty: t) -> TypeContents { } fn apply_tc_attr(cx: ctxt, did: def_id, mut tc: TypeContents) -> TypeContents { - if has_attr(cx, did, "mutable") { + if has_attr(cx, did, "no_freeze") { tc = tc + TC_MUTABLE; } if has_attr(cx, did, "no_send") { diff --git a/src/libstd/cell.rs b/src/libstd/cell.rs index e1d2b246dd370..53ea11f2b0592 100644 --- a/src/libstd/cell.rs +++ b/src/libstd/cell.rs @@ -22,7 +22,8 @@ A dynamic, mutable location. Similar to a mutable option type, but friendlier. */ -#[mutable] +#[mutable] // XXX remove after snap +#[no_freeze] #[deriving(Clone, DeepClone, Eq)] #[allow(missing_doc)] pub struct Cell { diff --git a/src/test/compile-fail/mutable-enum.rs b/src/test/compile-fail/mutable-enum.rs index db2172b2e570f..35842a53a315b 100644 --- a/src/test/compile-fail/mutable-enum.rs +++ b/src/test/compile-fail/mutable-enum.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[mutable] +#[no_freeze] enum Foo { A } fn bar(_: T) {} diff --git a/src/test/compile-fail/mutable-struct.rs b/src/test/compile-fail/mutable-struct.rs index 8511bcdcd3501..6f29fcfd96d20 100644 --- a/src/test/compile-fail/mutable-struct.rs +++ b/src/test/compile-fail/mutable-struct.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[mutable] +#[no_freeze] struct Foo { a: int } fn bar(_: T) {}