Skip to content

Commit 8b591da

Browse files
committed
---
yaml --- r: 207071 b: refs/heads/master c: e4d56b7 h: refs/heads/master i: 207069: 52e02d1 207067: e11d36e 207063: c65c7a1 207055: 73d3a85 207039: 2b82abf v: v3
1 parent 0a4d30c commit 8b591da

29 files changed

+71
-30
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: f47cb0ecfbf396609eb7e0ac893aabc4c122a84c
2+
refs/heads/master: e4d56b7b5b68cd5cfb4bb65f974af701ab556241
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 857ef6e272e5634cb9f3e6ee50eb6bc2a2e71651
55
refs/heads/try: 7b4ef47b7805a402d756fb8157101f64880a522f

trunk/AUTHORS.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Aaron Raimist <[email protected]>
88
Aaron Todd <[email protected]>
99
Aaron Turon <[email protected]>
1010
Aaron Weiss <[email protected]>
11-
Abhishek Chanda <abhishek@cloudscaling.com>
11+
Abhishek Chanda <abhishek.becs@gmail.com>
1212
Adam Bozanich <[email protected]>
1313
Adam Jacob <[email protected]>
1414
Adam Roben <[email protected]>

trunk/src/doc/complement-lang-faq.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
There aren't many large programs yet. The Rust [compiler][rustc], 60,000+ lines at the time of writing, is written in Rust. As the oldest body of Rust code it has gone through many iterations of the language, and some parts are nicer to look at than others. It may not be the best code to learn from, but [borrowck] and [resolve] were written recently.
66

77
[rustc]: https://github.com/rust-lang/rust/tree/master/src/librustc
8-
[resolve]: https://github.com/rust-lang/rust/blob/master/src/librustc/middle/resolve.rs
9-
[borrowck]: https://github.com/rust-lang/rust/blob/master/src/librustc/middle/borrowck/
8+
[resolve]: https://github.com/rust-lang/rust/tree/master/src/librustc_resolve
9+
[borrowck]: https://github.com/rust-lang/rust/tree/master/src/librustc_borrowck/borrowck
1010

1111
A research browser engine called [Servo][servo], currently 30,000+ lines across more than a dozen crates, will be exercising a lot of Rust's distinctive type-system and concurrency features, and integrating many native libraries.
1212

@@ -20,8 +20,8 @@ Some examples that demonstrate different aspects of the language:
2020
* The standard library's [json] module. Enums and pattern matching
2121

2222
[sprocketnes]: https://github.com/pcwalton/sprocketnes
23-
[hash]: https://github.com/rust-lang/rust/blob/master/src/libstd/hash/mod.rs
24-
[HashMap]: https://github.com/rust-lang/rust/blob/master/src/libcollections/hashmap.rs
23+
[hash]: https://github.com/rust-lang/rust/tree/master/src/libcore/hash
24+
[HashMap]: https://github.com/rust-lang/rust/tree/master/src/libstd/collections/hash
2525
[json]: https://github.com/rust-lang/rust/blob/master/src/libserialize/json.rs
2626

2727
You may also be interested in browsing [trending Rust repositories][github-rust] on GitHub.

trunk/src/doc/trpl/dining-philosophers.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ from the standard library, and so we need to `use` it.
320320
We now print out two messages, with a `sleep_ms()` in the middle. This will
321321
simulate the time it takes a philosopher to eat.
322322

323-
If you run this program, You should see each philosopher eat in turn:
323+
If you run this program, you should see each philosopher eat in turn:
324324

325325
```text
326326
Baruch Spinoza is eating.
@@ -480,7 +480,7 @@ struct Table {
480480
}
481481
```
482482

483-
This `Table` has an vector of `Mutex`es. A mutex is a way to control
483+
This `Table` has a vector of `Mutex`es. A mutex is a way to control
484484
concurrency: only one thread can access the contents at once. This is exactly
485485
the property we need with our forks. We use an empty tuple, `()`, inside the
486486
mutex, since we’re not actually going to use the value, just hold onto it.

trunk/src/doc/trpl/installing-rust.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ $ sh rustup.sh
2323
If you're on Windows, please download either the [32-bit installer][win32] or
2424
the [64-bit installer][win64] and run it.
2525

26-
[win32]: https://static.rust-lang.org/dist/rust-1.0.0-beta-i686-pc-windows-gnu.msi
27-
[win64]: https://static.rust-lang.org/dist/rust-1.0.0-beta-x86_64-pc-windows-gnu.msi
26+
[win32]: https://static.rust-lang.org/dist/rust-1.0.0-i686-pc-windows-gnu.msi
27+
[win64]: https://static.rust-lang.org/dist/rust-1.0.0-x86_64-pc-windows-gnu.msi
2828

2929
## Uninstalling
3030

@@ -74,7 +74,7 @@ $ rustc --version
7474
You should see the version number, commit hash, commit date and build date:
7575

7676
```bash
77-
rustc 1.0.0-beta (9854143cb 2015-04-02) (built 2015-04-02)
77+
rustc 1.0.0 (a59de37e9 2015-05-13) (built 2015-05-14)
7878
```
7979

8080
If you did, Rust has been installed successfully! Congrats!

trunk/src/doc/trpl/rust-inside-other-languages.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ fn process() {
104104
let handles: Vec<_> = (0..10).map(|_| {
105105
thread::spawn(|| {
106106
let mut _x = 0;
107-
for _ in (0..5_000_001) {
107+
for _ in (0..5_000_000) {
108108
_x += 1
109109
}
110110
})

trunk/src/doc/trpl/strings.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ Rust has two main types of strings: `&str` and `String`. Let’s talk about
1616
`&'static str`:
1717

1818
```rust
19-
let string = "Hello there."; // string: &'static str
19+
let greeting = "Hello there."; // greeting: &'static str
2020
```
2121

2222
This string is statically allocated, meaning that it’s saved inside our
23-
compiled program, and exists for the entire duration it runs. The `string`
23+
compiled program, and exists for the entire duration it runs. The `greeting`
2424
binding is a reference to this statically allocated string. String slices
2525
have a fixed size, and cannot be mutated.
2626

trunk/src/libcollections/string.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ impl String {
433433
///
434434
/// ```
435435
/// let mut s = String::new();
436-
/// s.reserve(10);
436+
/// s.reserve_exact(10);
437437
/// assert!(s.capacity() >= 10);
438438
/// ```
439439
#[inline]

trunk/src/libstd/collections/hash/map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ impl<K, V, S> HashMap<K, V, S>
539539
{
540540
/// Creates an empty hashmap which will use the given hasher to hash keys.
541541
///
542-
/// The creates map has the default initial capacity.
542+
/// The created map has the default initial capacity.
543543
///
544544
/// # Examples
545545
///

trunk/src/libstd/ffi/c_str.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ use vec::Vec;
5353
/// fn my_printer(s: *const libc::c_char);
5454
/// }
5555
///
56-
/// let to_print = &b"Hello, world!"[..];
57-
/// let c_to_print = CString::new(to_print).unwrap();
56+
/// let c_to_print = CString::new("Hello, world!").unwrap();
5857
/// unsafe {
5958
/// my_printer(c_to_print.as_ptr());
6059
/// }

trunk/src/libstd/fs.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,20 +1099,19 @@ pub fn remove_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> {
10991099
/// # Examples
11001100
///
11011101
/// ```
1102-
/// # #![feature(path_ext)]
11031102
/// use std::io;
1104-
/// use std::fs::{self, PathExt, DirEntry};
1103+
/// use std::fs::{self, DirEntry};
11051104
/// use std::path::Path;
11061105
///
11071106
/// // one possible implementation of fs::walk_dir only visiting files
1108-
/// fn visit_dirs(dir: &Path, cb: &mut FnMut(DirEntry)) -> io::Result<()> {
1109-
/// if dir.is_dir() {
1107+
/// fn visit_dirs(dir: &Path, cb: &Fn(&DirEntry)) -> io::Result<()> {
1108+
/// if try!(fs::metadata(dir)).is_dir() {
11101109
/// for entry in try!(fs::read_dir(dir)) {
11111110
/// let entry = try!(entry);
1112-
/// if entry.path().is_dir() {
1111+
/// if try!(fs::metadata(entry.path())).is_dir() {
11131112
/// try!(visit_dirs(&entry.path(), cb));
11141113
/// } else {
1115-
/// cb(entry);
1114+
/// cb(&entry);
11161115
/// }
11171116
/// }
11181117
/// }

trunk/src/libstd/net/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use sys_common::net as net_imp;
1919

2020
pub use self::ip::{IpAddr, Ipv4Addr, Ipv6Addr, Ipv6MulticastScope};
2121
pub use self::addr::{SocketAddr, SocketAddrV4, SocketAddrV6, ToSocketAddrs};
22-
pub use self::tcp::{TcpStream, TcpListener};
22+
pub use self::tcp::{TcpStream, TcpListener, Incoming};
2323
pub use self::udp::UdpSocket;
2424
pub use self::parser::AddrParseError;
2525

trunk/src/libstd/path.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,7 +1485,7 @@ impl Path {
14851485
iter_after(self.components().rev(), child.as_ref().components().rev()).is_some()
14861486
}
14871487

1488-
/// Extracts the stem (non-extension) portion of `self.file()`.
1488+
/// Extracts the stem (non-extension) portion of `self.file_name()`.
14891489
///
14901490
/// The stem is:
14911491
///
@@ -1508,7 +1508,7 @@ impl Path {
15081508
self.file_name().map(split_file_at_dot).and_then(|(before, after)| before.or(after))
15091509
}
15101510

1511-
/// Extracts the extension of `self.file()`, if possible.
1511+
/// Extracts the extension of `self.file_name()`, if possible.
15121512
///
15131513
/// The extension is:
15141514
///

trunk/src/libsyntax/ext/deriving/clone.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ pub fn expand_deriving_clone(cx: &mut ExtCtxt,
3939
args: Vec::new(),
4040
ret_ty: Self_,
4141
attributes: attrs,
42+
is_unsafe: false,
4243
combine_substructure: combine_substructure(Box::new(|c, s, sub| {
4344
cs_clone("Clone", c, s, sub)
4445
})),

trunk/src/libsyntax/ext/deriving/cmp/eq.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ pub fn expand_deriving_eq(cx: &mut ExtCtxt,
5959
args: vec!(),
6060
ret_ty: nil_ty(),
6161
attributes: attrs,
62+
is_unsafe: false,
6263
combine_substructure: combine_substructure(Box::new(|a, b, c| {
6364
cs_total_eq_assert(a, b, c)
6465
}))

trunk/src/libsyntax/ext/deriving/cmp/ord.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ pub fn expand_deriving_ord(cx: &mut ExtCtxt,
4040
args: vec!(borrowed_self()),
4141
ret_ty: Literal(path_std!(cx, core::cmp::Ordering)),
4242
attributes: attrs,
43+
is_unsafe: false,
4344
combine_substructure: combine_substructure(Box::new(|a, b, c| {
4445
cs_cmp(a, b, c)
4546
})),

trunk/src/libsyntax/ext/deriving/cmp/partial_eq.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ pub fn expand_deriving_partial_eq(cx: &mut ExtCtxt,
7171
args: vec!(borrowed_self()),
7272
ret_ty: Literal(path_local!(bool)),
7373
attributes: attrs,
74+
is_unsafe: false,
7475
combine_substructure: combine_substructure(Box::new(|a, b, c| {
7576
$f(a, b, c)
7677
}))

trunk/src/libsyntax/ext/deriving/cmp/partial_ord.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ pub fn expand_deriving_partial_ord(cx: &mut ExtCtxt,
3737
args: vec!(borrowed_self()),
3838
ret_ty: Literal(path_local!(bool)),
3939
attributes: attrs,
40+
is_unsafe: false,
4041
combine_substructure: combine_substructure(Box::new(|cx, span, substr| {
4142
cs_op($op, $equal, cx, span, substr)
4243
}))
@@ -60,6 +61,7 @@ pub fn expand_deriving_partial_ord(cx: &mut ExtCtxt,
6061
args: vec![borrowed_self()],
6162
ret_ty: ret_ty,
6263
attributes: attrs,
64+
is_unsafe: false,
6365
combine_substructure: combine_substructure(Box::new(|cx, span, substr| {
6466
cs_partial_cmp(cx, span, substr)
6567
}))

trunk/src/libsyntax/ext/deriving/decodable.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ fn expand_deriving_decodable_imp(cx: &mut ExtCtxt,
7979
true
8080
)),
8181
attributes: Vec::new(),
82+
is_unsafe: false,
8283
combine_substructure: combine_substructure(Box::new(|a, b, c| {
8384
decodable_substructure(a, b, c, krate)
8485
})),

trunk/src/libsyntax/ext/deriving/default.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ pub fn expand_deriving_default(cx: &mut ExtCtxt,
3939
args: Vec::new(),
4040
ret_ty: Self_,
4141
attributes: attrs,
42+
is_unsafe: false,
4243
combine_substructure: combine_substructure(Box::new(|a, b, c| {
4344
default_substructure(a, b, c)
4445
}))

trunk/src/libsyntax/ext/deriving/encodable.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ fn expand_deriving_encodable_imp(cx: &mut ExtCtxt,
155155
true
156156
)),
157157
attributes: Vec::new(),
158+
is_unsafe: false,
158159
combine_substructure: combine_substructure(Box::new(|a, b, c| {
159160
encodable_substructure(a, b, c)
160161
})),

trunk/src/libsyntax/ext/deriving/generic/mod.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,9 @@ pub struct MethodDef<'a> {
253253

254254
pub attributes: Vec<ast::Attribute>,
255255

256+
// Is it an `unsafe fn`?
257+
pub is_unsafe: bool,
258+
256259
pub combine_substructure: RefCell<CombineSubstructureFunc<'a>>,
257260
}
258261

@@ -859,6 +862,12 @@ impl<'a> MethodDef<'a> {
859862
let fn_decl = cx.fn_decl(args, ret_type);
860863
let body_block = cx.block_expr(body);
861864

865+
let unsafety = if self.is_unsafe {
866+
ast::Unsafety::Unsafe
867+
} else {
868+
ast::Unsafety::Normal
869+
};
870+
862871
// Create the method.
863872
P(ast::ImplItem {
864873
id: ast::DUMMY_NODE_ID,
@@ -870,7 +879,7 @@ impl<'a> MethodDef<'a> {
870879
generics: fn_generics,
871880
abi: abi,
872881
explicit_self: explicit_self,
873-
unsafety: ast::Unsafety::Normal,
882+
unsafety: unsafety,
874883
decl: fn_decl
875884
}, body_block)
876885
})

trunk/src/libsyntax/ext/deriving/hash.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ pub fn expand_deriving_hash(cx: &mut ExtCtxt,
4444
args: vec!(Ptr(Box::new(Literal(arg)), Borrowed(None, MutMutable))),
4545
ret_ty: nil_ty(),
4646
attributes: vec![],
47+
is_unsafe: false,
4748
combine_substructure: combine_substructure(Box::new(|a, b, c| {
4849
hash_substructure(a, b, c)
4950
}))

trunk/src/libsyntax/ext/deriving/primitive.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ pub fn expand_deriving_from_primitive(cx: &mut ExtCtxt,
4444
true)),
4545
// #[inline] liable to cause code-bloat
4646
attributes: attrs.clone(),
47+
is_unsafe: false,
4748
combine_substructure: combine_substructure(Box::new(|c, s, sub| {
4849
cs_from("i64", c, s, sub)
4950
})),
@@ -59,6 +60,7 @@ pub fn expand_deriving_from_primitive(cx: &mut ExtCtxt,
5960
true)),
6061
// #[inline] liable to cause code-bloat
6162
attributes: attrs,
63+
is_unsafe: false,
6264
combine_substructure: combine_substructure(Box::new(|c, s, sub| {
6365
cs_from("u64", c, s, sub)
6466
})),

trunk/src/libsyntax/ext/deriving/show.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ pub fn expand_deriving_show(cx: &mut ExtCtxt,
4242
args: vec!(fmtr),
4343
ret_ty: Literal(path_std!(cx, core::fmt::Result)),
4444
attributes: Vec::new(),
45+
is_unsafe: false,
4546
combine_substructure: combine_substructure(Box::new(|a, b, c| {
4647
show_substructure(a, b, c)
4748
}))

trunk/src/test/auxiliary/custom_derive_plugin.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ fn expand(cx: &mut ExtCtxt,
5454
args: vec![],
5555
ret_ty: Literal(Path::new_local("isize")),
5656
attributes: vec![],
57+
is_unsafe: false,
5758
combine_substructure: combine_substructure(box |cx, span, substr| {
5859
let zero = cx.expr_isize(span, 0);
5960
cs_fold(false,

trunk/src/test/auxiliary/custom_derive_plugin_attr.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ fn expand(cx: &mut ExtCtxt,
5656
args: vec![],
5757
ret_ty: Literal(Path::new_local("isize")),
5858
attributes: vec![],
59+
is_unsafe: false,
5960
combine_substructure: combine_substructure(Box::new(totalsum_substructure)),
6061
},
6162
],

trunk/src/test/compile-fail/gated-associated_consts.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,11 @@
1111
trait MyTrait {
1212
const C: bool;
1313
//~^ associated constants are experimental
14-
//~| add #![feature(associated_consts)] to the crate attributes to enable
1514
}
1615

1716
struct Foo;
1817

1918
impl Foo {
2019
const C: bool = true;
2120
//~^ associated constants are experimental
22-
//~| add #![feature(associated_consts)] to the crate attributes to enable
2321
}

trunk/src/test/run-pass/issue18173.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
trait Foo {
12+
type T;
13+
}
14+
15+
// should be able to use a trait with an associated type without specifying it as an argument
16+
trait Bar<F: Foo> {
17+
fn bar(foo: &F);
18+
}
19+
20+
pub fn main() {
21+
}

0 commit comments

Comments
 (0)