From cc762c29f388596180224be81c5d9a6df87c8740 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Tue, 29 Mar 2016 00:56:11 +0200 Subject: [PATCH 1/7] doc: first letter should be upper case --- src/libcollections/binary_heap.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcollections/binary_heap.rs b/src/libcollections/binary_heap.rs index ba317334cfa0b..cda30c092dc80 100644 --- a/src/libcollections/binary_heap.rs +++ b/src/libcollections/binary_heap.rs @@ -173,7 +173,7 @@ use vec::{self, Vec}; /// ``` /// use std::collections::BinaryHeap; /// -/// // type inference lets us omit an explicit type signature (which +/// // Type inference lets us omit an explicit type signature (which /// // would be `BinaryHeap` in this example). /// let mut heap = BinaryHeap::new(); /// From 0af3e708423ebac50b40e3288d4afcfe75f91cf3 Mon Sep 17 00:00:00 2001 From: Alex Burka Date: Tue, 29 Mar 2016 12:23:09 -0400 Subject: [PATCH 2/7] verb agreement in core::convert docs --- src/libcore/convert.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/libcore/convert.rs b/src/libcore/convert.rs index b4ac020795c38..2d999868f71ec 100644 --- a/src/libcore/convert.rs +++ b/src/libcore/convert.rs @@ -19,14 +19,14 @@ //! //! - Impl the `As*` traits for reference-to-reference conversions //! - Impl the `Into` trait when you want to consume the value in the conversion -//! - The `From` trait is the most flexible, useful for values _and_ references conversions +//! - The `From` trait is the most flexible, useful for value _and_ reference conversions //! -//! As a library writer, you should prefer implementing `From` rather than -//! `Into`, as `From` provides greater flexibility and offer the equivalent `Into` +//! As a library author, you should prefer implementing `From` rather than +//! `Into`, as `From` provides greater flexibility and offers an equivalent `Into` //! implementation for free, thanks to a blanket implementation in the standard library. //! //! **Note: these traits must not fail**. If the conversion can fail, you must use a dedicated -//! method which return an `Option` or a `Result`. +//! method which returns an `Option` or a `Result`. //! //! # Generic impl //! @@ -49,7 +49,7 @@ use marker::Sized; /// [book]: ../../book/borrow-and-asref.html /// /// **Note: this trait must not fail**. If the conversion can fail, use a dedicated method which -/// return an `Option` or a `Result`. +/// returns an `Option` or a `Result`. /// /// # Examples /// @@ -82,7 +82,7 @@ pub trait AsRef { /// A cheap, mutable reference-to-mutable reference conversion. /// /// **Note: this trait must not fail**. If the conversion can fail, use a dedicated method which -/// return an `Option` or a `Result`. +/// returns an `Option` or a `Result`. /// /// # Generic Impls /// @@ -99,10 +99,10 @@ pub trait AsMut { /// A conversion that consumes `self`, which may or may not be expensive. /// /// **Note: this trait must not fail**. If the conversion can fail, use a dedicated method which -/// return an `Option` or a `Result`. +/// returns an `Option` or a `Result`. /// -/// Library writer should not implement directly this trait, but should prefer the implementation -/// of the `From` trait, which offer greater flexibility and provide the equivalent `Into` +/// Library authors should not directly implement this trait, but should prefer implementing +/// the `From` trait, which offers greater flexibility and provides an equivalent `Into` /// implementation for free, thanks to a blanket implementation in the standard library. /// /// # Examples @@ -134,7 +134,7 @@ pub trait Into: Sized { /// Construct `Self` via a conversion. /// /// **Note: this trait must not fail**. If the conversion can fail, use a dedicated method which -/// return an `Option` or a `Result`. +/// returns an `Option` or a `Result`. /// /// # Examples /// From 05d0aa6dcc0a9f37eab1cd595d6f269fde750c20 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Tue, 29 Mar 2016 19:48:46 +0200 Subject: [PATCH 3/7] doc: fix typo --- COMPILER_TESTS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/COMPILER_TESTS.md b/COMPILER_TESTS.md index 1cae4ef090fe0..91975c1f9ed9a 100644 --- a/COMPILER_TESTS.md +++ b/COMPILER_TESTS.md @@ -77,7 +77,7 @@ fn test_foo() { } ``` -Note that not all headers have meaning when customized too a revision. +Note that not all headers have meaning when customized to a revision. For example, the `ignore-test` header (and all "ignore" headers) currently only apply to the test as a whole, not to particular revisions. The only headers that are intended to really work when From cd92e9f9668dd17e281ef0f2422635adc7c8fd48 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Tue, 29 Mar 2016 19:59:55 +0200 Subject: [PATCH 4/7] doc: "mut" not needed for the examples --- src/doc/book/vectors.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/doc/book/vectors.md b/src/doc/book/vectors.md index ceb6b3c003e52..e96dddf8c82cf 100644 --- a/src/doc/book/vectors.md +++ b/src/doc/book/vectors.md @@ -116,11 +116,11 @@ for i in v { ``` Note: You cannot use the vector again once you have iterated by taking ownership of the vector. -You can iterate the vector multiple times by taking a reference to the vector whilst iterating. +You can iterate the vector multiple times by taking a reference to the vector whilst iterating. For example, the following code does not compile. ```rust,ignore -let mut v = vec![1, 2, 3, 4, 5]; +let v = vec![1, 2, 3, 4, 5]; for i in v { println!("Take ownership of the vector and its element {}", i); @@ -134,7 +134,7 @@ for i in v { Whereas the following works perfectly, ```rust -let mut v = vec![1, 2, 3, 4, 5]; +let v = vec![1, 2, 3, 4, 5]; for i in &v { println!("This is a reference to {}", i); From e9b1c3ccb5fbae3d61d4ba0c1d650763dcda3923 Mon Sep 17 00:00:00 2001 From: Christopher Serr Date: Tue, 29 Mar 2016 22:28:17 +0200 Subject: [PATCH 5/7] Fix panic_fmt in the Book While implementing panic_fmt for the GameCube I noticed that the parameters given to it were completely broken. Turns out that panic_fmt requires the C ABI to work correctly. This should be fixed in the documentation, so that others don't make the same mistake. Thanks to mbrubeck in the IRC for helping me figure this out. Not specifying extern for lang_items correctly should potentially also be a compiler error. --- src/doc/book/no-stdlib.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/doc/book/no-stdlib.md b/src/doc/book/no-stdlib.md index 610940cde95e6..43bd0507ebbb6 100644 --- a/src/doc/book/no-stdlib.md +++ b/src/doc/book/no-stdlib.md @@ -38,7 +38,7 @@ fn start(_argc: isize, _argv: *const *const u8) -> isize { // for a bare-bones hello world. These are normally // provided by libstd. #[lang = "eh_personality"] extern fn eh_personality() {} -#[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} } +#[lang = "panic_fmt"] extern fn panic_fmt() -> ! { loop {} } # #[lang = "eh_unwind_resume"] extern fn rust_eh_unwind_resume() {} # #[no_mangle] pub extern fn rust_eh_register_frames () {} # #[no_mangle] pub extern fn rust_eh_unregister_frames () {} @@ -65,7 +65,7 @@ pub extern fn main(argc: i32, argv: *const *const u8) -> i32 { } #[lang = "eh_personality"] extern fn eh_personality() {} -#[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} } +#[lang = "panic_fmt"] extern fn panic_fmt() -> ! { loop {} } # #[lang = "eh_unwind_resume"] extern fn rust_eh_unwind_resume() {} # #[no_mangle] pub extern fn rust_eh_register_frames () {} # #[no_mangle] pub extern fn rust_eh_unregister_frames () {} From 65cdf5d44d7623e6bcf7d81f48f251ee907c2f04 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Wed, 30 Mar 2016 09:01:21 +0200 Subject: [PATCH 6/7] doc: "of the" seems more correct than "to the" It's also less ambiguous --- src/libstd/env.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/libstd/env.rs b/src/libstd/env.rs index 749e58c11962b..40f6528f63efb 100644 --- a/src/libstd/env.rs +++ b/src/libstd/env.rs @@ -416,7 +416,7 @@ impl Error for JoinPathsError { fn description(&self) -> &str { self.inner.description() } } -/// Returns the path to the current user's home directory if known. +/// Returns the path of the current user's home directory if known. /// /// # Unix /// @@ -450,7 +450,7 @@ pub fn home_dir() -> Option { os_imp::home_dir() } -/// Returns the path to a temporary directory. +/// Returns the path of a temporary directory. /// /// On Unix, returns the value of the 'TMPDIR' environment variable if it is /// set, otherwise for non-Android it returns '/tmp'. If Android, since there @@ -459,7 +459,7 @@ pub fn home_dir() -> Option { /// /// On Windows, returns the value of, in order, the 'TMP', 'TEMP', /// 'USERPROFILE' environment variable if any are set and not the empty -/// string. Otherwise, tmpdir returns the path to the Windows directory. This +/// string. Otherwise, tmpdir returns the path of the Windows directory. This /// behavior is identical to that of [GetTempPath][msdn], which this function /// uses internally. /// @@ -482,14 +482,14 @@ pub fn temp_dir() -> PathBuf { os_imp::temp_dir() } -/// Returns the full filesystem path to the current running executable. +/// Returns the full filesystem path of the current running executable. /// -/// The path returned is not necessarily a "real path" to the executable as +/// The path returned is not necessarily a "real path" of the executable as /// there may be intermediate symlinks. /// /// # Errors /// -/// Acquiring the path to the current executable is a platform-specific operation +/// Acquiring the path of the current executable is a platform-specific operation /// that can fail for a good number of reasons. Some errors can include, but not /// be limited to, filesystem operations failing or general syscall failures. /// @@ -526,7 +526,7 @@ pub struct ArgsOs { inner: os_imp::Args } /// Returns the arguments which this program was started with (normally passed /// via the command line). /// -/// The first element is traditionally the path to the executable, but it can be +/// The first element is traditionally the path of the executable, but it can be /// set to arbitrary text, and may not even exist. This means this property should /// not be relied upon for security purposes. /// @@ -554,7 +554,7 @@ pub fn args() -> Args { /// Returns the arguments which this program was started with (normally passed /// via the command line). /// -/// The first element is traditionally the path to the executable, but it can be +/// The first element is traditionally the path of the executable, but it can be /// set to arbitrary text, and it may not even exist, so this property should /// not be relied upon for security purposes. /// From fd78ae860f64c0e5dc6448add8457d4c77588ee5 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Tue, 29 Mar 2016 00:55:04 +0200 Subject: [PATCH 7/7] doc: no need for an explicit iter() --- src/libcollections/binary_heap.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcollections/binary_heap.rs b/src/libcollections/binary_heap.rs index ba317334cfa0b..97b76d9447600 100644 --- a/src/libcollections/binary_heap.rs +++ b/src/libcollections/binary_heap.rs @@ -194,7 +194,7 @@ use vec::{self, Vec}; /// /// // We can iterate over the items in the heap, although they are returned in /// // a random order. -/// for x in heap.iter() { +/// for x in &heap { /// println!("{}", x); /// } ///