Skip to content

Commit 0fb6b40

Browse files
committed
---
yaml --- r: 163134 b: refs/heads/snap-stage3 c: 60f97fc h: refs/heads/master v: v3
1 parent 6d06c04 commit 0fb6b40

File tree

416 files changed

+4534
-2307
lines changed

Some content is hidden

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

416 files changed

+4534
-2307
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: 9146a919b616e39e528e4d7100d16eef52f1f852
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 796e4b8a885b44342cad8363661069783d3b7fed
4+
refs/heads/snap-stage3: 60f97fc44aa745300ccda73e4f7d3c1827aacda9
55
refs/heads/try: 20cbbffeefc1f35e2ea63afce7b42fbd79611d42
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/compiletest/compiletest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ pub fn make_test(config: &Config, testfile: &Path, f: || -> test::TestFn)
346346
desc: test::TestDesc {
347347
name: make_test_name(config, testfile),
348348
ignore: header::is_test_ignored(config, testfile),
349-
should_fail: false
349+
should_fail: test::ShouldFail::No,
350350
},
351351
testfn: f(),
352352
}

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,21 @@ fn test_out_of_bounds_failure() {
8989
}
9090
~~~
9191

92+
`#[should_fail]` tests can be fragile as it's hard to guarantee that the test
93+
didn't fail for an unexpected reason. To help with this, an optional `expected`
94+
parameter can be added to the `should_fail` attribute. The test harness will
95+
make sure that the failure message contains the provided text. A safer version
96+
of the example above would be:
97+
98+
~~~test_harness
99+
#[test]
100+
#[should_fail(expected = "index out of bounds")]
101+
fn test_out_of_bounds_failure() {
102+
let v: &[int] = &[];
103+
v[0];
104+
}
105+
~~~
106+
92107
A test runner built with the `--test` flag supports a limited set of
93108
arguments to control which tests are run:
94109

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/guide.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3681,8 +3681,8 @@ Here's the second note, which lets us know where the first borrow would be over.
36813681
This is useful, because if we wait to try to borrow `x` after this borrow is
36823682
over, then everything will work.
36833683

3684-
For more advanced patterns, please consult the [Lifetime
3685-
Guide](guide-lifetimes.html). You'll also learn what this type signature with
3684+
For more advanced patterns, please consult the [Ownership
3685+
Guide](guide-ownership.html). You'll also learn what this type signature with
36863686
the `'a` syntax is:
36873687

36883688
```{rust,ignore}

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,7 @@ An example of `use` declarations:
994994

995995
```
996996
use std::iter::range_step;
997-
use std::option::{Some, None};
997+
use std::option::Option::{Some, None};
998998
use std::collections::hash_map::{mod, HashMap};
999999
10001000
fn foo<T>(_: T){}
@@ -1004,8 +1004,8 @@ fn main() {
10041004
// Equivalent to 'std::iter::range_step(0u, 10u, 2u);'
10051005
range_step(0u, 10u, 2u);
10061006
1007-
// Equivalent to 'foo(vec![std::option::Some(1.0f64),
1008-
// std::option::None]);'
1007+
// Equivalent to 'foo(vec![std::option::Option::Some(1.0f64),
1008+
// std::option::Option::None]);'
10091009
foo(vec![Some(1.0f64), None]);
10101010
10111011
// Both `hash_map` and `HashMap` are in scope.
@@ -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/etc/unicode.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ def escape_char(c):
292292
def emit_bsearch_range_table(f):
293293
f.write("""
294294
fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool {
295-
use core::cmp::{Equal, Less, Greater};
295+
use core::cmp::Ordering::{Equal, Less, Greater};
296296
use core::slice::SlicePrelude;
297297
r.binary_search(|&(lo,hi)| {
298298
if lo <= c && c <= hi { Equal }
@@ -350,10 +350,11 @@ def emit_regex_module(f, cats, w_data):
350350
def emit_conversions_module(f, lowerupper, upperlower):
351351
f.write("pub mod conversions {")
352352
f.write("""
353-
use core::cmp::{Equal, Less, Greater};
353+
use core::cmp::Ordering::{Equal, Less, Greater};
354354
use core::slice::SlicePrelude;
355355
use core::tuple::Tuple2;
356-
use core::option::{Option, Some, None};
356+
use core::option::Option;
357+
use core::option::Option::{Some, None};
357358
use core::slice;
358359
359360
pub fn to_lower(c: char) -> char {
@@ -403,7 +404,7 @@ def emit_grapheme_module(f, grapheme_table, grapheme_cats):
403404
f.write(""" }
404405
405406
fn bsearch_range_value_table(c: char, r: &'static [(char, char, GraphemeCat)]) -> GraphemeCat {
406-
use core::cmp::{Equal, Less, Greater};
407+
use core::cmp::Ordering::{Equal, Less, Greater};
407408
match r.binary_search(|&(lo, hi, _)| {
408409
if lo <= c && c <= hi { Equal }
409410
else if hi < c { Less }
@@ -430,12 +431,13 @@ def emit_grapheme_module(f, grapheme_table, grapheme_cats):
430431

431432
def emit_charwidth_module(f, width_table):
432433
f.write("pub mod charwidth {\n")
433-
f.write(" use core::option::{Option, Some, None};\n")
434+
f.write(" use core::option::Option;\n")
435+
f.write(" use core::option::Option::{Some, None};\n")
434436
f.write(" use core::slice::SlicePrelude;\n")
435437
f.write(" use core::slice;\n")
436438
f.write("""
437439
fn bsearch_range_value_table(c: char, is_cjk: bool, r: &'static [(char, char, u8, u8)]) -> u8 {
438-
use core::cmp::{Equal, Less, Greater};
440+
use core::cmp::Ordering::{Equal, Less, Greater};
439441
match r.binary_search(|&(lo, hi, _, _)| {
440442
if lo <= c && c <= hi { Equal }
441443
else if hi < c { Less }
@@ -530,7 +532,7 @@ def comp_pfun(char):
530532

531533
f.write("""
532534
fn bsearch_range_value_table(c: char, r: &'static [(char, char, u8)]) -> u8 {
533-
use core::cmp::{Equal, Less, Greater};
535+
use core::cmp::Ordering::{Equal, Less, Greater};
534536
use core::slice::SlicePrelude;
535537
use core::slice;
536538
match r.binary_search(|&(lo, hi, _)| {

branches/snap-stage3/src/liballoc/arc.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ use core::kinds::{Sync, Send};
2222
use core::mem::{min_align_of, size_of, drop};
2323
use core::mem;
2424
use core::ops::{Drop, Deref};
25-
use core::option::{Some, None, Option};
25+
use core::option::Option;
26+
use core::option::Option::{Some, None};
2627
use core::ptr::RawPtr;
2728
use core::ptr;
2829
use heap::deallocate;
@@ -326,7 +327,8 @@ mod tests {
326327
use std::comm::channel;
327328
use std::mem::drop;
328329
use std::ops::Drop;
329-
use std::option::{Option, Some, None};
330+
use std::option::Option;
331+
use std::option::Option::{Some, None};
330332
use std::str::Str;
331333
use std::sync::atomic;
332334
use std::task;
@@ -521,7 +523,7 @@ mod tests {
521523
#[test]
522524
fn show_arc() {
523525
let a = Arc::new(5u32);
524-
assert!(format!("{}", a).as_slice() == "5")
526+
assert!(format!("{}", a) == "5")
525527
}
526528

527529
// Make sure deriving works with Arc<T>

branches/snap-stage3/src/liballoc/boxed.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ use core::kinds::Sized;
1919
use core::mem;
2020
use core::option::Option;
2121
use core::raw::TraitObject;
22-
use core::result::{Ok, Err, Result};
22+
use core::result::Result;
23+
use core::result::Result::{Ok, Err};
2324

2425
/// A value that represents the global exchange heap. This is the default
2526
/// place that the `box` keyword allocates into when no place is supplied.
@@ -169,14 +170,14 @@ mod test {
169170
let b = box Test as Box<Any>;
170171
let a_str = a.to_str();
171172
let b_str = b.to_str();
172-
assert_eq!(a_str.as_slice(), "Box<Any>");
173-
assert_eq!(b_str.as_slice(), "Box<Any>");
173+
assert_eq!(a_str, "Box<Any>");
174+
assert_eq!(b_str, "Box<Any>");
174175

175176
let a = &8u as &Any;
176177
let b = &Test as &Any;
177178
let s = format!("{}", a);
178-
assert_eq!(s.as_slice(), "&Any");
179+
assert_eq!(s, "&Any");
179180
let s = format!("{}", b);
180-
assert_eq!(s.as_slice(), "&Any");
181+
assert_eq!(s, "&Any");
181182
}
182183
}

branches/snap-stage3/src/liballoc/heap.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ mod imp {
177177

178178
#[cfg(all(not(external_funcs), not(external_crate), jemalloc))]
179179
mod imp {
180-
use core::option::{None, Option};
180+
use core::option::Option;
181+
use core::option::Option::None;
181182
use core::ptr::{null_mut, null};
182183
use core::num::Int;
183184
use libc::{c_char, c_int, c_void, size_t};

branches/snap-stage3/src/liballoc/rc.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,12 @@ use core::fmt;
149149
use core::kinds::marker;
150150
use core::mem::{transmute, min_align_of, size_of, forget};
151151
use core::ops::{Deref, Drop};
152-
use core::option::{Option, Some, None};
152+
use core::option::Option;
153+
use core::option::Option::{Some, None};
153154
use core::ptr;
154155
use core::ptr::RawPtr;
155-
use core::result::{Result, Ok, Err};
156+
use core::result::Result;
157+
use core::result::Result::{Ok, Err};
156158

157159
use heap::deallocate;
158160

@@ -739,8 +741,9 @@ impl<T> RcBoxPtr<T> for Weak<T> {
739741
mod tests {
740742
use super::{Rc, Weak, weak_count, strong_count};
741743
use std::cell::RefCell;
742-
use std::option::{Option, Some, None};
743-
use std::result::{Err, Ok};
744+
use std::option::Option;
745+
use std::option::Option::{Some, None};
746+
use std::result::Result::{Err, Ok};
744747
use std::mem::drop;
745748
use std::clone::Clone;
746749

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: 6 additions & 4 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.
@@ -485,7 +487,7 @@ impl<T: Ord> BinaryHeap<T> {
485487
let mut end = q.len();
486488
while end > 1 {
487489
end -= 1;
488-
q.data.as_mut_slice().swap(0, end);
490+
q.data.swap(0, end);
489491
q.siftdown_range(0, end)
490492
}
491493
q.into_vec()
@@ -769,8 +771,8 @@ mod tests {
769771
v.sort();
770772
data.sort();
771773

772-
assert_eq!(v.as_slice(), data.as_slice());
773-
assert_eq!(heap.into_sorted_vec().as_slice(), data.as_slice());
774+
assert_eq!(v, data);
775+
assert_eq!(heap.into_sorted_vec(), data);
774776
}
775777

776778
#[test]
@@ -812,7 +814,7 @@ mod tests {
812814
fn test_from_iter() {
813815
let xs = vec!(9u, 8, 7, 6, 5, 4, 3, 2, 1);
814816

815-
let mut q: BinaryHeap<uint> = xs.as_slice().iter().rev().map(|&x| x).collect();
817+
let mut q: BinaryHeap<uint> = xs.iter().rev().map(|&x| x).collect();
816818

817819
for &x in xs.iter() {
818820
assert_eq!(q.pop().unwrap(), x);

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,10 +1692,10 @@ mod tests {
16921692
#[test]
16931693
fn test_to_str() {
16941694
let zerolen = Bitv::new();
1695-
assert_eq!(zerolen.to_string().as_slice(), "");
1695+
assert_eq!(zerolen.to_string(), "");
16961696

16971697
let eightbits = Bitv::with_capacity(8u, false);
1698-
assert_eq!(eightbits.to_string().as_slice(), "00000000")
1698+
assert_eq!(eightbits.to_string(), "00000000")
16991699
}
17001700

17011701
#[test]
@@ -1718,7 +1718,7 @@ mod tests {
17181718
let mut b = bitv::Bitv::with_capacity(2, false);
17191719
b.set(0, true);
17201720
b.set(1, false);
1721-
assert_eq!(b.to_string().as_slice(), "10");
1721+
assert_eq!(b.to_string(), "10");
17221722
}
17231723

17241724
#[test]
@@ -2029,7 +2029,7 @@ mod tests {
20292029
fn test_from_bytes() {
20302030
let bitv = from_bytes(&[0b10110110, 0b00000000, 0b11111111]);
20312031
let str = format!("{}{}{}", "10110110", "00000000", "11111111");
2032-
assert_eq!(bitv.to_string().as_slice(), str.as_slice());
2032+
assert_eq!(bitv.to_string(), str);
20332033
}
20342034

20352035
#[test]
@@ -2048,7 +2048,7 @@ mod tests {
20482048
fn test_from_bools() {
20492049
let bools = vec![true, false, true, true];
20502050
let bitv: Bitv = bools.iter().map(|n| *n).collect();
2051-
assert_eq!(bitv.to_string().as_slice(), "1011");
2051+
assert_eq!(bitv.to_string(), "1011");
20522052
}
20532053

20542054
#[test]
@@ -2207,7 +2207,7 @@ mod tests {
22072207

22082208
let expected = [3, 5, 11, 77];
22092209
let actual = a.intersection(&b).collect::<Vec<uint>>();
2210-
assert_eq!(actual.as_slice(), expected.as_slice());
2210+
assert_eq!(actual, expected);
22112211
}
22122212

22132213
#[test]
@@ -2226,7 +2226,7 @@ mod tests {
22262226

22272227
let expected = [1, 5, 500];
22282228
let actual = a.difference(&b).collect::<Vec<uint>>();
2229-
assert_eq!(actual.as_slice(), expected.as_slice());
2229+
assert_eq!(actual, expected);
22302230
}
22312231

22322232
#[test]
@@ -2247,7 +2247,7 @@ mod tests {
22472247

22482248
let expected = [1, 5, 11, 14, 220];
22492249
let actual = a.symmetric_difference(&b).collect::<Vec<uint>>();
2250-
assert_eq!(actual.as_slice(), expected.as_slice());
2250+
assert_eq!(actual, expected);
22512251
}
22522252

22532253
#[test]
@@ -2272,7 +2272,7 @@ mod tests {
22722272

22732273
let expected = [1, 3, 5, 9, 11, 13, 19, 24, 160, 200];
22742274
let actual = a.union(&b).collect::<Vec<uint>>();
2275-
assert_eq!(actual.as_slice(), expected.as_slice());
2275+
assert_eq!(actual, expected);
22762276
}
22772277

22782278
#[test]
@@ -2660,7 +2660,7 @@ mod tests {
26602660
s.insert(10);
26612661
s.insert(50);
26622662
s.insert(2);
2663-
assert_eq!("{1, 2, 10, 50}".to_string(), s.to_string());
2663+
assert_eq!("{1, 2, 10, 50}", s.to_string());
26642664
}
26652665

26662666
fn rng() -> rand::IsaacRng {

0 commit comments

Comments
 (0)