From 0909ce382fe2cd08a21cfe7c3bbad8fd7670a1bb Mon Sep 17 00:00:00 2001 From: Ryman Date: Sat, 16 May 2015 00:16:11 +0100 Subject: [PATCH 01/15] libstd: Path docs: `file` is now `file_name` --- src/libstd/path.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libstd/path.rs b/src/libstd/path.rs index 934b3156357..6732af556e0 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -1485,7 +1485,7 @@ pub fn ends_with>(&self, child: P) -> bool { iter_after(self.components().rev(), child.as_ref().components().rev()).is_some() } - /// Extracts the stem (non-extension) portion of `self.file()`. + /// Extracts the stem (non-extension) portion of `self.file_name()`. /// /// The stem is: /// @@ -1508,7 +1508,7 @@ pub fn file_stem(&self) -> Option<&OsStr> { self.file_name().map(split_file_at_dot).and_then(|(before, after)| before.or(after)) } - /// Extracts the extension of `self.file()`, if possible. + /// Extracts the extension of `self.file_name()`, if possible. /// /// The extension is: /// From e30909de1149d72ce4729481581baa08264c9d8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sat, 16 May 2015 02:21:05 +0200 Subject: [PATCH 02/15] Small typo in the docs Just detected it while reading. --- src/libstd/collections/hash/map.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 48f65a5abfd..a5fbc4374e0 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -539,7 +539,7 @@ impl HashMap { /// Creates an empty hashmap which will use the given hasher to hash keys. /// - /// The creates map has the default initial capacity. + /// The created map has the default initial capacity. /// /// # Examples /// From d5394d00d14335cf729aa87dfe6af77254633223 Mon Sep 17 00:00:00 2001 From: Will Engler Date: Fri, 15 May 2015 19:32:13 -0600 Subject: [PATCH 03/15] Correct two small typos in the Dining Philosophers example. --- src/doc/trpl/dining-philosophers.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/doc/trpl/dining-philosophers.md b/src/doc/trpl/dining-philosophers.md index b179c90ceb9..035f4de9da2 100644 --- a/src/doc/trpl/dining-philosophers.md +++ b/src/doc/trpl/dining-philosophers.md @@ -320,7 +320,7 @@ from the standard library, and so we need to `use` it. We now print out two messages, with a `sleep_ms()` in the middle. This will simulate the time it takes a philosopher to eat. -If you run this program, You should see each philosopher eat in turn: +If you run this program, you should see each philosopher eat in turn: ```text Baruch Spinoza is eating. @@ -480,7 +480,7 @@ struct Table { } ``` -This `Table` has an vector of `Mutex`es. A mutex is a way to control +This `Table` has a vector of `Mutex`es. A mutex is a way to control concurrency: only one thread can access the contents at once. This is exactly the property we need with our forks. We use an empty tuple, `()`, inside the mutex, since we’re not actually going to use the value, just hold onto it. From 89eee9ac36ee87c8736e557e7c8f52a6b90a02c8 Mon Sep 17 00:00:00 2001 From: Abhishek Chanda Date: Fri, 15 May 2015 19:18:06 -0700 Subject: [PATCH 04/15] Change my email --- AUTHORS.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AUTHORS.txt b/AUTHORS.txt index 6e79eec3e79..6e2ed39f875 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -8,7 +8,7 @@ Aaron Raimist Aaron Todd Aaron Turon Aaron Weiss -Abhishek Chanda +Abhishek Chanda Adam Bozanich Adam Jacob Adam Roben From 84d6dcb351f34443a1b98803cc797ad902f900ad Mon Sep 17 00:00:00 2001 From: Russell Johnston Date: Fri, 15 May 2015 20:49:01 -0600 Subject: [PATCH 05/15] Test that associated types are not required as type parameters Closes #18173 --- src/test/run-pass/issue18173.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/test/run-pass/issue18173.rs diff --git a/src/test/run-pass/issue18173.rs b/src/test/run-pass/issue18173.rs new file mode 100644 index 00000000000..f4266fada32 --- /dev/null +++ b/src/test/run-pass/issue18173.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +trait Foo { + type T; +} + +// should be able to use a trait with an associated type without specifying it as an argument +trait Bar { + fn bar(foo: &F); +} + +pub fn main() { +} From f641bd8396f0a4e79fd2c84fcf823f3c0e859ac5 Mon Sep 17 00:00:00 2001 From: sumito3478 Date: Sat, 16 May 2015 18:06:22 +0900 Subject: [PATCH 06/15] Fix deadlinks in complement-lang-faq.md --- src/doc/complement-lang-faq.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/doc/complement-lang-faq.md b/src/doc/complement-lang-faq.md index e51e7d414a8..4d7862788fb 100644 --- a/src/doc/complement-lang-faq.md +++ b/src/doc/complement-lang-faq.md @@ -5,8 +5,8 @@ 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. [rustc]: https://github.com/rust-lang/rust/tree/master/src/librustc -[resolve]: https://github.com/rust-lang/rust/blob/master/src/librustc/middle/resolve.rs -[borrowck]: https://github.com/rust-lang/rust/blob/master/src/librustc/middle/borrowck/ +[resolve]: https://github.com/rust-lang/rust/tree/master/src/librustc_resolve +[borrowck]: https://github.com/rust-lang/rust/tree/master/src/librustc_borrowck/borrowck 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. @@ -20,8 +20,8 @@ Some examples that demonstrate different aspects of the language: * The standard library's [json] module. Enums and pattern matching [sprocketnes]: https://github.com/pcwalton/sprocketnes -[hash]: https://github.com/rust-lang/rust/blob/master/src/libstd/hash/mod.rs -[HashMap]: https://github.com/rust-lang/rust/blob/master/src/libcollections/hashmap.rs +[hash]: https://github.com/rust-lang/rust/tree/master/src/libcore/hash +[HashMap]: https://github.com/rust-lang/rust/tree/master/src/libstd/collections/hash [json]: https://github.com/rust-lang/rust/blob/master/src/libserialize/json.rs You may also be interested in browsing [trending Rust repositories][github-rust] on GitHub. From 6e8e6a4b08e4d2d0e92eb50157e865bf412a3ce8 Mon Sep 17 00:00:00 2001 From: Huachao Huang Date: Sat, 16 May 2015 21:44:02 +0800 Subject: [PATCH 07/15] Update rust-inside-other-languages.md --- src/doc/trpl/rust-inside-other-languages.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/trpl/rust-inside-other-languages.md b/src/doc/trpl/rust-inside-other-languages.md index a1ae50a0c53..307b7093903 100644 --- a/src/doc/trpl/rust-inside-other-languages.md +++ b/src/doc/trpl/rust-inside-other-languages.md @@ -104,7 +104,7 @@ fn process() { let handles: Vec<_> = (0..10).map(|_| { thread::spawn(|| { let mut _x = 0; - for _ in (0..5_000_001) { + for _ in (0..5_000_000) { _x += 1 } }) From 76fa4f427b3dfcdfe0fe788d06f64fb59ba346d3 Mon Sep 17 00:00:00 2001 From: Maximilian Haack Date: Sat, 16 May 2015 17:20:07 +0200 Subject: [PATCH 08/15] Update the shown installed rust version to 1.0 :tada: :tada: :tada: --- src/doc/trpl/installing-rust.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/trpl/installing-rust.md b/src/doc/trpl/installing-rust.md index b8230f060e0..cce786da3d0 100644 --- a/src/doc/trpl/installing-rust.md +++ b/src/doc/trpl/installing-rust.md @@ -74,7 +74,7 @@ $ rustc --version You should see the version number, commit hash, commit date and build date: ```bash -rustc 1.0.0-beta (9854143cb 2015-04-02) (built 2015-04-02) +rustc 1.0.0 (a59de37e9 2015-05-13) (built 2015-05-14) ``` If you did, Rust has been installed successfully! Congrats! From e095e3963eb02e979ef16797f605cfc14f396e09 Mon Sep 17 00:00:00 2001 From: Maximilian Haack Date: Sat, 16 May 2015 19:18:52 +0200 Subject: [PATCH 09/15] Update windows install links to 1.0 Fixes #25489 --- src/doc/trpl/installing-rust.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/doc/trpl/installing-rust.md b/src/doc/trpl/installing-rust.md index cce786da3d0..b182ac745b8 100644 --- a/src/doc/trpl/installing-rust.md +++ b/src/doc/trpl/installing-rust.md @@ -23,8 +23,8 @@ $ sh rustup.sh If you're on Windows, please download either the [32-bit installer][win32] or the [64-bit installer][win64] and run it. -[win32]: https://static.rust-lang.org/dist/rust-1.0.0-beta-i686-pc-windows-gnu.msi -[win64]: https://static.rust-lang.org/dist/rust-1.0.0-beta-x86_64-pc-windows-gnu.msi +[win32]: https://static.rust-lang.org/dist/rust-1.0.0-i686-pc-windows-gnu.msi +[win64]: https://static.rust-lang.org/dist/rust-1.0.0-x86_64-pc-windows-gnu.msi ## Uninstalling From bf15d040c0aa7c6b99221e1b13ae12b5b811a795 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Sat, 16 May 2015 14:53:37 -0700 Subject: [PATCH 10/15] Make a test compatible with the beta channel --- src/test/compile-fail/gated-associated_consts.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/test/compile-fail/gated-associated_consts.rs b/src/test/compile-fail/gated-associated_consts.rs index 21672b18bde..cfa75ff9763 100644 --- a/src/test/compile-fail/gated-associated_consts.rs +++ b/src/test/compile-fail/gated-associated_consts.rs @@ -11,7 +11,6 @@ trait MyTrait { const C: bool; //~^ associated constants are experimental - //~| add #![feature(associated_consts)] to the crate attributes to enable } struct Foo; @@ -19,5 +18,4 @@ trait MyTrait { impl Foo { const C: bool = true; //~^ associated constants are experimental - //~| add #![feature(associated_consts)] to the crate attributes to enable } From ba02739ad3519874cb19e741b3df59cef2917b9e Mon Sep 17 00:00:00 2001 From: Wilfred Hughes Date: Sat, 16 May 2015 23:52:28 +0100 Subject: [PATCH 11/15] Avoid calling a variable 'string' when discussing strings. Newcomers to Rust need to learn the distinctinion between `&str` and `String`, so additonally having `string` in an example risks confusion. --- src/doc/trpl/strings.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/doc/trpl/strings.md b/src/doc/trpl/strings.md index 61a6ec3eb3f..ece2c390be3 100644 --- a/src/doc/trpl/strings.md +++ b/src/doc/trpl/strings.md @@ -16,11 +16,11 @@ Rust has two main types of strings: `&str` and `String`. Let’s talk about `&'static str`: ```rust -let string = "Hello there."; // string: &'static str +let greeting = "Hello there."; // greeting: &'static str ``` This string is statically allocated, meaning that it’s saved inside our -compiled program, and exists for the entire duration it runs. The `string` +compiled program, and exists for the entire duration it runs. The `greeting` binding is a reference to this statically allocated string. String slices have a fixed size, and cannot be mutated. From b6e755df66eb5c54055ceef559ff985ddf78c446 Mon Sep 17 00:00:00 2001 From: Johannes Hoff Date: Sat, 16 May 2015 16:07:52 -0700 Subject: [PATCH 12/15] fs::walk_dir example without unstable features The current version of the example won't compile due to unstable features. This is an attempt to fix that, at the cost of slightly more verbose code. --- src/libstd/fs.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index fc5405ea7f6..481d9e69abd 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -1099,20 +1099,19 @@ pub fn remove_dir_all>(path: P) -> io::Result<()> { /// # Examples /// /// ``` -/// # #![feature(path_ext)] /// use std::io; -/// use std::fs::{self, PathExt, DirEntry}; +/// use std::fs::{self, DirEntry}; /// use std::path::Path; /// /// // one possible implementation of fs::walk_dir only visiting files -/// fn visit_dirs(dir: &Path, cb: &mut FnMut(DirEntry)) -> io::Result<()> { -/// if dir.is_dir() { +/// fn visit_dirs(dir: &Path, cb: &Fn(&DirEntry)) -> io::Result<()> { +/// if try!(fs::metadata(dir)).is_dir() { /// for entry in try!(fs::read_dir(dir)) { /// let entry = try!(entry); -/// if entry.path().is_dir() { +/// if try!(fs::metadata(entry.path())).is_dir() { /// try!(visit_dirs(&entry.path(), cb)); /// } else { -/// cb(entry); +/// cb(&entry); /// } /// } /// } From ce8fb6c6c654c9b049215b8ec619e0418e0372c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rio=20Feroldi?= Date: Sat, 16 May 2015 20:59:20 -0300 Subject: [PATCH 13/15] Fixed reserve_exact example The same example for ``reverse`` were in the ``reserve_exact``'s example. --- src/libcollections/string.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index 28e47674291..1f2443d9771 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -433,7 +433,7 @@ pub fn reserve(&mut self, additional: usize) { /// /// ``` /// let mut s = String::new(); - /// s.reserve(10); + /// s.reserve_exact(10); /// assert!(s.capacity() >= 10); /// ``` #[inline] From e1f73b8e2bc8696f6ba21d44de7808cad861bb42 Mon Sep 17 00:00:00 2001 From: Ben Striegel Date: Sat, 16 May 2015 22:30:25 -0400 Subject: [PATCH 14/15] Simplify CString doc comment No need for `&b"foo"[..]` to make a CString, `"foo"` will do. --- src/libstd/ffi/c_str.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index 04513e9d048..b83a8efe1d0 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -53,8 +53,7 @@ /// fn my_printer(s: *const libc::c_char); /// } /// -/// let to_print = &b"Hello, world!"[..]; -/// let c_to_print = CString::new(to_print).unwrap(); +/// let c_to_print = CString::new("Hello, world!").unwrap(); /// unsafe { /// my_printer(c_to_print.as_ptr()); /// } From e5e722bd3244c927fb672850805c3b3f3bd46e79 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sat, 16 May 2015 22:24:13 -0700 Subject: [PATCH 15/15] std: Reexport std::net::tcp::Incoming This iterator was mistakenly not reexported at the top level, preventing actually naming the type! Closes #25519 --- src/libstd/net/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/net/mod.rs b/src/libstd/net/mod.rs index bff9774bcd0..a79a451305d 100644 --- a/src/libstd/net/mod.rs +++ b/src/libstd/net/mod.rs @@ -19,7 +19,7 @@ pub use self::ip::{IpAddr, Ipv4Addr, Ipv6Addr, Ipv6MulticastScope}; pub use self::addr::{SocketAddr, SocketAddrV4, SocketAddrV6, ToSocketAddrs}; -pub use self::tcp::{TcpStream, TcpListener}; +pub use self::tcp::{TcpStream, TcpListener, Incoming}; pub use self::udp::UdpSocket; pub use self::parser::AddrParseError;