From 2d7abe88bfa6b36be6ba020f87a1f391c7266daa Mon Sep 17 00:00:00 2001 From: Jonathan L Date: Fri, 1 Jul 2016 13:16:27 -0700 Subject: [PATCH 1/8] Update glossary.md Added a brief description of Combinators --- src/doc/book/glossary.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/doc/book/glossary.md b/src/doc/book/glossary.md index 0956580ade0bb..8aa7fdff94803 100644 --- a/src/doc/book/glossary.md +++ b/src/doc/book/glossary.md @@ -46,6 +46,12 @@ must abide by that constraint. [traits]: traits.html +### Combinators + +Combinators are higher-order functions that apply only functions and +earlier defined combinators to provide a result from its arguments. +They can be used to manage control flow in a modular fashion. + ### DST (Dynamically Sized Type) A type without a statically known size or alignment. ([more info][link]) From a0e01cc3700970bc996aaaf3fdf57f704bacf33e Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Sat, 2 Jul 2016 09:50:19 -0400 Subject: [PATCH 2/8] Add doc examples for `io::Error::from_raw_os_error`. --- src/libstd/io/error.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/libstd/io/error.rs b/src/libstd/io/error.rs index e142c78569bd7..f410bc3b147b8 100644 --- a/src/libstd/io/error.rs +++ b/src/libstd/io/error.rs @@ -214,6 +214,30 @@ impl Error { } /// Creates a new instance of an `Error` from a particular OS error code. + /// + /// # Examples + /// + /// On Unix: + /// + /// ``` + /// # if cfg!(unix) { + /// use std::io; + /// + /// let error = io::Error::from_raw_os_error(98); + /// assert_eq!(error.kind(), io::ErrorKind::AddrInUse); + /// # } + /// ``` + /// + /// On Windows: + /// + /// ``` + /// # if cfg!(windows) { + /// use std::io; + /// + /// let error = io::Error::from_raw_os_error(10048); + /// assert_eq!(error.kind(), io::ErrorKind::AddrInUse); + /// # } + /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn from_raw_os_error(code: i32) -> Error { Error { repr: Repr::Os(code) } From bdea7054653237c06be48643430e318dedb61ca5 Mon Sep 17 00:00:00 2001 From: Hariharan R Date: Sat, 2 Jul 2016 20:36:41 +0530 Subject: [PATCH 3/8] update cargo doc link updated proper link of cargo doc that contains details about list of options available in semantic versioninig for the dependencies section in Cargo.toml --- src/doc/book/guessing-game.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/book/guessing-game.md b/src/doc/book/guessing-game.md index c759ff9bdbde4..6ce75efd1031d 100644 --- a/src/doc/book/guessing-game.md +++ b/src/doc/book/guessing-game.md @@ -370,7 +370,7 @@ We could also use a range of versions. [Cargo’s documentation][cargodoc] contains more details. [semver]: http://semver.org -[cargodoc]: http://doc.crates.io/crates-io.html +[cargodoc]: http://doc.crates.io/specifying-dependencies.html Now, without changing any of our code, let’s build our project: From c6a04d9ba44d98de58dff18684463ce9d9b2b22d Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Sat, 2 Jul 2016 20:15:28 -0400 Subject: [PATCH 4/8] Fix broken markdown link in README. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9463b0e849856..384795608db76 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ build. [MSYS2][msys2] can be used to easily build Rust on Windows: -msys2: https://msys2.github.io/ +[msys2]: https://msys2.github.io/ 1. Grab the latest [MSYS2 installer][msys2] and go through the installer. From 5dfd79a8e624670f041e648ec2ac140699ea5322 Mon Sep 17 00:00:00 2001 From: Jared Manning Date: Sun, 3 Jul 2016 03:01:18 -0500 Subject: [PATCH 5/8] Fix spacing in for loop enumeration example Add a space between the comma and j in (i, j) to make it look nice. --- src/doc/book/loops.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/book/loops.md b/src/doc/book/loops.md index e23e6f3a786a5..e681d1bee0618 100644 --- a/src/doc/book/loops.md +++ b/src/doc/book/loops.md @@ -105,7 +105,7 @@ When you need to keep track of how many times you already looped, you can use th #### On ranges: ```rust -for (i,j) in (5..10).enumerate() { +for (i, j) in (5..10).enumerate() { println!("i = {} and j = {}", i, j); } ``` From 872d107dea229fdeaae2cf3d904fb348d6f75dde Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 3 Jul 2016 10:00:52 +0200 Subject: [PATCH 6/8] Fix a few typos in the code --- src/librustdoc/html/highlight.rs | 2 +- src/librustdoc/html/render.rs | 2 +- src/libstd/memchr.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs index 2e2f99897733d..70447bf35881f 100644 --- a/src/librustdoc/html/highlight.rs +++ b/src/librustdoc/html/highlight.rs @@ -107,7 +107,7 @@ pub enum Class { /// /// The classifier will call into the `Writer` implementation as it finds spans /// of text to highlight. Exactly how that text should be highlighted is up to -/// the implemention. +/// the implementation. pub trait Writer { /// Called when we start processing a span of text that should be highlighted. /// The `Class` argument specifies how it should be highlighted. diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 9f2b33c0282ed..bc1984827c6d7 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -2721,7 +2721,7 @@ impl<'a> fmt::Display for Sidebar<'a> { let parentlen = cx.current.len() - if it.is_mod() {1} else {0}; // the sidebar is designed to display sibling functions, modules and - // other miscellaneous informations. since there are lots of sibling + // other miscellaneous information. since there are lots of sibling // items (and that causes quadratic growth in large modules), // we refactor common parts into a shared JavaScript file per module. // still, we don't move everything into JS because we want to preserve diff --git a/src/libstd/memchr.rs b/src/libstd/memchr.rs index 1d97611eabb26..a408b4378e19e 100644 --- a/src/libstd/memchr.rs +++ b/src/libstd/memchr.rs @@ -239,7 +239,7 @@ mod fallback { text[..offset].iter().rposition(|elt| *elt == x) } - // test fallback implementations on all plattforms + // test fallback implementations on all platforms #[test] fn matches_one() { assert_eq!(Some(0), memchr(b'a', b"a")); From 3fcb64927750b8c4bccd866ec137500de2e7aea3 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 3 Jul 2016 10:00:19 +0200 Subject: [PATCH 7/8] Fix a few typos in the doc --- src/doc/book/closures.md | 4 ++-- src/doc/book/testing.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/doc/book/closures.md b/src/doc/book/closures.md index a6b4e9492181c..e8c88b7db0699 100644 --- a/src/doc/book/closures.md +++ b/src/doc/book/closures.md @@ -339,7 +339,7 @@ fn call_with_ref<'a, F>(some_closure:F) -> i32 where F: Fn(&'a 32) -> i32 { ``` -However this presents a problem with in our case. When you specify the explict +However this presents a problem with in our case. When you specify the explicit lifetime on a function it binds that lifetime to the *entire* scope of the function instead of just the invocation scope of our closure. This means that the borrow checker will see a mutable reference in the same lifetime as our immutable reference and fail @@ -354,7 +354,7 @@ fn call_with_ref(some_closure:F) -> i32 ``` This lets the Rust compiler find the minimum lifetime to invoke our closure and -satisfy the borrow checker's rules. Our function then compiles and excutes as we +satisfy the borrow checker's rules. Our function then compiles and executes as we expect. ```rust diff --git a/src/doc/book/testing.md b/src/doc/book/testing.md index 7954085472e50..86729147ed065 100644 --- a/src/doc/book/testing.md +++ b/src/doc/book/testing.md @@ -431,7 +431,7 @@ one. Cargo will ignore files in subdirectories of the `tests/` directory. Therefore shared modules in integrations tests are possible. -For example `tests/common/mod.rs` is not seperatly compiled by cargo but can +For example `tests/common/mod.rs` is not separately compiled by cargo but can be imported in every test with `mod common;` That's all there is to the `tests` directory. The `tests` module isn't needed From 5efc780e146f51a87b1137adb116c825d87e07a3 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Sun, 3 Jul 2016 22:03:45 +0200 Subject: [PATCH 8/8] doc: fix and shorten comment --- src/librustc_resolve/lib.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index ed400af66855a..18f2dbb23b2b1 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -2892,8 +2892,7 @@ impl<'a> Resolver<'a> { if !msg.is_empty() { msg = format!(". Did you mean {}?", msg); } else { - // we check if this a module and if so, we display a help - // message + // we display a help message if this is a module let name_path = path.segments.iter() .map(|seg| seg.identifier.name) .collect::>();