Skip to content

Commit 4b64d1d

Browse files
committed
---
yaml --- r: 161654 b: refs/heads/snap-stage3 c: 096a286 h: refs/heads/master v: v3
1 parent db78434 commit 4b64d1d

File tree

282 files changed

+2198
-608
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

282 files changed

+2198
-608
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 4eb72d268f337a8f117c86a2ac1b98336cab9e9d
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 50b6d01e1c4a3091e7bf9ab8e7cc053f96f06e66
4+
refs/heads/snap-stage3: 096a28607fb80c91e6e2ca64d9ef44c4e550e96c
55
refs/heads/try: 0f0d21c1eb5c7be04d323e0b06faf252ad790af6
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/src/compiletest/common.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ pub enum Mode {
2525
Codegen
2626
}
2727

28+
impl Copy for Mode {}
29+
2830
impl FromStr for Mode {
2931
fn from_str(s: &str) -> Option<Mode> {
3032
match s {

branches/snap-stage3/src/doc/guide-unsafe.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,9 @@ extern {
661661
fn abort() -> !;
662662
}
663663
664+
#[lang = "owned_box"]
665+
pub struct Box<T>(*mut T);
666+
664667
#[lang="exchange_malloc"]
665668
unsafe fn allocate(size: uint, _align: uint) -> *mut u8 {
666669
let p = libc::malloc(size as libc::size_t) as *mut u8;

branches/snap-stage3/src/doc/reference.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1660,6 +1660,7 @@ Implementations are defined with the keyword `impl`.
16601660

16611661
```
16621662
# struct Point {x: f64, y: f64};
1663+
# impl Copy for Point {}
16631664
# type Surface = int;
16641665
# struct BoundingBox {x: f64, y: f64, width: f64, height: f64};
16651666
# trait Shape { fn draw(&self, Surface); fn bounding_box(&self) -> BoundingBox; }
@@ -1669,6 +1670,8 @@ struct Circle {
16691670
center: Point,
16701671
}
16711672
1673+
impl Copy for Circle {}
1674+
16721675
impl Shape for Circle {
16731676
fn draw(&self, s: Surface) { do_draw_circle(s, *self); }
16741677
fn bounding_box(&self) -> BoundingBox {
@@ -1791,6 +1794,7 @@ default visibility with the `priv` keyword. When an item is declared as `pub`,
17911794
it can be thought of as being accessible to the outside world. For example:
17921795

17931796
```
1797+
# #![allow(missing_copy_implementations)]
17941798
# fn main() {}
17951799
// Declare a private struct
17961800
struct Foo;

branches/snap-stage3/src/libarena/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ impl<T> TypedArena<T> {
466466
}
467467

468468
let ptr: &mut T = unsafe {
469-
let ptr: &mut T = mem::transmute(self.ptr);
469+
let ptr: &mut T = mem::transmute(self.ptr.clone());
470470
ptr::write(ptr, object);
471471
self.ptr.set(self.ptr.get().offset(1));
472472
ptr

branches/snap-stage3/src/libcollections/binary_heap.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
//! position: uint
3636
//! }
3737
//!
38+
//! impl Copy for State {}
39+
//!
3840
//! // The priority queue depends on `Ord`.
3941
//! // Explicitly implement the trait so the queue becomes a min-heap
4042
//! // instead of a max-heap.

branches/snap-stage3/src/libcollections/dlist.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ pub struct DList<T> {
3939
}
4040

4141
type Link<T> = Option<Box<Node<T>>>;
42-
struct Rawlink<T> { p: *mut T }
42+
43+
struct Rawlink<T> {
44+
p: *mut T,
45+
}
46+
47+
impl<T> Copy for Rawlink<T> {}
4348

4449
struct Node<T> {
4550
next: Link<T>,
@@ -59,6 +64,8 @@ impl<'a, T> Clone for Items<'a, T> {
5964
fn clone(&self) -> Items<'a, T> { *self }
6065
}
6166

67+
impl<'a,T> Copy for Items<'a,T> {}
68+
6269
/// An iterator over mutable references to the items of a `DList`.
6370
pub struct MutItems<'a, T:'a> {
6471
list: &'a mut DList<T>,

branches/snap-stage3/src/libcollections/enum_set.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ pub struct EnumSet<E> {
2727
bits: uint
2828
}
2929

30+
impl<E> Copy for EnumSet<E> {}
31+
3032
impl<E:CLike+fmt::Show> fmt::Show for EnumSet<E> {
3133
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
3234
try!(write!(fmt, "{{"));
@@ -269,6 +271,8 @@ mod test {
269271
A, B, C
270272
}
271273

274+
impl Copy for Foo {}
275+
272276
impl CLike for Foo {
273277
fn to_uint(&self) -> uint {
274278
*self as uint
@@ -477,6 +481,9 @@ mod test {
477481
V50, V51, V52, V53, V54, V55, V56, V57, V58, V59,
478482
V60, V61, V62, V63, V64, V65, V66, V67, V68, V69,
479483
}
484+
485+
impl Copy for Bar {}
486+
480487
impl CLike for Bar {
481488
fn to_uint(&self) -> uint {
482489
*self as uint

branches/snap-stage3/src/libcollections/hash/sip.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ pub struct SipState {
4343
ntail: uint, // how many bytes in tail are valid
4444
}
4545

46+
impl Copy for SipState {}
47+
4648
// sadly, these macro definitions can't appear later,
4749
// because they're needed in the following defs;
4850
// this design could be improved.
@@ -211,6 +213,7 @@ impl Default for SipState {
211213

212214
/// `SipHasher` computes the SipHash algorithm from a stream of bytes.
213215
#[deriving(Clone)]
216+
#[allow(missing_copy_implementations)]
214217
pub struct SipHasher {
215218
k0: u64,
216219
k1: u64,

branches/snap-stage3/src/libcollections/slice.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ use self::Direction::*;
9191
use alloc::boxed::Box;
9292
use core::borrow::{BorrowFrom, BorrowFromMut, ToOwned};
9393
use core::cmp;
94-
use core::kinds::Sized;
94+
use core::kinds::{Copy, Sized};
9595
use core::mem::size_of;
9696
use core::mem;
9797
use core::prelude::{Clone, Greater, Iterator, IteratorExt, Less, None, Option};
@@ -177,12 +177,16 @@ impl ElementSwaps {
177177

178178
enum Direction { Pos, Neg }
179179

180+
impl Copy for Direction {}
181+
180182
/// An `Index` and `Direction` together.
181183
struct SizeDirection {
182184
size: uint,
183185
dir: Direction,
184186
}
185187

188+
impl Copy for SizeDirection {}
189+
186190
impl Iterator<(uint, uint)> for ElementSwaps {
187191
#[inline]
188192
fn next(&mut self) -> Option<(uint, uint)> {
@@ -1482,11 +1486,17 @@ mod tests {
14821486
fn clone(&self) -> S {
14831487
self.f.set(self.f.get() + 1);
14841488
if self.f.get() == 10 { panic!() }
1485-
S { f: self.f, boxes: self.boxes.clone() }
1489+
S {
1490+
f: self.f.clone(),
1491+
boxes: self.boxes.clone(),
1492+
}
14861493
}
14871494
}
14881495

1489-
let s = S { f: Cell::new(0), boxes: (box 0, Rc::new(0)) };
1496+
let s = S {
1497+
f: Cell::new(0),
1498+
boxes: (box 0, Rc::new(0)),
1499+
};
14901500
let _ = Vec::from_elem(100, s);
14911501
}
14921502

branches/snap-stage3/src/libcollections/str.rs

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -228,24 +228,32 @@ impl<'a> Iterator<char> for Decompositions<'a> {
228228
_ => self.sorted = false
229229
}
230230

231-
let decomposer = match self.kind {
232-
Canonical => unicode::char::decompose_canonical,
233-
Compatible => unicode::char::decompose_compatible
234-
};
235-
236231
if !self.sorted {
237232
for ch in self.iter {
238233
let buffer = &mut self.buffer;
239234
let sorted = &mut self.sorted;
240-
decomposer(ch, |d| {
241-
let class = unicode::char::canonical_combining_class(d);
242-
if class == 0 && !*sorted {
243-
canonical_sort(buffer.as_mut_slice());
244-
*sorted = true;
235+
{
236+
let callback = |d| {
237+
let class =
238+
unicode::char::canonical_combining_class(d);
239+
if class == 0 && !*sorted {
240+
canonical_sort(buffer.as_mut_slice());
241+
*sorted = true;
242+
}
243+
buffer.push((d, class));
244+
};
245+
match self.kind {
246+
Canonical => {
247+
unicode::char::decompose_canonical(ch, callback)
248+
}
249+
Compatible => {
250+
unicode::char::decompose_compatible(ch, callback)
251+
}
245252
}
246-
buffer.push((d, class));
247-
});
248-
if *sorted { break }
253+
}
254+
if *sorted {
255+
break
256+
}
249257
}
250258
}
251259

branches/snap-stage3/src/libcollections/vec.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,15 @@ impl<T> Vec<T> {
218218
}
219219
}
220220

221-
/// Creates a `Vec<T>` directly from the raw components of another vector.
221+
/// Creates a `Vec<T>` directly from the raw constituents.
222222
///
223-
/// This is highly unsafe, due to the number of invariants that aren't checked.
223+
/// This is highly unsafe:
224+
///
225+
/// - if `ptr` is null, then `length` and `capacity` should be 0
226+
/// - `ptr` must point to an allocation of size `capacity`
227+
/// - there must be `length` valid instances of type `T` at the
228+
/// beginning of that allocation
229+
/// - `ptr` must be allocated by the default `Vec` allocator
224230
///
225231
/// # Example
226232
///
@@ -682,12 +688,11 @@ impl<T> Vec<T> {
682688
Some(new_cap) => {
683689
let amort_cap = new_cap.next_power_of_two();
684690
// next_power_of_two will overflow to exactly 0 for really big capacities
685-
let cap = if amort_cap == 0 {
686-
new_cap
691+
if amort_cap == 0 {
692+
self.grow_capacity(new_cap);
687693
} else {
688-
amort_cap
689-
};
690-
self.grow_capacity(cap)
694+
self.grow_capacity(amort_cap);
695+
}
691696
}
692697
}
693698
}

branches/snap-stage3/src/libcore/atomic.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub use self::Ordering::*;
1717
use intrinsics;
1818
use std::kinds::marker;
1919
use cell::UnsafeCell;
20+
use kinds::Copy;
2021

2122
/// A boolean type which can be safely shared between threads.
2223
#[stable]
@@ -81,6 +82,8 @@ pub enum Ordering {
8182
SeqCst,
8283
}
8384

85+
impl Copy for Ordering {}
86+
8487
/// An `AtomicBool` initialized to `false`.
8588
#[unstable = "may be renamed, pending conventions for static initalizers"]
8689
pub const INIT_ATOMIC_BOOL: AtomicBool =

branches/snap-stage3/src/libcore/char.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,3 +519,4 @@ impl Iterator<char> for DefaultEscapedChars {
519519
}
520520
}
521521
}
522+

branches/snap-stage3/src/libcore/cmp.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,8 @@
4343

4444
pub use self::Ordering::*;
4545

46-
use kinds::Sized;
47-
use option::Option;
48-
use option::Option::{Some, None};
46+
use kinds::{Copy, Sized};
47+
use option::{Option, Some, None};
4948

5049
/// Trait for values that can be compared for equality and inequality.
5150
///
@@ -106,6 +105,8 @@ pub enum Ordering {
106105
Greater = 1i,
107106
}
108107

108+
impl Copy for Ordering {}
109+
109110
impl Ordering {
110111
/// Reverse the `Ordering`, so that `Less` becomes `Greater` and
111112
/// vice versa.

branches/snap-stage3/src/libcore/fmt/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ pub type Result = result::Result<(), Error>;
4646
#[experimental = "core and I/O reconciliation may alter this definition"]
4747
pub struct Error;
4848

49+
impl Copy for Error {}
50+
4951
/// A collection of methods that are required to format a message into a stream.
5052
///
5153
/// This trait is the type which this modules requires when formatting
@@ -135,6 +137,8 @@ impl<'a> Argument<'a> {
135137
}
136138
}
137139

140+
impl<'a> Copy for Argument<'a> {}
141+
138142
impl<'a> Arguments<'a> {
139143
/// When using the format_args!() macro, this function is used to generate the
140144
/// Arguments structure.

branches/snap-stage3/src/libcore/fmt/num.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
use fmt;
1818
use iter::DoubleEndedIteratorExt;
19+
use kinds::Copy;
1920
use num::{Int, cast};
2021
use slice::SlicePrelude;
2122

@@ -114,6 +115,8 @@ pub struct Radix {
114115
base: u8,
115116
}
116117

118+
impl Copy for Radix {}
119+
117120
impl Radix {
118121
fn new(base: u8) -> Radix {
119122
assert!(2 <= base && base <= 36, "the base must be in the range of 2..36: {}", base);
@@ -136,6 +139,8 @@ impl GenericRadix for Radix {
136139
#[unstable = "may be renamed or move to a different module"]
137140
pub struct RadixFmt<T, R>(T, R);
138141

142+
impl<T,R> Copy for RadixFmt<T,R> where T: Copy, R: Copy {}
143+
139144
/// Constructs a radix formatter in the range of `2..36`.
140145
///
141146
/// # Example

0 commit comments

Comments
 (0)