diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-06-05 15:53:17 -0700 |
|---|---|---|
| committer | Corey Richardson <corey@octayn.net> | 2013-06-28 10:44:15 -0400 |
| commit | 1eec3bba13fef50324d1a7542713b3189a627547 (patch) | |
| tree | fa7f486ccaf1d14725e2615ab978acf64ce76c9e | |
| parent | d350981c0e8daa778d9760ba0e19b3157026e743 (diff) | |
| download | rust-1eec3bba13fef50324d1a7542713b3189a627547.tar.gz rust-1eec3bba13fef50324d1a7542713b3189a627547.zip | |
librustc: Rename Const to Freeze
| -rw-r--r-- | src/libextra/arc.rs | 20 | ||||
| -rw-r--r-- | src/libextra/rc.rs | 8 | ||||
| -rw-r--r-- | src/librustc/middle/borrowck/doc.rs | 4 | ||||
| -rw-r--r-- | src/librustc/middle/borrowck/gather_loans/restrictions.rs | 2 | ||||
| -rw-r--r-- | src/librustc/middle/typeck/collect.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/markdown_pass.rs | 4 | ||||
| -rw-r--r-- | src/libstd/clone.rs | 10 | ||||
| -rw-r--r-- | src/libstd/kinds.rs | 4 | ||||
| -rw-r--r-- | src/libstd/prelude.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ast.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/token.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/util/interner.rs | 2 | ||||
| -rw-r--r-- | src/test/auxiliary/issue-2526.rs | 6 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-2611-4.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-3177-mutable-struct.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/mutable-enum.rs | 4 | ||||
| -rw-r--r-- | src/test/compile-fail/mutable-struct.rs | 4 | ||||
| -rw-r--r-- | src/test/run-pass/const-bound.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/issue-2611-3.rs | 2 |
19 files changed, 42 insertions, 42 deletions
diff --git a/src/libextra/arc.rs b/src/libextra/arc.rs index 5e3b60bb3a8..e0ab2558e3f 100644 --- a/src/libextra/arc.rs +++ b/src/libextra/arc.rs @@ -112,7 +112,7 @@ impl<'self> Condvar<'self> { pub struct ARC<T> { x: UnsafeAtomicRcBox<T> } /// Create an atomically reference counted wrapper. -pub fn ARC<T:Const + Owned>(data: T) -> ARC<T> { +pub fn ARC<T:Freeze + Owned>(data: T) -> ARC<T> { ARC { x: UnsafeAtomicRcBox::new(data) } } @@ -120,7 +120,7 @@ pub fn ARC<T:Const + Owned>(data: T) -> ARC<T> { * Access the underlying data in an atomically reference counted * wrapper. */ -impl<T:Const+Owned> ARC<T> { +impl<T:Freeze+Owned> ARC<T> { pub fn get<'a>(&'a self) -> &'a T { unsafe { &*self.x.get_immut() } } @@ -133,7 +133,7 @@ impl<T:Const+Owned> ARC<T> { * object. However, one of the `arc` objects can be sent to another task, * allowing them to share the underlying data. */ -impl<T:Const + Owned> Clone for ARC<T> { +impl<T:Freeze + Owned> Clone for ARC<T> { fn clone(&self) -> ARC<T> { ARC { x: self.x.clone() } } @@ -282,14 +282,14 @@ struct RWARC<T> { } /// Create a reader/writer ARC with the supplied data. -pub fn RWARC<T:Const + Owned>(user_data: T) -> RWARC<T> { +pub fn RWARC<T:Freeze + Owned>(user_data: T) -> RWARC<T> { rw_arc_with_condvars(user_data, 1) } /** * Create a reader/writer ARC with the supplied data and a specified number * of condvars (as sync::rwlock_with_condvars). */ -pub fn rw_arc_with_condvars<T:Const + Owned>( +pub fn rw_arc_with_condvars<T:Freeze + Owned>( user_data: T, num_condvars: uint) -> RWARC<T> { @@ -299,7 +299,7 @@ pub fn rw_arc_with_condvars<T:Const + Owned>( RWARC { x: UnsafeAtomicRcBox::new(data), } } -impl<T:Const + Owned> RWARC<T> { +impl<T:Freeze + Owned> RWARC<T> { /// Duplicate a rwlock-protected ARC, as arc::clone. pub fn clone(&self) -> RWARC<T> { RWARC { @@ -309,7 +309,7 @@ impl<T:Const + Owned> RWARC<T> { } -impl<T:Const + Owned> RWARC<T> { +impl<T:Freeze + Owned> RWARC<T> { /** * Access the underlying data mutably. Locks the rwlock in write mode; * other readers and writers will block. @@ -435,7 +435,7 @@ impl<T:Const + Owned> RWARC<T> { // lock it. This wraps the unsafety, with the justification that the 'lock' // field is never overwritten; only 'failed' and 'data'. #[doc(hidden)] -fn borrow_rwlock<T:Const + Owned>(state: *const RWARCInner<T>) -> *RWlock { +fn borrow_rwlock<T:Freeze + Owned>(state: *const RWARCInner<T>) -> *RWlock { unsafe { cast::transmute(&const (*state).lock) } } @@ -452,7 +452,7 @@ pub struct RWReadMode<'self, T> { token: sync::RWlockReadMode<'self>, } -impl<'self, T:Const + Owned> RWWriteMode<'self, T> { +impl<'self, T:Freeze + Owned> RWWriteMode<'self, T> { /// Access the pre-downgrade RWARC in write mode. pub fn write<U>(&mut self, blk: &fn(x: &mut T) -> U) -> U { match *self { @@ -493,7 +493,7 @@ impl<'self, T:Const + Owned> RWWriteMode<'self, T> { } } -impl<'self, T:Const + Owned> RWReadMode<'self, T> { +impl<'self, T:Freeze + Owned> RWReadMode<'self, T> { /// Access the post-downgrade rwlock in read mode. pub fn read<U>(&self, blk: &fn(x: &T) -> U) -> U { match *self { diff --git a/src/libextra/rc.rs b/src/libextra/rc.rs index 8bd42eae240..ca3229d4b25 100644 --- a/src/libextra/rc.rs +++ b/src/libextra/rc.rs @@ -13,10 +13,10 @@ /** Task-local reference counted smart pointers Task-local reference counted smart pointers are an alternative to managed boxes with deterministic -destruction. They are restricted to containing types that are either `Owned` or `Const` (or both) to +destruction. They are restricted to containing types that are either `Owned` or `Freeze` (or both) to prevent cycles. -Neither `Rc<T>` or `RcMut<T>` is ever `Owned` and `RcMut<T>` is never `Const`. If `T` is `Const`, a +Neither `Rc<T>` or `RcMut<T>` is ever `Owned` and `RcMut<T>` is never `Freeze`. If `T` is `Freeze`, a cycle cannot be created with `Rc<T>` because there is no way to modify it after creation. */ @@ -56,7 +56,7 @@ pub fn rc_from_owned<T: Owned>(value: T) -> Rc<T> { } // FIXME: #6516: should be a static method -pub fn rc_from_const<T: Const>(value: T) -> Rc<T> { +pub fn rc_from_const<T: Freeze>(value: T) -> Rc<T> { unsafe { Rc::new(value) } } @@ -190,7 +190,7 @@ pub fn rc_mut_from_owned<T: Owned>(value: T) -> RcMut<T> { } // FIXME: #6516: should be a static method -pub fn rc_mut_from_const<T: Const>(value: T) -> RcMut<T> { +pub fn rc_mut_from_const<T: Freeze>(value: T) -> RcMut<T> { unsafe { RcMut::new(value) } } diff --git a/src/librustc/middle/borrowck/doc.rs b/src/librustc/middle/borrowck/doc.rs index cb3983117e9..7a91f204b13 100644 --- a/src/librustc/middle/borrowck/doc.rs +++ b/src/librustc/middle/borrowck/doc.rs @@ -539,14 +539,14 @@ mutable borrowed pointers. ### Restrictions for loans of const aliasable pointees -Const pointers are read-only. There may be `&mut` or `&` aliases, and +Freeze pointers are read-only. There may be `&mut` or `&` aliases, and we can not prevent *anything* but moves in that case. So the `RESTRICTIONS` function is only defined if `ACTIONS` is the empty set. Because moves from a `&const` or `@const` lvalue are never legal, it is not necessary to add any restrictions at all to the final result. - RESTRICTIONS(*LV, []) = [] // R-Deref-Const-Borrowed + RESTRICTIONS(*LV, []) = [] // R-Deref-Freeze-Borrowed TYPE(LV) = &const Ty or @const Ty ### Restrictions for loans of mutable borrowed pointees diff --git a/src/librustc/middle/borrowck/gather_loans/restrictions.rs b/src/librustc/middle/borrowck/gather_loans/restrictions.rs index bedb465c5c1..a867ea94802 100644 --- a/src/librustc/middle/borrowck/gather_loans/restrictions.rs +++ b/src/librustc/middle/borrowck/gather_loans/restrictions.rs @@ -125,7 +125,7 @@ impl RestrictionsContext { mc::cat_deref(_, _, mc::region_ptr(m_const, _)) | mc::cat_deref(_, _, mc::gc_ptr(m_const)) => { - // R-Deref-Const-Borrowed + // R-Deref-Freeze-Borrowed self.check_no_mutability_control(cmt, restrictions); Safe } diff --git a/src/librustc/middle/typeck/collect.rs b/src/librustc/middle/typeck/collect.rs index 0e118adb8f4..94520b6faca 100644 --- a/src/librustc/middle/typeck/collect.rs +++ b/src/librustc/middle/typeck/collect.rs @@ -1165,7 +1165,7 @@ pub fn ty_generics(ccx: &CrateCtxt, * enum consisting of a newtyped Ty or a region) to ty's * notion of ty param bounds, which can either be user-defined * traits, or one of the four built-in traits (formerly known - * as kinds): Const, Copy, and Send. + * as kinds): Freeze, Copy, and Send. */ let mut param_bounds = ty::ParamBounds { diff --git a/src/librustdoc/markdown_pass.rs b/src/librustdoc/markdown_pass.rs index 6622ea1551b..ca167c3726a 100644 --- a/src/librustdoc/markdown_pass.rs +++ b/src/librustdoc/markdown_pass.rs @@ -152,7 +152,7 @@ pub fn header_kind(doc: doc::ItemTag) -> ~str { ~"Function" } doc::ConstTag(_) => { - ~"Const" + ~"Freeze" } doc::EnumTag(_) => { ~"Enum" @@ -786,7 +786,7 @@ mod test { #[test] fn should_write_const_header() { let markdown = render(~"static a: bool = true;"); - assert!(markdown.contains("## Const `a`\n\n")); + assert!(markdown.contains("## Freeze `a`\n\n")); } #[test] diff --git a/src/libstd/clone.rs b/src/libstd/clone.rs index 046693632c6..4a85a8c871d 100644 --- a/src/libstd/clone.rs +++ b/src/libstd/clone.rs @@ -22,7 +22,7 @@ by convention implementing the `Clone` trait and calling the */ -use core::kinds::Const; +use core::kinds::Freeze; /// A common trait for cloning an object. pub trait Clone { @@ -113,16 +113,16 @@ impl<T: DeepClone> DeepClone for ~T { } // FIXME: #6525: should also be implemented for `T: Owned + DeepClone` -impl<T: Const + DeepClone> DeepClone for @T { - /// Return a deep copy of the managed box. The `Const` trait is required to prevent performing +impl<T: Freeze + DeepClone> DeepClone for @T { + /// Return a deep copy of the managed box. The `Freeze` trait is required to prevent performing /// a deep clone of a potentially cyclical type. #[inline] fn deep_clone(&self) -> @T { @(**self).deep_clone() } } // FIXME: #6525: should also be implemented for `T: Owned + DeepClone` -impl<T: Const + DeepClone> DeepClone for @mut T { - /// Return a deep copy of the managed box. The `Const` trait is required to prevent performing +impl<T: Freeze + DeepClone> DeepClone for @mut T { + /// Return a deep copy of the managed box. The `Freeze` trait is required to prevent performing /// a deep clone of a potentially cyclical type. #[inline] fn deep_clone(&self) -> @mut T { @mut (**self).deep_clone() } diff --git a/src/libstd/kinds.rs b/src/libstd/kinds.rs index b7ec90574e2..9d5348ff98f 100644 --- a/src/libstd/kinds.rs +++ b/src/libstd/kinds.rs @@ -57,13 +57,13 @@ pub trait Owned { #[cfg(stage0)] #[lang="const"] -pub trait Const { +pub trait Freeze { // empty. } #[cfg(not(stage0))] #[lang="freeze"] -pub trait Const { +pub trait Freeze { // empty. } diff --git a/src/libstd/prelude.rs b/src/libstd/prelude.rs index 8e240a62236..5959cdaf318 100644 --- a/src/libstd/prelude.rs +++ b/src/libstd/prelude.rs @@ -30,7 +30,7 @@ Rust's prelude has three main parts: // Reexported core operators pub use either::{Either, Left, Right}; pub use kinds::{Copy, Sized}; -pub use kinds::{Const, Owned}; +pub use kinds::{Freeze, Owned}; pub use ops::{Add, Sub, Mul, Div, Rem, Neg, Not}; pub use ops::{BitAnd, BitOr, BitXor}; pub use ops::{Drop}; diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index feb03896558..a9b0c3986f8 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -147,7 +147,7 @@ pub static crate_node_id: node_id = 0; // The AST represents all type param bounds as types. // typeck::collect::compute_bounds matches these against // the "special" built-in traits (see middle::lang_items) and -// detects Copy, Send, Owned, and Const. +// detects Copy, Send, Owned, and Freeze. pub enum TyParamBound { TraitTyParamBound(@trait_ref), RegionTyParamBound diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 2ddae73a3fc..df599596d7d 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -563,7 +563,7 @@ pub mod keywords { // Strict keywords As, Break, - Const, + Freeze, Copy, Do, Else, diff --git a/src/libsyntax/util/interner.rs b/src/libsyntax/util/interner.rs index af37c1d27d8..3cdc4fd0fa1 100644 --- a/src/libsyntax/util/interner.rs +++ b/src/libsyntax/util/interner.rs @@ -21,7 +21,7 @@ pub struct Interner<T> { } // when traits can extend traits, we should extend index<uint,T> to get [] -impl<T:Eq + IterBytes + Hash + Const + Copy> Interner<T> { +impl<T:Eq + IterBytes + Hash + Freeze + Copy> Interner<T> { pub fn new() -> Interner<T> { Interner { map: @mut HashMap::new(), diff --git a/src/test/auxiliary/issue-2526.rs b/src/test/auxiliary/issue-2526.rs index d4f6a1ec404..8c491a4dfc8 100644 --- a/src/test/auxiliary/issue-2526.rs +++ b/src/test/auxiliary/issue-2526.rs @@ -20,17 +20,17 @@ struct arc_destruct<T> { } #[unsafe_destructor] -impl<T:Const> Drop for arc_destruct<T> { +impl<T:Freeze> Drop for arc_destruct<T> { fn drop(&self) {} } -fn arc_destruct<T:Const>(data: int) -> arc_destruct<T> { +fn arc_destruct<T:Freeze>(data: int) -> arc_destruct<T> { arc_destruct { _data: data } } -fn arc<T:Const>(_data: T) -> arc_destruct<T> { +fn arc<T:Freeze>(_data: T) -> arc_destruct<T> { arc_destruct(0) } diff --git a/src/test/compile-fail/issue-2611-4.rs b/src/test/compile-fail/issue-2611-4.rs index 2385be5723e..531d4eab535 100644 --- a/src/test/compile-fail/issue-2611-4.rs +++ b/src/test/compile-fail/issue-2611-4.rs @@ -20,7 +20,7 @@ struct E { } impl A for E { - fn b<F:Copy + Const,G>(_x: F) -> F { fail!() } //~ ERROR type parameter 0 requires `Const` + fn b<F:Copy + Freeze,G>(_x: F) -> F { fail!() } //~ ERROR type parameter 0 requires `Freeze` } fn main() {} diff --git a/src/test/compile-fail/issue-3177-mutable-struct.rs b/src/test/compile-fail/issue-3177-mutable-struct.rs index 31c0dc7d9c4..180f13d0371 100644 --- a/src/test/compile-fail/issue-3177-mutable-struct.rs +++ b/src/test/compile-fail/issue-3177-mutable-struct.rs @@ -10,7 +10,7 @@ // xfail-test // error-pattern: instantiating a type parameter with an incompatible type -struct S<T:Const> { +struct S<T:Freeze> { s: T, cant_nest: () } diff --git a/src/test/compile-fail/mutable-enum.rs b/src/test/compile-fail/mutable-enum.rs index 2368e5eb5c5..db2172b2e57 100644 --- a/src/test/compile-fail/mutable-enum.rs +++ b/src/test/compile-fail/mutable-enum.rs @@ -11,9 +11,9 @@ #[mutable] enum Foo { A } -fn bar<T: Const>(_: T) {} +fn bar<T: Freeze>(_: T) {} fn main() { let x = A; - bar(x); //~ ERROR instantiating a type parameter with an incompatible type `Foo`, which does not fulfill `Const` + bar(x); //~ ERROR instantiating a type parameter with an incompatible type `Foo`, which does not fulfill `Freeze` } diff --git a/src/test/compile-fail/mutable-struct.rs b/src/test/compile-fail/mutable-struct.rs index ee040506c40..8511bcdcd35 100644 --- a/src/test/compile-fail/mutable-struct.rs +++ b/src/test/compile-fail/mutable-struct.rs @@ -11,9 +11,9 @@ #[mutable] struct Foo { a: int } -fn bar<T: Const>(_: T) {} +fn bar<T: Freeze>(_: T) {} fn main() { let x = Foo { a: 5 }; - bar(x); //~ ERROR instantiating a type parameter with an incompatible type `Foo`, which does not fulfill `Const` + bar(x); //~ ERROR instantiating a type parameter with an incompatible type `Foo`, which does not fulfill `Freeze` } diff --git a/src/test/run-pass/const-bound.rs b/src/test/run-pass/const-bound.rs index 685d86c740d..05f586f76e9 100644 --- a/src/test/run-pass/const-bound.rs +++ b/src/test/run-pass/const-bound.rs @@ -12,7 +12,7 @@ // are const. -fn foo<T:Copy + Const>(x: T) -> T { x } +fn foo<T:Copy + Freeze>(x: T) -> T { x } struct F { field: int } diff --git a/src/test/run-pass/issue-2611-3.rs b/src/test/run-pass/issue-2611-3.rs index acc6ffd0dd1..7f653552631 100644 --- a/src/test/run-pass/issue-2611-3.rs +++ b/src/test/run-pass/issue-2611-3.rs @@ -12,7 +12,7 @@ // than the traits require. trait A { - fn b<C:Copy + Const,D>(x: C) -> C; + fn b<C:Copy + Freeze,D>(x: C) -> C; } struct E { |
