Skip to content

Commit 6511064

Browse files
committed
auto merge of #17127 : alexcrichton/rust/rollup, r=alexcrichton
2 parents b625d43 + e5abe15 commit 6511064

File tree

78 files changed

+671
-348
lines changed

Some content is hidden

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

78 files changed

+671
-348
lines changed

configure

+1-1
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ then
707707
| cut -d ' ' -f 2)
708708

709709
case $CFG_CLANG_VERSION in
710-
(3.0svn | 3.0 | 3.1* | 3.2* | 3.3* | 3.4* | 3.5* )
710+
(3.0svn | 3.0 | 3.1* | 3.2* | 3.3* | 3.4* | 3.5* | 3.6*)
711711
step_msg "found ok version of CLANG: $CFG_CLANG_VERSION"
712712
if [ -z "$CC" ]
713713
then

src/doc/guide.md

+2-11
Original file line numberDiff line numberDiff line change
@@ -520,10 +520,8 @@ error: aborting due to previous error
520520
Could not compile `hello_world`.
521521
```
522522

523-
Rust will not let us use a value that has not been initialized. So why let us
524-
declare a binding without initializing it? You'd think our first example would
525-
have errored. Well, Rust is smarter than that. Before we get to that, let's talk
526-
about this stuff we've added to `println!`.
523+
Rust will not let us use a value that has not been initialized. Next, let's
524+
talk about this stuff we've added to `println!`.
527525

528526
If you include two curly braces (`{}`, some call them moustaches...) in your
529527
string to print, Rust will interpret this as a request to interpolate some sort
@@ -538,12 +536,6 @@ format in a more detailed manner, there are a [wide number of options
538536
available](std/fmt/index.html). For now, we'll just stick to the default:
539537
integers aren't very complicated to print.
540538

541-
So, we've cleared up all of the confusion around bindings, with one exception:
542-
why does Rust let us declare a variable binding without an initial value if we
543-
must initialize the binding before we use it? And how does it know that we have
544-
or have not initialized the binding? For that, we need to learn our next
545-
concept: `if`.
546-
547539
# If
548540

549541
Rust's take on `if` is not particularly complex, but it's much more like the
@@ -582,7 +574,6 @@ if x == 5i {
582574

583575
This is all pretty standard. However, you can also do this:
584576

585-
586577
```
587578
let x = 5i;
588579

src/doc/rust.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -3290,17 +3290,19 @@ between `_` and `..` is that the pattern `C(_)` is only type-correct if `C` has
32903290
exactly one argument, while the pattern `C(..)` is type-correct for any enum
32913291
variant `C`, regardless of how many arguments `C` has.
32923292

3293-
Used inside a vector pattern, `..` stands for any number of elements. This
3294-
wildcard can be used at most once for a given vector, which implies that it
3295-
cannot be used to specifically match elements that are at an unknown distance
3296-
from both ends of a vector, like `[.., 42, ..]`. If followed by a variable name,
3297-
it will bind the corresponding slice to the variable. Example:
3293+
Used inside a vector pattern, `..` stands for any number of elements, when the
3294+
`advanced_slice_patterns` feature gate is turned on. This wildcard can be used
3295+
at most once for a given vector, which implies that it cannot be used to
3296+
specifically match elements that are at an unknown distance from both ends of a
3297+
vector, like `[.., 42, ..]`. If followed by a variable name, it will bind the
3298+
corresponding slice to the variable. Example:
32983299

32993300
~~~~
3301+
# #![feature(advanced_slice_patterns)]
33003302
fn is_symmetric(list: &[uint]) -> bool {
33013303
match list {
33023304
[] | [_] => true,
3303-
[x, ..inside, y] if x == y => is_symmetric(inside),
3305+
[x, inside.., y] if x == y => is_symmetric(inside),
33043306
_ => false
33053307
}
33063308
}

src/doc/tutorial.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1707,7 +1707,7 @@ let score = match numbers {
17071707
[] => 0,
17081708
[a] => a * 10,
17091709
[a, b] => a * 6 + b * 4,
1710-
[a, b, c, ..rest] => a * 5 + b * 3 + c * 2 + rest.len() as int
1710+
[a, b, c, rest..] => a * 5 + b * 3 + c * 2 + rest.len() as int
17111711
};
17121712
~~~~
17131713

src/etc/licenseck.py

+3
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,15 @@
4343
"libsync/mpmc_bounded_queue.rs", # BSD
4444
"libsync/mpsc_intrusive.rs", # BSD
4545
"test/bench/shootout-binarytrees.rs", # BSD
46+
"test/bench/shootout-chameneos-redux.rs", # BSD
4647
"test/bench/shootout-fannkuch-redux.rs", # BSD
4748
"test/bench/shootout-k-nucleotide.rs", # BSD
4849
"test/bench/shootout-mandelbrot.rs", # BSD
4950
"test/bench/shootout-meteor.rs", # BSD
51+
"test/bench/shootout-nbody.rs", # BSD
5052
"test/bench/shootout-pidigits.rs", # BSD
5153
"test/bench/shootout-regex-dna.rs", # BSD
54+
"test/bench/shootout-reverse-complement.rs", # BSD
5255
"test/bench/shootout-threadring.rs", # BSD
5356
]
5457

src/libarena/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,7 @@ mod tests {
509509
use self::test::Bencher;
510510
use super::{Arena, TypedArena};
511511

512+
#[allow(dead_code)]
512513
struct Point {
513514
x: int,
514515
y: int,
@@ -564,6 +565,7 @@ mod tests {
564565
})
565566
}
566567

568+
#[allow(dead_code)]
567569
struct Noncopy {
568570
string: String,
569571
array: Vec<int>,

src/libcollections/slice.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,7 @@ mod tests {
864864
}
865865

866866
#[test]
867+
#[allow(deprecated)]
867868
fn test_tailn() {
868869
let mut a = vec![11i, 12, 13];
869870
let b: &[int] = &[11, 12, 13];
@@ -875,6 +876,7 @@ mod tests {
875876

876877
#[test]
877878
#[should_fail]
879+
#[allow(deprecated)]
878880
fn test_tailn_empty() {
879881
let a: Vec<int> = vec![];
880882
a.tailn(2);
@@ -909,6 +911,7 @@ mod tests {
909911

910912
#[test]
911913
#[should_fail]
914+
#[allow(deprecated)]
912915
fn test_initn_empty() {
913916
let a: Vec<int> = vec![];
914917
a.as_slice().initn(2);
@@ -1466,6 +1469,7 @@ mod tests {
14661469
}
14671470

14681471
#[test]
1472+
#[allow(deprecated)]
14691473
fn test_unshift() {
14701474
let mut x = vec![1i, 2, 3];
14711475
x.unshift(0);
@@ -2079,6 +2083,7 @@ mod tests {
20792083
}
20802084

20812085
#[test]
2086+
#[allow(deprecated)]
20822087
fn test_shift_ref() {
20832088
let mut x: &[int] = [1, 2, 3, 4, 5];
20842089
let h = x.shift_ref();
@@ -2092,6 +2097,7 @@ mod tests {
20922097
}
20932098

20942099
#[test]
2100+
#[allow(deprecated)]
20952101
fn test_pop_ref() {
20962102
let mut x: &[int] = [1, 2, 3, 4, 5];
20972103
let h = x.pop_ref();
@@ -2171,6 +2177,7 @@ mod tests {
21712177
}
21722178

21732179
#[test]
2180+
#[allow(deprecated)]
21742181
fn test_mut_shift_ref() {
21752182
let mut x: &mut [int] = [1, 2, 3, 4, 5];
21762183
let h = x.mut_shift_ref();
@@ -2184,6 +2191,7 @@ mod tests {
21842191
}
21852192

21862193
#[test]
2194+
#[allow(deprecated)]
21872195
fn test_mut_pop_ref() {
21882196
let mut x: &mut [int] = [1, 2, 3, 4, 5];
21892197
let h = x.mut_pop_ref();
@@ -2441,7 +2449,7 @@ mod bench {
24412449
b.iter(|| {
24422450
v.sort();
24432451
});
2444-
b.bytes = (v.len() * mem::size_of_val(v.get(0))) as u64;
2452+
b.bytes = (v.len() * mem::size_of_val(&v[0])) as u64;
24452453
}
24462454

24472455
type BigSortable = (u64,u64,u64,u64);
@@ -2485,6 +2493,6 @@ mod bench {
24852493
b.iter(|| {
24862494
v.sort();
24872495
});
2488-
b.bytes = (v.len() * mem::size_of_val(v.get(0))) as u64;
2496+
b.bytes = (v.len() * mem::size_of_val(&v[0])) as u64;
24892497
}
24902498
}

src/libcore/iter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2185,7 +2185,7 @@ pub type Iterate<'a, T> = Unfold<'a, T, IterateState<'a, T>>;
21852185
/// Creates a new iterator that produces an infinite sequence of
21862186
/// repeated applications of the given function `f`.
21872187
#[allow(visible_private_types)]
2188-
pub fn iterate<'a, T: Clone>(f: |T|: 'a -> T, seed: T) -> Iterate<'a, T> {
2188+
pub fn iterate<'a, T: Clone>(seed: T, f: |T|: 'a -> T) -> Iterate<'a, T> {
21892189
Unfold::new((f, Some(seed), true), |st| {
21902190
let &(ref mut f, ref mut val, ref mut first) = st;
21912191
if *first {

src/libcore/ops.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@
5555
*
5656
*/
5757

58+
use kinds::Sized;
59+
5860
/**
5961
*
6062
* The `Drop` trait is used to run some code when a value goes out of scope. This
@@ -700,7 +702,7 @@ pub trait IndexMut<Index,Result> {
700702
* ```
701703
*/
702704
#[lang="deref"]
703-
pub trait Deref<Result> {
705+
pub trait Deref<Sized? Result> {
704706
/// The method called to dereference a value
705707
fn deref<'a>(&'a self) -> &'a Result;
706708
}
@@ -740,7 +742,7 @@ pub trait Deref<Result> {
740742
* ```
741743
*/
742744
#[lang="deref_mut"]
743-
pub trait DerefMut<Result>: Deref<Result> {
745+
pub trait DerefMut<Sized? Result>: Deref<Result> {
744746
/// The method called to mutably dereference a value
745747
fn deref_mut<'a>(&'a mut self) -> &'a mut Result;
746748
}

src/libcoretest/any.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -51,61 +51,61 @@ fn any_owning() {
5151
}
5252

5353
#[test]
54-
fn any_as_ref() {
54+
fn any_downcast_ref() {
5555
let a = &5u as &Any;
5656

57-
match a.as_ref::<uint>() {
57+
match a.downcast_ref::<uint>() {
5858
Some(&5) => {}
5959
x => fail!("Unexpected value {}", x)
6060
}
6161

62-
match a.as_ref::<Test>() {
62+
match a.downcast_ref::<Test>() {
6363
None => {}
6464
x => fail!("Unexpected value {}", x)
6565
}
6666
}
6767

6868
#[test]
69-
fn any_as_mut() {
69+
fn any_downcast_mut() {
7070
let mut a = 5u;
7171
let mut b = box 7u;
7272

7373
let a_r = &mut a as &mut Any;
7474
let tmp: &mut uint = &mut *b;
7575
let b_r = tmp as &mut Any;
7676

77-
match a_r.as_mut::<uint>() {
77+
match a_r.downcast_mut::<uint>() {
7878
Some(x) => {
7979
assert_eq!(*x, 5u);
8080
*x = 612;
8181
}
8282
x => fail!("Unexpected value {}", x)
8383
}
8484

85-
match b_r.as_mut::<uint>() {
85+
match b_r.downcast_mut::<uint>() {
8686
Some(x) => {
8787
assert_eq!(*x, 7u);
8888
*x = 413;
8989
}
9090
x => fail!("Unexpected value {}", x)
9191
}
9292

93-
match a_r.as_mut::<Test>() {
93+
match a_r.downcast_mut::<Test>() {
9494
None => (),
9595
x => fail!("Unexpected value {}", x)
9696
}
9797

98-
match b_r.as_mut::<Test>() {
98+
match b_r.downcast_mut::<Test>() {
9999
None => (),
100100
x => fail!("Unexpected value {}", x)
101101
}
102102

103-
match a_r.as_mut::<uint>() {
103+
match a_r.downcast_mut::<uint>() {
104104
Some(&612) => {}
105105
x => fail!("Unexpected value {}", x)
106106
}
107107

108-
match b_r.as_mut::<uint>() {
108+
match b_r.downcast_mut::<uint>() {
109109
Some(&413) => {}
110110
x => fail!("Unexpected value {}", x)
111111
}
@@ -121,11 +121,11 @@ fn any_fixed_vec() {
121121

122122

123123
#[bench]
124-
fn bench_as_ref(b: &mut Bencher) {
124+
fn bench_downcast_ref(b: &mut Bencher) {
125125
b.iter(|| {
126126
let mut x = 0i;
127127
let mut y = &mut x as &mut Any;
128128
test::black_box(&mut y);
129-
test::black_box(y.as_ref::<int>() == Some(&0));
129+
test::black_box(y.downcast_ref::<int>() == Some(&0));
130130
});
131131
}

src/libcoretest/iter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ fn test_min_max_result() {
839839

840840
#[test]
841841
fn test_iterate() {
842-
let mut it = iterate(|x| x * 2, 1u);
842+
let mut it = iterate(1u, |x| x * 2);
843843
assert_eq!(it.next(), Some(1u));
844844
assert_eq!(it.next(), Some(2u));
845845
assert_eq!(it.next(), Some(4u));

src/libcoretest/option.rs

+3
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ fn test_or_else() {
131131
}
132132

133133
#[test]
134+
#[allow(deprecated)]
134135
fn test_option_while_some() {
135136
let mut i = 0i;
136137
Some(10i).while_some(|j| {
@@ -184,6 +185,7 @@ fn test_unwrap_or_else() {
184185
}
185186

186187
#[test]
188+
#[allow(deprecated)]
187189
fn test_filtered() {
188190
let some_stuff = Some(42i);
189191
let modified_stuff = some_stuff.filtered(|&x| {x < 10});
@@ -256,6 +258,7 @@ fn test_mutate() {
256258
}
257259

258260
#[test]
261+
#[allow(deprecated)]
259262
fn test_collect() {
260263
let v: Option<Vec<int>> = collect(range(0i, 0)
261264
.map(|_| Some(0i)));

src/libcoretest/result.rs

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ pub fn test_impl_map_err() {
6969
}
7070

7171
#[test]
72+
#[allow(deprecated)]
7273
fn test_collect() {
7374
let v: Result<Vec<int>, ()> = collect(range(0i, 0).map(|_| Ok::<int, ()>(0)));
7475
assert!(v == Ok(vec![]));

src/libdebug/repr.rs

+1
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,7 @@ pub fn repr_to_string<T>(t: &T) -> String {
568568
}
569569

570570
#[cfg(test)]
571+
#[allow(dead_code)]
571572
struct P {a: int, b: f64}
572573

573574
#[test]

src/libgraphviz/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -632,9 +632,9 @@ mod tests {
632632
id_name(n)
633633
}
634634
fn node_label(&'a self, n: &Node) -> LabelText<'a> {
635-
match self.node_labels.get(*n) {
636-
&Some(ref l) => LabelStr(str::Slice(l.as_slice())),
637-
&None => LabelStr(id_name(n).name()),
635+
match self.node_labels[*n] {
636+
Some(ref l) => LabelStr(str::Slice(l.as_slice())),
637+
None => LabelStr(id_name(n).name()),
638638
}
639639
}
640640
fn edge_label(&'a self, e: & &'a Edge) -> LabelText<'a> {

src/libgreen/sched.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1414,6 +1414,7 @@ mod test {
14141414
// Regression test that the `start` task entrypoint can
14151415
// contain dtors that use task resources
14161416
run(proc() {
1417+
#[allow(dead_code)]
14171418
struct S { field: () }
14181419

14191420
impl Drop for S {

0 commit comments

Comments
 (0)