From 25d068e36ed2f4c1b526185fbb2763c38616a10f Mon Sep 17 00:00:00 2001 From: Sandeep Datta Date: Sun, 17 Jan 2016 14:08:01 +0530 Subject: [PATCH 01/22] Showed the difference between `map` and `and_then` with an example. --- src/doc/book/error-handling.md | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/doc/book/error-handling.md b/src/doc/book/error-handling.md index 9b1d16170b97f..b5c0eabba9de7 100644 --- a/src/doc/book/error-handling.md +++ b/src/doc/book/error-handling.md @@ -351,11 +351,21 @@ fn file_name(file_path: &str) -> Option<&str> { ``` You might think that we could use the `map` combinator to reduce the case -analysis, but its type doesn't quite fit. Namely, `map` takes a function that -does something only with the inner value. The result of that function is then -*always* [rewrapped with `Some`](#code-option-map). Instead, we need something -like `map`, but which allows the caller to return another `Option`. Its generic -implementation is even simpler than `map`: +analysis, but its type doesn't quite fit... + +```rust +fn file_path_ext(file_path: &str) -> Option<&str> { + file_name(file_path).map(|x| extension(x)) //Compilation error +} +``` + +The `map` function here wraps the value returned by the `extension` function inside an `Option<_>` and since the `extension` function itself returns an `Option<&str>` the expression `file_name(file_path).map(|x| extension(x))` actually returns an `Option>`. + +But since `file_path_ext` just returns `Option<&str>` (and not `Option>`) we get a compilation error. + +The result of the function taken by map as input is *always* [rewrapped with `Some`](#code-option-map). Instead, we need something like `map`, but which allows the caller to return a `Option<_>` directly without wrapping it in another `Option<_>`. + +Its generic implementation is even simpler than `map`: ```rust fn and_then(option: Option, f: F) -> Option @@ -377,6 +387,8 @@ fn file_path_ext(file_path: &str) -> Option<&str> { } ``` +Side note: Since `and_then` essentially works like `map` but returns an `Option<_>` instead of an `Option>` it is known as `flatmap` in some other languages. + The `Option` type has many other combinators [defined in the standard library][5]. It is a good idea to skim this list and familiarize yourself with what's available—they can often reduce case analysis From 5f20143ccfd1a74a8a104ecac33f777ade12992f Mon Sep 17 00:00:00 2001 From: Sandeep Datta Date: Wed, 20 Jan 2016 19:48:00 +0530 Subject: [PATCH 02/22] Fixed line wrapping. --- src/doc/book/error-handling.md | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/doc/book/error-handling.md b/src/doc/book/error-handling.md index b5c0eabba9de7..d4df6a813bc80 100644 --- a/src/doc/book/error-handling.md +++ b/src/doc/book/error-handling.md @@ -359,11 +359,18 @@ fn file_path_ext(file_path: &str) -> Option<&str> { } ``` -The `map` function here wraps the value returned by the `extension` function inside an `Option<_>` and since the `extension` function itself returns an `Option<&str>` the expression `file_name(file_path).map(|x| extension(x))` actually returns an `Option>`. +The `map` function here wraps the value returned by the `extension` function +inside an `Option<_>` and since the `extension` function itself returns an +`Option<&str>` the expression `file_name(file_path).map(|x| extension(x))` +actually returns an `Option>`. -But since `file_path_ext` just returns `Option<&str>` (and not `Option>`) we get a compilation error. +But since `file_path_ext` just returns `Option<&str>` (and not +`Option>`) we get a compilation error. -The result of the function taken by map as input is *always* [rewrapped with `Some`](#code-option-map). Instead, we need something like `map`, but which allows the caller to return a `Option<_>` directly without wrapping it in another `Option<_>`. +The result of the function taken by map as input is *always* [rewrapped with +`Some`](#code-option-map). Instead, we need something like `map`, but which +allows the caller to return a `Option<_>` directly without wrapping it in +another `Option<_>`. Its generic implementation is even simpler than `map`: @@ -387,7 +394,9 @@ fn file_path_ext(file_path: &str) -> Option<&str> { } ``` -Side note: Since `and_then` essentially works like `map` but returns an `Option<_>` instead of an `Option>` it is known as `flatmap` in some other languages. +Side note: Since `and_then` essentially works like `map` but returns an +`Option<_>` instead of an `Option>` it is known as `flatmap` in some +other languages. The `Option` type has many other combinators [defined in the standard library][5]. It is a good idea to skim this list and familiarize From 5a5aacac1f6f06fdbff415e74e9f71ebf6443a4d Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Mon, 25 Jan 2016 22:57:57 -0500 Subject: [PATCH 03/22] Document LTR vs RTL wrt trim_* The doc part of #30459 --- src/libcollections/str.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 9ce1a111cf83a..03474a45fead7 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -1515,6 +1515,13 @@ impl str { /// 'Whitespace' is defined according to the terms of the Unicode Derived /// Core Property `White_Space`. /// + /// # Text directionality + /// + /// A string is a sequence of bytes. 'Left' in this context means the first + /// position of that byte string; for a language like Arabic or Hebrew + /// which are 'right to left' rather than 'left to right', this will be + /// the _right_ side, not the left. + /// /// # Examples /// /// Basic usage: @@ -1534,6 +1541,13 @@ impl str { /// 'Whitespace' is defined according to the terms of the Unicode Derived /// Core Property `White_Space`. /// + /// # Text directionality + /// + /// A string is a sequence of bytes. 'Right' in this context means the last + /// position of that byte string; for a language like Arabic or Hebrew + /// which are 'right to left' rather than 'left to right', this will be + /// the _left_ side, not the right. + /// /// # Examples /// /// Basic usage: @@ -1588,6 +1602,13 @@ impl str { /// /// [`char`]: primitive.char.html /// + /// # Text directionality + /// + /// A string is a sequence of bytes. 'Left' in this context means the first + /// position of that byte string; for a language like Arabic or Hebrew + /// which are 'right to left' rather than 'left to right', this will be + /// the _right_ side, not the left. + /// /// # Examples /// /// Basic usage: @@ -1612,6 +1633,13 @@ impl str { /// /// [`char`]: primitive.char.html /// + /// # Text directionality + /// + /// A string is a sequence of bytes. 'Right' in this context means the last + /// position of that byte string; for a language like Arabic or Hebrew + /// which are 'right to left' rather than 'left to right', this will be + /// the _left_ side, not the right. + /// /// # Examples /// /// Simple patterns: From f841f061ecdff7c5fd791f164b4d873399621bde Mon Sep 17 00:00:00 2001 From: Ruud van Asseldonk Date: Thu, 28 Jan 2016 22:23:47 +0100 Subject: [PATCH 04/22] Improve message for rustc --explain E0507 E0507 can occur when you try to move out of a member of a mutably borrowed struct, in which case `mem::replace` can help. Mentioning that here hopefully saves future users a trip to Google. --- src/librustc_borrowck/diagnostics.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/librustc_borrowck/diagnostics.rs b/src/librustc_borrowck/diagnostics.rs index 7ad4d3ca70898..6cbea1abbb5bb 100644 --- a/src/librustc_borrowck/diagnostics.rs +++ b/src/librustc_borrowck/diagnostics.rs @@ -377,6 +377,33 @@ fn main() { } ``` +Moving out of a member of a mutably borrowed struct is fine if you put something +back. `mem::replace` can be used for that: + +``` +struct TheDarkKnight; + +impl TheDarkKnight { + fn nothing_is_true(self) {} +} + +struct Batcave { + knight: TheDarkKnight +} + +fn main() { + use std::mem; + + let mut cave = Batcave { + knight: TheDarkKnight + }; + let borrowed = &mut cave; + + borrowed.knight.nothing_is_true(); // E0507 + mem::replace(&mut borrowed.knight, TheDarkKnight).nothing_is_true(); // ok! +} +``` + You can find more information about borrowing in the rust-book: http://doc.rust-lang.org/stable/book/references-and-borrowing.html "##, From b5845c64275593a37a9c74dd8e9c74ee3df72b28 Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Fri, 29 Jan 2016 11:25:20 +0100 Subject: [PATCH 05/22] fix overflow due to multiline error span --- src/libsyntax/errors/emitter.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libsyntax/errors/emitter.rs b/src/libsyntax/errors/emitter.rs index c1239bfd66db8..4b6f42db50d8e 100644 --- a/src/libsyntax/errors/emitter.rs +++ b/src/libsyntax/errors/emitter.rs @@ -518,7 +518,7 @@ impl EmitterWriter { }; let lo = self.cm.lookup_char_pos(sp.lo); let hi = self.cm.lookup_char_pos(sp.hi); - let elide_sp = (lo.line - hi.line) > MAX_SP_LINES; + let elide_sp = (hi.line - lo.line) > MAX_SP_LINES; let line_num = line.line_index + 1; if !(lo.line <= line_num && hi.line >= line_num) { From fe10914adc783472ae0847d5163385d0e49046a4 Mon Sep 17 00:00:00 2001 From: mitaa Date: Fri, 29 Jan 2016 13:45:15 +0100 Subject: [PATCH 06/22] Update emitter.rs --- src/libsyntax/errors/emitter.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libsyntax/errors/emitter.rs b/src/libsyntax/errors/emitter.rs index 4b6f42db50d8e..f6a01d2499515 100644 --- a/src/libsyntax/errors/emitter.rs +++ b/src/libsyntax/errors/emitter.rs @@ -1026,7 +1026,7 @@ mod test { \x20 ^ ^\n"; let expect0_end = "dummy.txt: 5 ccccc\n\ - \x20 ...\n\ + dummy.txt: 6 xxxxx\n\ dummy.txt: 7 yyyyy\n\ \x20 ^\n\ \x20 ...\n\ From 0922d7e68f3186aa57751af26f3342b1837a5140 Mon Sep 17 00:00:00 2001 From: Sandeep Datta Date: Sat, 30 Jan 2016 13:43:02 +0530 Subject: [PATCH 07/22] Ignoring demo code with compilation error. --- src/doc/book/error-handling.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/book/error-handling.md b/src/doc/book/error-handling.md index d4df6a813bc80..cf78a21d26fd5 100644 --- a/src/doc/book/error-handling.md +++ b/src/doc/book/error-handling.md @@ -353,7 +353,7 @@ fn file_name(file_path: &str) -> Option<&str> { You might think that we could use the `map` combinator to reduce the case analysis, but its type doesn't quite fit... -```rust +```rust,ignore fn file_path_ext(file_path: &str) -> Option<&str> { file_name(file_path).map(|x| extension(x)) //Compilation error } From 54927ac57f95b4ac6747d29af45fef8e47225852 Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Sat, 30 Jan 2016 13:40:40 +0100 Subject: [PATCH 08/22] off by one --- src/libsyntax/errors/emitter.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libsyntax/errors/emitter.rs b/src/libsyntax/errors/emitter.rs index f6a01d2499515..d3982f6a5b628 100644 --- a/src/libsyntax/errors/emitter.rs +++ b/src/libsyntax/errors/emitter.rs @@ -518,7 +518,7 @@ impl EmitterWriter { }; let lo = self.cm.lookup_char_pos(sp.lo); let hi = self.cm.lookup_char_pos(sp.hi); - let elide_sp = (hi.line - lo.line) > MAX_SP_LINES; + let elide_sp = (hi.line - lo.line) >= MAX_SP_LINES; let line_num = line.line_index + 1; if !(lo.line <= line_num && hi.line >= line_num) { From cee1695e0839d0672113e7445cec0722559585ee Mon Sep 17 00:00:00 2001 From: Dirk Gadsden Date: Sun, 31 Jan 2016 11:50:22 -0800 Subject: [PATCH 09/22] Safety docs about `std::process::Child` going out of scope There is no `Drop` implemented for `Child`, so if it goes out of scope in Rust-land and gets deallocated, the child process will continue to exist and execute. If users want a guarantee that the process has finished running and exited they must manually use `kill`, `wait`, or `wait_with_output`. Fixes #31289. --- src/libstd/process.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libstd/process.rs b/src/libstd/process.rs index 7197dfa8b2d47..2cfbef1e1b7d9 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -47,6 +47,14 @@ use thread::{self, JoinHandle}; /// /// assert!(ecode.success()); /// ``` +/// +/// # Safety +/// +/// Take note that there is no implementation of +/// [`Drop`](../../core/ops/trait.Drop.html) for child processes, so if you +/// not ensure the `Child` has exited (through `kill`, `wait`, or +/// `wait_with_output`) then it will continue to run even after the `Child` +/// handle to it has gone out of scope. #[stable(feature = "process", since = "1.0.0")] pub struct Child { handle: imp::Process, From 76839221ff9bc4fd65ab9e7c0f1cd8e7514446f0 Mon Sep 17 00:00:00 2001 From: Dirk Gadsden Date: Sun, 31 Jan 2016 12:33:37 -0800 Subject: [PATCH 10/22] Minor corrections in docs for `std::process::Child` --- src/libstd/process.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/libstd/process.rs b/src/libstd/process.rs index 2cfbef1e1b7d9..5e0a54392d23d 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -48,13 +48,15 @@ use thread::{self, JoinHandle}; /// assert!(ecode.success()); /// ``` /// -/// # Safety +/// # Note /// /// Take note that there is no implementation of /// [`Drop`](../../core/ops/trait.Drop.html) for child processes, so if you -/// not ensure the `Child` has exited (through `kill`, `wait`, or -/// `wait_with_output`) then it will continue to run even after the `Child` -/// handle to it has gone out of scope. +/// do not ensure the `Child` has exited then it will continue to run, even +/// after the `Child` handle to the child process has gone out of scope. +/// +/// Calling `wait` (or other functions that wrap around it) will make the +/// parent process wait until the child has actually exited before continuing. #[stable(feature = "process", since = "1.0.0")] pub struct Child { handle: imp::Process, From a58d3303f29c245899cd6549661606ff37763309 Mon Sep 17 00:00:00 2001 From: Ryan Thomas Date: Mon, 1 Feb 2016 17:04:39 +1100 Subject: [PATCH 11/22] Update docs about how to run specific tests --- CONTRIBUTING.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e4870aa6a8980..f4d9c724877e1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -131,8 +131,10 @@ Some common make targets are: & everything builds in the correct manner. - `make check-stage1-std NO_REBUILD=1` - test the standard library without rebuilding the entire compiler -- `make check TESTNAME=.rs` - Run a single test file -- `make check-stage1-rpass TESTNAME=.rs` - Run a single +- `make check TESTNAME=` - Run a single test file + - `TESTNAME` should be the fully qualified name of the test function, e.g. + `TESTNAME=collections::hash::map::test_map::test_capacity_not_less_than_len` +- `make check-stage1-rpass TESTNAME=` - Run a single rpass test with the stage1 compiler (this will be quicker than running the command above as we only build the stage1 compiler, not the entire thing). You can also leave off the `-rpass` to run all stage1 test types. From 2043cd8623a81c6ee4bf722dd81a02368a2727cf Mon Sep 17 00:00:00 2001 From: Prayag Verma Date: Mon, 1 Feb 2016 12:15:33 +0530 Subject: [PATCH 12/22] Fix typo in doc/book/getting-started.md Spelling mistake - `familliar` > `familiar` --- src/doc/book/getting-started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/book/getting-started.md b/src/doc/book/getting-started.md index d7b6e15794ef4..e0ea42ce0cbdb 100644 --- a/src/doc/book/getting-started.md +++ b/src/doc/book/getting-started.md @@ -569,7 +569,7 @@ executable application, as opposed to a library. Executables are often called *binaries* (as in `/usr/bin`, if you’re on a Unix system). Cargo has generated two files and one directory for us: a `Cargo.toml` and a -*src* directory with a *main.rs* file inside. These should look familliar, +*src* directory with a *main.rs* file inside. These should look familiar, they’re exactly what we created by hand, above. This output is all you need to get started. First, open `Cargo.toml`. It should From 7aa41a1a86cb721bbb297ef394b91cc9ab027cf7 Mon Sep 17 00:00:00 2001 From: Reeze Xia Date: Mon, 1 Feb 2016 18:53:07 +0800 Subject: [PATCH 13/22] Comment fix --- src/libsyntax/ast.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index e327adfaf892c..19bedab9d3054 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -70,9 +70,9 @@ pub struct Name(pub u32); /// A SyntaxContext represents a chain of macro-expandings /// and renamings. Each macro expansion corresponds to /// a fresh u32. This u32 is a reference to a table stored -// in thread-local storage. -// The special value EMPTY_CTXT is used to indicate an empty -// syntax context. +/// in thread-local storage. +/// The special value EMPTY_CTXT is used to indicate an empty +/// syntax context. #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable)] pub struct SyntaxContext(pub u32); From 7df3bf1860d1821056a5e9d4193b7e99d2c9479d Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Mon, 1 Feb 2016 11:52:00 -0500 Subject: [PATCH 14/22] make this example more obvious Fixes #31334 --- src/doc/book/loops.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/doc/book/loops.md b/src/doc/book/loops.md index 5b08c2fb04dbd..b5dde9be17fcb 100644 --- a/src/doc/book/loops.md +++ b/src/doc/book/loops.md @@ -125,7 +125,8 @@ Don't forget to add the parentheses around the range. #### On iterators: ```rust -# let lines = "hello\nworld".lines(); +let lines = "hello\nworld".lines(); + for (linenumber, line) in lines.enumerate() { println!("{}: {}", linenumber, line); } @@ -134,10 +135,8 @@ for (linenumber, line) in lines.enumerate() { Outputs: ```text -0: Content of line one -1: Content of line two -2: Content of line three -3: Content of line four +0: hello +1: world ``` ## Ending iteration early From 49fe5197916ed8065e6d6ff267826546d631be86 Mon Sep 17 00:00:00 2001 From: Kamal Marhubi Date: Mon, 1 Feb 2016 12:26:51 -0500 Subject: [PATCH 15/22] book: Change "Failures" to "Errors" in doc special sections chapter This matches the usage in the standard library's documentation. --- src/doc/book/documentation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/book/documentation.md b/src/doc/book/documentation.md index 4053e5776e39f..ede3100194e5b 100644 --- a/src/doc/book/documentation.md +++ b/src/doc/book/documentation.md @@ -118,7 +118,7 @@ least. If your function has a non-trivial contract like this, that is detected/enforced by panics, documenting it is very important. ```rust -/// # Failures +/// # Errors # fn foo() {} ``` From ed087015392adf58c497f884ecf116dc07952ce3 Mon Sep 17 00:00:00 2001 From: Alexander Lopatin Date: Mon, 1 Feb 2016 21:09:19 +0300 Subject: [PATCH 16/22] Fix a documentation typo --- src/libcore/sync/atomic.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs index 21b76c1f4bec1..700a577e20c92 100644 --- a/src/libcore/sync/atomic.rs +++ b/src/libcore/sync/atomic.rs @@ -711,7 +711,7 @@ impl AtomicUsize { /// ``` /// use std::sync::atomic::{AtomicUsize, Ordering}; /// - /// let some_usize= AtomicUsize::new(5); + /// let some_usize = AtomicUsize::new(5); /// /// assert_eq!(some_usize.swap(10, Ordering::Relaxed), 5); /// assert_eq!(some_usize.load(Ordering::Relaxed), 10); From 4289973a2d95fa95a45b225c02ca8937f2b8c09e Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Wed, 27 Jan 2016 22:23:52 +0200 Subject: [PATCH 17/22] doc: bindings not needed for this example --- src/libcore/iter.rs | 38 ++++++++++---------------------------- 1 file changed, 10 insertions(+), 28 deletions(-) diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 3f1c0f6a5492a..93514dbd6bb2f 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -2756,20 +2756,11 @@ pub trait Extend { /// /// let mut iter = numbers.iter(); /// -/// let n = iter.next(); -/// assert_eq!(Some(&1), n); -/// -/// let n = iter.next_back(); -/// assert_eq!(Some(&3), n); -/// -/// let n = iter.next_back(); -/// assert_eq!(Some(&2), n); -/// -/// let n = iter.next(); -/// assert_eq!(None, n); -/// -/// let n = iter.next_back(); -/// assert_eq!(None, n); +/// assert_eq!(Some(&1), iter.next()); +/// assert_eq!(Some(&3), iter.next_back()); +/// assert_eq!(Some(&2), iter.next_back()); +/// assert_eq!(None, iter.next()); +/// assert_eq!(None, iter.next_back()); /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub trait DoubleEndedIterator: Iterator { @@ -2789,20 +2780,11 @@ pub trait DoubleEndedIterator: Iterator { /// /// let mut iter = numbers.iter(); /// - /// let n = iter.next(); - /// assert_eq!(Some(&1), n); - /// - /// let n = iter.next_back(); - /// assert_eq!(Some(&3), n); - /// - /// let n = iter.next_back(); - /// assert_eq!(Some(&2), n); - /// - /// let n = iter.next(); - /// assert_eq!(None, n); - /// - /// let n = iter.next_back(); - /// assert_eq!(None, n); + /// assert_eq!(Some(&1), iter.next()); + /// assert_eq!(Some(&3), iter.next_back()); + /// assert_eq!(Some(&2), iter.next_back()); + /// assert_eq!(None, iter.next()); + /// assert_eq!(None, iter.next_back()); /// ``` #[stable(feature = "rust1", since = "1.0.0")] fn next_back(&mut self) -> Option; From 0574b395efa0f95aed4eaacaf4445fc78687c4cd Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 29 Jan 2016 11:10:44 -0800 Subject: [PATCH 18/22] doc: Move 32-bit MSVC to a tier 1 platform Some other shufflings as well: * Three powerpc triples for Linux have been added recently * An armv7 linux triple was added recently * The 64-bit Solaris triple is now mentioned in tier 3 We are currently now also building nightlies for iOS, powerpc triples, and armv7, but there hasn't been much vetting of the triples themselves so I've left them in tier 3 for now. --- src/doc/book/getting-started.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/doc/book/getting-started.md b/src/doc/book/getting-started.md index d7b6e15794ef4..980f72fe70c83 100644 --- a/src/doc/book/getting-started.md +++ b/src/doc/book/getting-started.md @@ -39,6 +39,7 @@ Specifically they will each satisfy the following requirements: | Target | std |rustc|cargo| notes | |-------------------------------|-----|-----|-----|----------------------------| +| `i686-pc-windows-msvc` | ✓ | ✓ | ✓ | 32-bit MSVC (Windows 7+) | | `x86_64-pc-windows-msvc` | ✓ | ✓ | ✓ | 64-bit MSVC (Windows 7+) | | `i686-pc-windows-gnu` | ✓ | ✓ | ✓ | 32-bit MinGW (Windows 7+) | | `x86_64-pc-windows-gnu` | ✓ | ✓ | ✓ | 64-bit MinGW (Windows 7+) | @@ -62,7 +63,6 @@ these platforms are required to have each of the following: | Target | std |rustc|cargo| notes | |-------------------------------|-----|-----|-----|----------------------------| -| `i686-pc-windows-msvc` | ✓ | ✓ | ✓ | 32-bit MSVC (Windows 7+) | | `x86_64-unknown-linux-musl` | ✓ | | | 64-bit Linux with MUSL | | `arm-linux-androideabi` | ✓ | | | ARM Android | | `arm-unknown-linux-gnueabi` | ✓ | ✓ | | ARM Linux (2.6.18+) | @@ -85,6 +85,9 @@ unofficial locations. | `i686-linux-android` | ✓ | | | 32-bit x86 Android | | `aarch64-linux-android` | ✓ | | | ARM64 Android | | `powerpc-unknown-linux-gnu` | ✓ | | | PowerPC Linux (2.6.18+) | +| `powerpc64-unknown-linux-gnu` | ✓ | | | PPC64 Linux (2.6.18+) | +|`powerpc64le-unknown-linux-gnu`| ✓ | | | PPC64LE Linux (2.6.18+) | +|`armv7-unknown-linux-gnueabihf`| ✓ | | | ARMv7 Linux (2.6.18+) | | `i386-apple-ios` | ✓ | | | 32-bit x86 iOS | | `x86_64-apple-ios` | ✓ | | | 64-bit x86 iOS | | `armv7-apple-ios` | ✓ | | | ARM iOS | @@ -97,6 +100,7 @@ unofficial locations. | `x86_64-unknown-bitrig` | ✓ | ✓ | | 64-bit Bitrig | | `x86_64-unknown-dragonfly` | ✓ | ✓ | | 64-bit DragonFlyBSD | | `x86_64-rumprun-netbsd` | ✓ | | | 64-bit NetBSD Rump Kernel | +| `x86_64-sun-solaris` | ✓ | ✓ | | 64-bit Solaris/SunOS | | `i686-pc-windows-msvc` (XP) | ✓ | | | Windows XP support | | `x86_64-pc-windows-msvc` (XP) | ✓ | | | Windows XP support | From a5e491fa9249d15876c85cf356910588b49fb257 Mon Sep 17 00:00:00 2001 From: Ryan Thomas Date: Tue, 2 Feb 2016 10:57:24 +1100 Subject: [PATCH 19/22] Update TESTNAME matching description --- CONTRIBUTING.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f4d9c724877e1..3f9a5a0430554 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -131,10 +131,12 @@ Some common make targets are: & everything builds in the correct manner. - `make check-stage1-std NO_REBUILD=1` - test the standard library without rebuilding the entire compiler -- `make check TESTNAME=` - Run a single test file - - `TESTNAME` should be the fully qualified name of the test function, e.g. +- `make check TESTNAME=` - Run a single test file + - `TESTNAME` should be a substring of the tests to match against e.g. it could + be the fully qualified test name, or just a part of it. `TESTNAME=collections::hash::map::test_map::test_capacity_not_less_than_len` -- `make check-stage1-rpass TESTNAME=` - Run a single + or `TESTNAME=test_capacity_not_less_than_len`. +- `make check-stage1-rpass TESTNAME=` - Run a single rpass test with the stage1 compiler (this will be quicker than running the command above as we only build the stage1 compiler, not the entire thing). You can also leave off the `-rpass` to run all stage1 test types. From df31868cac5befd9dc3e653747f06de67831b03b Mon Sep 17 00:00:00 2001 From: Ryan Thomas Date: Tue, 2 Feb 2016 10:58:59 +1100 Subject: [PATCH 20/22] Update TESTNAME description --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3f9a5a0430554..609bf03fb6c91 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -131,7 +131,7 @@ Some common make targets are: & everything builds in the correct manner. - `make check-stage1-std NO_REBUILD=1` - test the standard library without rebuilding the entire compiler -- `make check TESTNAME=` - Run a single test file +- `make check TESTNAME=` - Run a matching set of tests. - `TESTNAME` should be a substring of the tests to match against e.g. it could be the fully qualified test name, or just a part of it. `TESTNAME=collections::hash::map::test_map::test_capacity_not_less_than_len` From 129a6239d28aeaea87a9d27191e50b55e6b8923a Mon Sep 17 00:00:00 2001 From: Kamal Marhubi Date: Mon, 1 Feb 2016 21:41:29 -0500 Subject: [PATCH 21/22] docs: Standardize on 'Errors' header in std docs --- src/libcollections/str.rs | 2 +- src/libcollections/string.rs | 2 +- src/libcore/str/mod.rs | 2 +- src/librustc_unicode/char.rs | 2 +- src/libstd/fs.rs | 2 +- src/libstd/sync/condvar.rs | 2 +- src/libstd/sync/mutex.rs | 8 ++++---- src/libstd/sync/rwlock.rs | 12 ++++++------ src/libstd/sys/common/remutex.rs | 4 ++-- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 094b7f1d03453..118675ab2c51d 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -1644,7 +1644,7 @@ impl str { /// /// [`FromStr`]: str/trait.FromStr.html /// - /// # Failure + /// # Errors /// /// Will return `Err` if it's not possible to parse this string slice into /// the desired type. diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index 97c12043e7634..b1242ba6d4df2 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -433,7 +433,7 @@ impl String { /// /// [`str::from_utf8()`]: ../str/fn.from_utf8.html /// - /// # Failure + /// # Errors /// /// Returns `Err` if the slice is not UTF-8 with a description as to why the /// provided bytes are not UTF-8. The vector you moved in is also included. diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 3892455395f76..f19970546d79b 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -188,7 +188,7 @@ impl Utf8Error { /// it, this function is one way to have a stack-allocated string. There is /// an example of this in the examples section below. /// -/// # Failure +/// # Errors /// /// Returns `Err` if the slice is not UTF-8 with a description as to why the /// provided slice is not UTF-8. diff --git a/src/librustc_unicode/char.rs b/src/librustc_unicode/char.rs index 46ecd3a80b5d1..9386453d660d2 100644 --- a/src/librustc_unicode/char.rs +++ b/src/librustc_unicode/char.rs @@ -194,7 +194,7 @@ impl char { /// * `a-z` /// * `A-Z` /// - /// # Failure + /// # Errors /// /// Returns `None` if the `char` does not refer to a digit in the given radix. /// diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index e40a3d06f7753..d12cfa6183a24 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -70,7 +70,7 @@ pub struct Metadata(fs_imp::FileAttr); /// information like the entry's path and possibly other metadata can be /// learned. /// -/// # Failure +/// # Errors /// /// This `io::Result` will be an `Err` if there's some sort of intermittent /// IO error during iteration. diff --git a/src/libstd/sync/condvar.rs b/src/libstd/sync/condvar.rs index 1f7fe820bf86a..9a786752365f1 100644 --- a/src/libstd/sync/condvar.rs +++ b/src/libstd/sync/condvar.rs @@ -129,7 +129,7 @@ impl Condvar { /// the predicate must always be checked each time this function returns to /// protect against spurious wakeups. /// - /// # Failure + /// # Errors /// /// This function will return an error if the mutex being waited on is /// poisoned when this thread re-acquires the lock. For more information, diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs index 6b20e51967d88..fe9f0371abd5d 100644 --- a/src/libstd/sync/mutex.rs +++ b/src/libstd/sync/mutex.rs @@ -205,7 +205,7 @@ impl Mutex { /// held. An RAII guard is returned to allow scoped unlock of the lock. When /// the guard goes out of scope, the mutex will be unlocked. /// - /// # Failure + /// # Errors /// /// If another user of this mutex panicked while holding the mutex, then /// this call will return an error once the mutex is acquired. @@ -223,7 +223,7 @@ impl Mutex { /// /// This function does not block. /// - /// # Failure + /// # Errors /// /// If another user of this mutex panicked while holding the mutex, then /// this call will return failure if the mutex would otherwise be @@ -250,7 +250,7 @@ impl Mutex { /// Consumes this mutex, returning the underlying data. /// - /// # Failure + /// # Errors /// /// If another user of this mutex panicked while holding the mutex, then /// this call will return an error instead. @@ -280,7 +280,7 @@ impl Mutex { /// Since this call borrows the `Mutex` mutably, no actual locking needs to /// take place---the mutable borrow statically guarantees no locks exist. /// - /// # Failure + /// # Errors /// /// If another user of this mutex panicked while holding the mutex, then /// this call will return an error instead. diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs index 3dbef43548136..63ef7732ad650 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -169,7 +169,7 @@ impl RwLock { /// Returns an RAII guard which will release this thread's shared access /// once it is dropped. /// - /// # Failure + /// # Errors /// /// This function will return an error if the RwLock is poisoned. An RwLock /// is poisoned whenever a writer panics while holding an exclusive lock. @@ -192,7 +192,7 @@ impl RwLock { /// This function does not provide any guarantees with respect to the ordering /// of whether contentious readers or writers will acquire the lock first. /// - /// # Failure + /// # Errors /// /// This function will return an error if the RwLock is poisoned. An RwLock /// is poisoned whenever a writer panics while holding an exclusive lock. An @@ -217,7 +217,7 @@ impl RwLock { /// Returns an RAII guard which will drop the write access of this rwlock /// when dropped. /// - /// # Failure + /// # Errors /// /// This function will return an error if the RwLock is poisoned. An RwLock /// is poisoned whenever a writer panics while holding an exclusive lock. @@ -240,7 +240,7 @@ impl RwLock { /// This function does not provide any guarantees with respect to the ordering /// of whether contentious readers or writers will acquire the lock first. /// - /// # Failure + /// # Errors /// /// This function will return an error if the RwLock is poisoned. An RwLock /// is poisoned whenever a writer panics while holding an exclusive lock. An @@ -269,7 +269,7 @@ impl RwLock { /// Consumes this `RwLock`, returning the underlying data. /// - /// # Failure + /// # Errors /// /// This function will return an error if the RwLock is poisoned. An RwLock /// is poisoned whenever a writer panics while holding an exclusive lock. An @@ -301,7 +301,7 @@ impl RwLock { /// Since this call borrows the `RwLock` mutably, no actual locking needs to /// take place---the mutable borrow statically guarantees no locks exist. /// - /// # Failure + /// # Errors /// /// This function will return an error if the RwLock is poisoned. An RwLock /// is poisoned whenever a writer panics while holding an exclusive lock. An diff --git a/src/libstd/sys/common/remutex.rs b/src/libstd/sys/common/remutex.rs index 31caa68c4b7ea..2e2be63c3cb5b 100644 --- a/src/libstd/sys/common/remutex.rs +++ b/src/libstd/sys/common/remutex.rs @@ -78,7 +78,7 @@ impl ReentrantMutex { /// calling this method already holds the lock, the call shall succeed without /// blocking. /// - /// # Failure + /// # Errors /// /// If another user of this mutex panicked while holding the mutex, then /// this call will return failure if the mutex would otherwise be @@ -95,7 +95,7 @@ impl ReentrantMutex { /// /// This function does not block. /// - /// # Failure + /// # Errors /// /// If another user of this mutex panicked while holding the mutex, then /// this call will return failure if the mutex would otherwise be From c0ace5dc16511a36fcfc0cf659959d4b0327d4f4 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Mon, 1 Feb 2016 11:26:23 -0500 Subject: [PATCH 22/22] Add doctests for directionality Thanks @nodakai --- src/libcollections/str.rs | 20 ++++++++++++++++++++ src/liblibc | 2 +- src/llvm | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 03474a45fead7..dcba0be4b17b0 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -1531,6 +1531,16 @@ impl str { /// /// assert_eq!("Hello\tworld\t", s.trim_left()); /// ``` + /// + /// Directionality: + /// + /// ``` + /// let s = " English"; + /// assert!(Some('E') == s.trim_left().chars().next()); + /// + /// let s = " עברית"; + /// assert!(Some('ע') == s.trim_left().chars().next()); + /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn trim_left(&self) -> &str { UnicodeStr::trim_left(self) @@ -1557,6 +1567,16 @@ impl str { /// /// assert_eq!(" Hello\tworld", s.trim_right()); /// ``` + /// + /// Directionality: + /// + /// ``` + /// let s = "English "; + /// assert!(Some('h') == s.trim_right().chars().rev().next()); + /// + /// let s = "עברית "; + /// assert!(Some('ת') == s.trim_right().chars().rev().next()); + /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn trim_right(&self) -> &str { UnicodeStr::trim_right(self) diff --git a/src/liblibc b/src/liblibc index af77843345ec6..30f70baa6cc1b 160000 --- a/src/liblibc +++ b/src/liblibc @@ -1 +1 @@ -Subproject commit af77843345ec6fc7e51113bfd692138d89024bc0 +Subproject commit 30f70baa6cc1ba3ddebb55b988fafbad0c0cc810 diff --git a/src/llvm b/src/llvm index 3564439515985..de5c31045dc0f 160000 --- a/src/llvm +++ b/src/llvm @@ -1 +1 @@ -Subproject commit 3564439515985dc1cc0d77057ed00901635a80ad +Subproject commit de5c31045dc0f6da1f65d02ee640ccf99ba90e7c