Skip to content

Rename Copyable to Cloneable to ensure consistency with the Clone trait #11893

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 30, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/etc/vim/syntax/rust.vim
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,16 @@ syn keyword rustTrait SendStr SendStrOwned SendStrStatic IntoSendStr
syn keyword rustTrait Str StrVector StrSlice OwnedStr
syn keyword rustTrait IterBytes
syn keyword rustTrait ToStr IntoStr
syn keyword rustTrait CopyableTuple ImmutableTuple
syn keyword rustTrait CloneableTuple ImmutableTuple
syn keyword rustTrait Tuple1 Tuple2 Tuple3 Tuple4
syn keyword rustTrait Tuple5 Tuple6 Tuple7 Tuple8
syn keyword rustTrait Tuple9 Tuple10 Tuple11 Tuple12
syn keyword rustTrait ImmutableTuple1 ImmutableTuple2 ImmutableTuple3 ImmutableTuple4
syn keyword rustTrait ImmutableTuple5 ImmutableTuple6 ImmutableTuple7 ImmutableTuple8
syn keyword rustTrait ImmutableTuple9 ImmutableTuple10 ImmutableTuple11 ImmutableTuple12
syn keyword rustTrait ImmutableEqVector ImmutableTotalOrdVector ImmutableCopyableVector
syn keyword rustTrait OwnedVector OwnedCopyableVector OwnedEqVector MutableVector
syn keyword rustTrait Vector VectorVector CopyableVector ImmutableVector
syn keyword rustTrait ImmutableEqVector ImmutableTotalOrdVector ImmutableCloneableVector
syn keyword rustTrait OwnedVector OwnedCloneableVector OwnedEqVector MutableVector
syn keyword rustTrait Vector VectorVector CloneableVector ImmutableVector

"syn keyword rustFunction stream
syn keyword rustTrait Port Chan GenericChan GenericSmartChan GenericPort Peekable
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/c_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ use ptr::RawPtr;
use ptr;
use str::StrSlice;
use str;
use vec::{CopyableVector, ImmutableVector, MutableVector};
use vec::{CloneableVector, ImmutableVector, MutableVector};
use vec;
use unstable::intrinsics;

Expand Down
2 changes: 1 addition & 1 deletion src/libstd/io/comm_adapters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use cmp;
use io;
use option::{None, Option, Some};
use super::{Reader, Writer};
use vec::{bytes, CopyableVector, MutableVector, ImmutableVector};
use vec::{bytes, CloneableVector, MutableVector, ImmutableVector};

/// Allows reading from a port.
///
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/io/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use option::{Option, Some, None};
use super::{Reader, Writer, Seek, Buffer, IoError, SeekStyle, io_error,
OtherIoError};
use vec;
use vec::{Vector, ImmutableVector, MutableVector, OwnedCopyableVector};
use vec::{Vector, ImmutableVector, MutableVector, OwnedCloneableVector};

/// Writes to an owned, growable byte vector
///
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ use str::{StrSlice, OwnedStr};
use to_str::ToStr;
use uint;
use unstable::finally::Finally;
use vec::{OwnedVector, MutableVector, ImmutableVector, OwnedCopyableVector};
use vec::{OwnedVector, MutableVector, ImmutableVector, OwnedCloneableVector};
use vec;

// Reexports
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/num/strconv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use option::{None, Option, Some};
use char;
use str::{StrSlice};
use str;
use vec::{CopyableVector, ImmutableVector, MutableVector};
use vec::{CloneableVector, ImmutableVector, MutableVector};
use vec::OwnedVector;
use num;
use num::{NumCast, Zero, One, cast, Integer};
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/path/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ use str;
use str::{OwnedStr, Str, StrSlice};
use to_str::ToStr;
use vec;
use vec::{CopyableVector, OwnedCopyableVector, OwnedVector, Vector};
use vec::{CloneableVector, OwnedCloneableVector, OwnedVector, Vector};
use vec::{ImmutableEqVector, ImmutableVector};

/// Typedef for POSIX file paths.
Expand Down
6 changes: 3 additions & 3 deletions src/libstd/path/posix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ use str;
use str::Str;
use to_bytes::IterBytes;
use vec;
use vec::{CopyableVector, RevSplits, Splits, Vector, VectorVector,
ImmutableEqVector, OwnedVector, ImmutableVector, OwnedCopyableVector};
use vec::{CloneableVector, RevSplits, Splits, Vector, VectorVector,
ImmutableEqVector, OwnedVector, ImmutableVector, OwnedCloneableVector};
use super::{BytesContainer, GenericPath, GenericPathUnsafe};

/// Iterator that yields successive components of a Path as &[u8]
Expand Down Expand Up @@ -332,7 +332,7 @@ impl Path {

/// Returns a normalized byte vector representation of a path, by removing all empty
/// components, and unnecessary . and .. components.
fn normalize<V: Vector<u8>+CopyableVector<u8>>(v: V) -> ~[u8] {
fn normalize<V: Vector<u8>+CloneableVector<u8>>(v: V) -> ~[u8] {
// borrowck is being very picky
let val = {
let is_abs = !v.as_slice().is_empty() && v.as_slice()[0] == SEP_BYTE;
Expand Down
8 changes: 4 additions & 4 deletions src/libstd/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,17 @@ pub use send_str::{SendStr, SendStrOwned, SendStrStatic, IntoSendStr};
pub use str::{Str, StrVector, StrSlice, OwnedStr};
pub use to_bytes::IterBytes;
pub use to_str::{ToStr, IntoStr};
pub use tuple::{CopyableTuple, ImmutableTuple};
pub use tuple::{CloneableTuple, ImmutableTuple};
pub use tuple::{ImmutableTuple1, ImmutableTuple2, ImmutableTuple3, ImmutableTuple4};
pub use tuple::{ImmutableTuple5, ImmutableTuple6, ImmutableTuple7, ImmutableTuple8};
pub use tuple::{ImmutableTuple9, ImmutableTuple10, ImmutableTuple11, ImmutableTuple12};
pub use tuple::{Tuple1, Tuple2, Tuple3, Tuple4};
pub use tuple::{Tuple5, Tuple6, Tuple7, Tuple8};
pub use tuple::{Tuple9, Tuple10, Tuple11, Tuple12};
pub use vec::{ImmutableEqVector, ImmutableTotalOrdVector, ImmutableCopyableVector};
pub use vec::{OwnedVector, OwnedCopyableVector,OwnedEqVector};
pub use vec::{ImmutableEqVector, ImmutableTotalOrdVector, ImmutableCloneableVector};
pub use vec::{OwnedVector, OwnedCloneableVector,OwnedEqVector};
pub use vec::{MutableVector, MutableTotalOrdVector};
pub use vec::{Vector, VectorVector, CopyableVector, ImmutableVector};
pub use vec::{Vector, VectorVector, CloneableVector, ImmutableVector};

// Reexported runtime types
pub use comm::{Port, Chan, SharedChan};
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ use to_str::ToStr;
use from_str::FromStr;
use uint;
use vec;
use vec::{OwnedVector, OwnedCopyableVector, ImmutableVector, MutableVector};
use vec::{OwnedVector, OwnedCloneableVector, ImmutableVector, MutableVector};
use default::Default;
use send_str::{SendStr, SendStrOwned};
use unstable::raw::Repr;
Expand Down Expand Up @@ -594,7 +594,7 @@ impl<'a> Iterator<&'a str> for StrSplits<'a> {
// Helper functions used for Unicode normalization
fn canonical_sort(comb: &mut [(char, u8)]) {
use iter::range;
use tuple::CopyableTuple;
use tuple::CloneableTuple;

let len = comb.len();
for i in range(0, len) {
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/tuple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use clone::Clone;
#[cfg(not(test))] use default::Default;

/// Method extensions to pairs where both types satisfy the `Clone` bound
pub trait CopyableTuple<T, U> {
pub trait CloneableTuple<T, U> {
/// Return the first element of self
fn first(&self) -> T;
/// Return the second element of self
Expand All @@ -26,7 +26,7 @@ pub trait CopyableTuple<T, U> {
fn swap(&self) -> (U, T);
}

impl<T:Clone,U:Clone> CopyableTuple<T, U> for (T, U) {
impl<T:Clone,U:Clone> CloneableTuple<T, U> for (T, U) {
/// Return the first element of self
#[inline]
fn first(&self) -> T {
Expand Down
18 changes: 9 additions & 9 deletions src/libstd/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -798,8 +798,8 @@ impl<T> Container for ~[T] {
}
}

/// Extension methods for vector slices with copyable elements
pub trait CopyableVector<T> {
/// Extension methods for vector slices with cloneable elements
pub trait CloneableVector<T> {
/// Copy `self` into a new owned vector
fn to_owned(&self) -> ~[T];

Expand All @@ -808,7 +808,7 @@ pub trait CopyableVector<T> {
}

/// Extension methods for vector slices
impl<'a, T: Clone> CopyableVector<T> for &'a [T] {
impl<'a, T: Clone> CloneableVector<T> for &'a [T] {
/// Returns a copy of `v`.
#[inline]
fn to_owned(&self) -> ~[T] {
Expand All @@ -824,7 +824,7 @@ impl<'a, T: Clone> CopyableVector<T> for &'a [T] {
}

/// Extension methods for owned vectors
impl<T: Clone> CopyableVector<T> for ~[T] {
impl<T: Clone> CloneableVector<T> for ~[T] {
#[inline]
fn to_owned(&self) -> ~[T] { self.clone() }

Expand All @@ -833,7 +833,7 @@ impl<T: Clone> CopyableVector<T> for ~[T] {
}

/// Extension methods for managed vectors
impl<T: Clone> CopyableVector<T> for @[T] {
impl<T: Clone> CloneableVector<T> for @[T] {
#[inline]
fn to_owned(&self) -> ~[T] { self.as_slice().to_owned() }

Expand Down Expand Up @@ -1261,7 +1261,7 @@ impl<'a, T: TotalOrd> ImmutableTotalOrdVector<T> for &'a [T] {
}

/// Extension methods for vectors containing `Clone` elements.
pub trait ImmutableCopyableVector<T> {
pub trait ImmutableCloneableVector<T> {
/**
* Partitions the vector into those that satisfies the predicate, and
* those that do not.
Expand All @@ -1273,7 +1273,7 @@ pub trait ImmutableCopyableVector<T> {
fn permutations(self) -> Permutations<T>;
}

impl<'a,T:Clone> ImmutableCopyableVector<T> for &'a [T] {
impl<'a,T:Clone> ImmutableCloneableVector<T> for &'a [T] {
#[inline]
fn partitioned(&self, f: |&T| -> bool) -> (~[T], ~[T]) {
let mut lefts = ~[];
Expand Down Expand Up @@ -1698,7 +1698,7 @@ impl<T> Mutable for ~[T] {
}

/// Extension methods for owned vectors containing `Clone` elements.
pub trait OwnedCopyableVector<T:Clone> {
pub trait OwnedCloneableVector<T:Clone> {
/// Iterates over the slice `rhs`, copies each element, and then appends it to
/// the vector provided `v`. The `rhs` vector is traversed in-order.
///
Expand Down Expand Up @@ -1732,7 +1732,7 @@ pub trait OwnedCopyableVector<T:Clone> {
fn grow_set(&mut self, index: uint, initval: &T, val: T);
}

impl<T:Clone> OwnedCopyableVector<T> for ~[T] {
impl<T:Clone> OwnedCloneableVector<T> for ~[T] {
#[inline]
fn push_all(&mut self, rhs: &[T]) {
let new_len = self.len() + rhs.len();
Expand Down