Skip to content

Commit 4760768

Browse files
committed
---
yaml --- r: 225761 b: refs/heads/stable c: 400e955 h: refs/heads/master i: 225759: f7a0361 v: v3
1 parent 18d86d1 commit 4760768

File tree

168 files changed

+896
-641
lines changed

Some content is hidden

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

168 files changed

+896
-641
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ refs/heads/tmp: e5d90d98402475b6e154ce216f9efcb80da1a747
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: 1fe32ca12c51afcd761d9962f51a74ff0d07a591
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 91effb374c98927823b3032f7433e7b73a229f95
32+
refs/heads/stable: 400e955d8bbff8c3abc3c43c74fc255a70cf885e
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b

branches/stable/src/compiletest/runtest.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,8 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) {
285285
format!("--target={}", config.target),
286286
"-L".to_string(),
287287
aux_dir.to_str().unwrap().to_string());
288-
args.extend(split_maybe_args(&config.target_rustcflags).into_iter());
289-
args.extend(split_maybe_args(&props.compile_flags).into_iter());
288+
args.extend(split_maybe_args(&config.target_rustcflags));
289+
args.extend(split_maybe_args(&props.compile_flags));
290290
return ProcArgs {
291291
prog: config.rustc_path.to_str().unwrap().to_string(),
292292
args: args,
@@ -333,8 +333,8 @@ actual:\n\
333333
config.build_base.to_str().unwrap().to_string(),
334334
"-L".to_string(),
335335
aux_dir.to_str().unwrap().to_string());
336-
args.extend(split_maybe_args(&config.target_rustcflags).into_iter());
337-
args.extend(split_maybe_args(&props.compile_flags).into_iter());
336+
args.extend(split_maybe_args(&config.target_rustcflags));
337+
args.extend(split_maybe_args(&props.compile_flags));
338338
// FIXME (#9639): This needs to handle non-utf8 paths
339339
return ProcArgs {
340340
prog: config.rustc_path.to_str().unwrap().to_string(),
@@ -380,7 +380,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
380380
script_str.push_str(&format!("set solib-search-path \
381381
./{}/stage2/lib/rustlib/{}/lib/\n",
382382
config.host, config.target));
383-
for line in breakpoint_lines.iter() {
383+
for line in &breakpoint_lines {
384384
script_str.push_str(&format!("break {:?}:{}\n",
385385
testfile.file_name().unwrap()
386386
.to_string_lossy(),
@@ -1171,7 +1171,7 @@ fn document(config: &Config, props: &TestProps,
11711171
out_dir.to_str().unwrap().to_string(),
11721172
testfile.to_str().unwrap().to_string()];
11731173
args.extend(extra_args.iter().cloned());
1174-
args.extend(split_maybe_args(&props.compile_flags).into_iter());
1174+
args.extend(split_maybe_args(&props.compile_flags));
11751175
let args = ProcArgs {
11761176
prog: config.rustdoc_path.to_str().unwrap().to_string(),
11771177
args: args,
@@ -1236,7 +1236,7 @@ fn compose_and_run_compiler(config: &Config, props: &TestProps,
12361236
vec!("--crate-type=dylib".to_string())
12371237
}
12381238
};
1239-
crate_type.extend(extra_link_args.clone().into_iter());
1239+
crate_type.extend(extra_link_args.clone());
12401240
let aux_args =
12411241
make_compile_args(config,
12421242
&aux_props,
@@ -1334,11 +1334,11 @@ fn make_compile_args<F>(config: &Config,
13341334
};
13351335
args.push(path.to_str().unwrap().to_string());
13361336
if props.force_host {
1337-
args.extend(split_maybe_args(&config.host_rustcflags).into_iter());
1337+
args.extend(split_maybe_args(&config.host_rustcflags));
13381338
} else {
1339-
args.extend(split_maybe_args(&config.target_rustcflags).into_iter());
1339+
args.extend(split_maybe_args(&config.target_rustcflags));
13401340
}
1341-
args.extend(split_maybe_args(&props.compile_flags).into_iter());
1341+
args.extend(split_maybe_args(&props.compile_flags));
13421342
return ProcArgs {
13431343
prog: config.rustc_path.to_str().unwrap().to_string(),
13441344
args: args,
@@ -1373,7 +1373,7 @@ fn make_run_args(config: &Config, props: &TestProps, testfile: &Path)
13731373
args.push(exe_file.to_str().unwrap().to_string());
13741374

13751375
// Add the arguments in the run_flags directive
1376-
args.extend(split_maybe_args(&props.run_flags).into_iter());
1376+
args.extend(split_maybe_args(&props.run_flags));
13771377

13781378
let prog = args.remove(0);
13791379
return ProcArgs {
@@ -1683,7 +1683,7 @@ fn compile_test_and_save_ir(config: &Config, props: &TestProps,
16831683
aux_dir.to_str().unwrap().to_string());
16841684
let llvm_args = vec!("--emit=llvm-ir".to_string(),
16851685
"--crate-type=lib".to_string());
1686-
link_args.extend(llvm_args.into_iter());
1686+
link_args.extend(llvm_args);
16871687
let args = make_compile_args(config,
16881688
props,
16891689
link_args,

branches/stable/src/doc/complement-lang-faq.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,13 @@ You may also be interested in browsing [trending Rust repositories][github-rust]
3030

3131
## Is anyone using Rust in production?
3232

33-
Currently, Rust is still pre-1.0, and so we don't recommend that you use Rust
34-
in production unless you know exactly what you're getting into.
35-
36-
That said, there are two production deployments of Rust that we're aware of:
33+
Yes. For example (incomplete):
3734

3835
* [OpenDNS](http://labs.opendns.com/2013/10/04/zeromq-helping-us-block-malicious-domains/)
3936
* [Skylight](http://skylight.io)
40-
41-
Let the fact that this is an easily countable number be a warning.
37+
* [wit.ai](https://github.com/wit-ai/witd)
38+
* [Codius](https://codius.org/blog/codius-rust/)
39+
* [MaidSafe](http://maidsafe.net/)
4240

4341
## Does it run on Windows?
4442

branches/stable/src/doc/reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1550,7 +1550,7 @@ methods in such an implementation can only be used as direct calls on the
15501550
values of the type that the implementation targets. In such an implementation,
15511551
the trait type and `for` after `impl` are omitted. Such implementations are
15521552
limited to nominal types (enums, structs), and the implementation must appear
1553-
in the same module or a sub-module as the `self` type:
1553+
in the same crate as the `self` type:
15541554

15551555
```
15561556
struct Point {x: i32, y: i32}

branches/stable/src/doc/trpl/closures.md

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -324,37 +324,34 @@ first, it may seem strange, but we’ll figure it out. Here’s how you’d prob
324324
try to return a closure from a function:
325325

326326
```rust,ignore
327-
fn factory() -> (Fn(i32) -> Vec<i32>) {
328-
let vec = vec![1, 2, 3];
327+
fn factory() -> (Fn(i32) -> i32) {
328+
let num = 5;
329329
330-
|n| vec.push(n)
330+
|x| x + num
331331
}
332332
333333
let f = factory();
334334
335-
let answer = f(4);
336-
assert_eq!(vec![1, 2, 3, 4], answer);
335+
let answer = f(1);
336+
assert_eq!(6, answer);
337337
```
338338

339339
This gives us these long, related errors:
340340

341341
```text
342342
error: the trait `core::marker::Sized` is not implemented for the type
343-
`core::ops::Fn(i32) -> collections::vec::Vec<i32>` [E0277]
344-
f = factory();
345-
^
346-
note: `core::ops::Fn(i32) -> collections::vec::Vec<i32>` does not have a
347-
constant size known at compile-time
348-
f = factory();
349-
^
350-
error: the trait `core::marker::Sized` is not implemented for the type
351-
`core::ops::Fn(i32) -> collections::vec::Vec<i32>` [E0277]
352-
factory() -> (Fn(i32) -> Vec<i32>) {
353-
^~~~~~~~~~~~~~~~~~~~~
354-
note: `core::ops::Fn(i32) -> collections::vec::Vec<i32>` does not have a constant size known at compile-time
355-
factory() -> (Fn(i32) -> Vec<i32>) {
356-
^~~~~~~~~~~~~~~~~~~~~
357-
343+
`core::ops::Fn(i32) -> i32` [E0277]
344+
fn factory() -> (Fn(i32) -> i32) {
345+
^~~~~~~~~~~~~~~~
346+
note: `core::ops::Fn(i32) -> i32` does not have a constant size known at compile-time
347+
fn factory() -> (Fn(i32) -> i32) {
348+
^~~~~~~~~~~~~~~~
349+
error: the trait `core::marker::Sized` is not implemented for the type `core::ops::Fn(i32) -> i32` [E0277]
350+
let f = factory();
351+
^
352+
note: `core::ops::Fn(i32) -> i32` does not have a constant size known at compile-time
353+
let f = factory();
354+
^
358355
```
359356

360357
In order to return something from a function, Rust needs to know what
@@ -364,16 +361,16 @@ way to give something a size is to take a reference to it, as references
364361
have a known size. So we’d write this:
365362

366363
```rust,ignore
367-
fn factory() -> &(Fn(i32) -> Vec<i32>) {
368-
let vec = vec![1, 2, 3];
364+
fn factory() -> &(Fn(i32) -> i32) {
365+
let num = 5;
369366
370-
|n| vec.push(n)
367+
|x| x + num
371368
}
372369
373370
let f = factory();
374371
375-
let answer = f(4);
376-
assert_eq!(vec![1, 2, 3, 4], answer);
372+
let answer = f(1);
373+
assert_eq!(6, answer);
377374
```
378375

379376
But we get another error:
@@ -448,7 +445,8 @@ assert_eq!(6, answer);
448445
We use a trait object, by `Box`ing up the `Fn`. There’s just one last problem:
449446

450447
```text
451-
error: `num` does not live long enough
448+
error: closure may outlive the current function, but it borrows `num`,
449+
which is owned by the current function [E0373]
452450
Box::new(|x| x + num)
453451
^~~~~~~~~~~
454452
```

branches/stable/src/error-index-generator/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ r##"<!DOCTYPE html>
7373

7474
try!(write!(&mut output_file, "<h1>Rust Compiler Error Index</h1>\n"));
7575

76-
for (err_code, info) in err_map.iter() {
76+
for (err_code, info) in err_map {
7777
// Enclose each error in a div so they can be shown/hidden en masse.
7878
let desc_desc = match info.description {
7979
Some(_) => "error-described",

branches/stable/src/libarena/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ impl<'longer_than_self> Drop for Arena<'longer_than_self> {
127127
fn drop(&mut self) {
128128
unsafe {
129129
destroy_chunk(&*self.head.borrow());
130-
for chunk in &*self.chunks.borrow() {
130+
for chunk in self.chunks.borrow().iter() {
131131
if !chunk.is_copy.get() {
132132
destroy_chunk(chunk);
133133
}

branches/stable/src/libcollections/binary_heap.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
//!
8686
//! // For each node we can reach, see if we can find a way with
8787
//! // a lower cost going through this node
88-
//! for edge in adj_list[position].iter() {
88+
//! for edge in &adj_list[position] {
8989
//! let next = State { cost: cost + edge.cost, position: edge.node };
9090
//!
9191
//! // If so, add it to the frontier and continue
@@ -450,7 +450,7 @@ impl<T: Ord> BinaryHeap<T> {
450450
/// let vec = heap.into_vec();
451451
///
452452
/// // Will print in some order
453-
/// for x in vec.iter() {
453+
/// for x in vec {
454454
/// println!("{}", x);
455455
/// }
456456
/// ```

branches/stable/src/libcollections/bit.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,9 @@ impl BitVec {
266266
/// # #![feature(collections)]
267267
/// use std::collections::BitVec;
268268
///
269-
/// let mut bv = BitVec::from_elem(10, false);
269+
/// let bv = BitVec::from_elem(10, false);
270270
/// assert_eq!(bv.len(), 10);
271-
/// for x in bv.iter() {
271+
/// for x in &bv {
272272
/// assert_eq!(x, false);
273273
/// }
274274
/// ```
@@ -1245,7 +1245,7 @@ impl<'a> IntoIterator for &'a BitVec {
12451245
/// s.union_with(&other);
12461246
///
12471247
/// // Print 0, 1, 3 in some order
1248-
/// for x in s.iter() {
1248+
/// for x in &s {
12491249
/// println!("{}", x);
12501250
/// }
12511251
///
@@ -1370,7 +1370,7 @@ impl BitSet {
13701370
/// let s = BitSet::from_bit_vec(bv);
13711371
///
13721372
/// // Print 1, 2 in arbitrary order
1373-
/// for x in s.iter() {
1373+
/// for x in &s {
13741374
/// println!("{}", x);
13751375
/// }
13761376
/// ```

branches/stable/src/libcollections/borrow.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use core::ops::Deref;
2121
use core::option::Option;
2222

2323
use fmt;
24-
use alloc::{rc, arc};
24+
use alloc::{boxed, rc, arc};
2525

2626
use self::Cow::*;
2727

@@ -116,6 +116,14 @@ impl<'a, T: ?Sized> BorrowMut<T> for &'a mut T {
116116
fn borrow_mut(&mut self) -> &mut T { &mut **self }
117117
}
118118

119+
impl<T: ?Sized> Borrow<T> for boxed::Box<T> {
120+
fn borrow(&self) -> &T { &**self }
121+
}
122+
123+
impl<T: ?Sized> BorrowMut<T> for boxed::Box<T> {
124+
fn borrow_mut(&mut self) -> &mut T { &mut **self }
125+
}
126+
119127
impl<T: ?Sized> Borrow<T> for rc::Rc<T> {
120128
fn borrow(&self) -> &T { &**self }
121129
}

branches/stable/src/libcollections/btree/map.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,7 @@ impl<K: Ord, V> Default for BTreeMap<K, V> {
907907
impl<K: PartialEq, V: PartialEq> PartialEq for BTreeMap<K, V> {
908908
fn eq(&self, other: &BTreeMap<K, V>) -> bool {
909909
self.len() == other.len() &&
910-
self.iter().zip(other.iter()).all(|(a, b)| a == b)
910+
self.iter().zip(other).all(|(a, b)| a == b)
911911
}
912912
}
913913

@@ -1544,7 +1544,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
15441544
/// for (_, balance) in map.range_mut(Included(&"B"), Excluded(&"Cheryl")) {
15451545
/// *balance += 100;
15461546
/// }
1547-
/// for (name, balance) in map.iter() {
1547+
/// for (name, balance) in &map {
15481548
/// println!("{} => {}", name, balance);
15491549
/// }
15501550
/// ```

branches/stable/src/libcollections/linked_list.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ impl<T> LinkedList<T> {
265265
///
266266
/// a.append(&mut b);
267267
///
268-
/// for e in a.iter() {
268+
/// for e in &a {
269269
/// println!("{}", e); // prints 1, then 2, then 3, then 4
270270
/// }
271271
/// println!("{}", b.len()); // prints 0
@@ -1189,7 +1189,7 @@ mod tests {
11891189
check_links(&m);
11901190

11911191
let mut i = 0;
1192-
for (a, &b) in m.into_iter().zip(v.iter()) {
1192+
for (a, &b) in m.into_iter().zip(&v) {
11931193
i += 1;
11941194
assert_eq!(a, b);
11951195
}

branches/stable/src/libcollections/slice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@ impl<T> [T] {
971971
reason = "uncertain about this API approach")]
972972
#[inline]
973973
pub fn move_from(&mut self, mut src: Vec<T>, start: usize, end: usize) -> usize {
974-
for (a, b) in self.iter_mut().zip(src[start .. end].iter_mut()) {
974+
for (a, b) in self.iter_mut().zip(&mut src[start .. end]) {
975975
mem::swap(a, b);
976976
}
977977
cmp::min(self.len(), end-start)

0 commit comments

Comments
 (0)