From eb2343f25b07dd1760d50546d7979a39c363ff09 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Mon, 11 Jan 2016 08:48:35 -0500 Subject: [PATCH 1/8] Be a bit more correct about segfault causality Fixes #30819 --- src/doc/book/unsafe.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/doc/book/unsafe.md b/src/doc/book/unsafe.md index 1b223365bd63a..63e92316f370e 100644 --- a/src/doc/book/unsafe.md +++ b/src/doc/book/unsafe.md @@ -41,8 +41,8 @@ unsafe impl Scary for i32 {} ``` It’s important to be able to explicitly delineate code that may have bugs that -cause big problems. If a Rust program segfaults, you can be sure it’s somewhere -in the sections marked `unsafe`. +cause big problems. If a Rust program segfaults, you can be sure the cause is +related to something marked `unsafe`. # What does ‘safe’ mean? From b986698bc41f487ed791a7c7d9f6c6a78d6d86a3 Mon Sep 17 00:00:00 2001 From: Sergey Veselkov Date: Wed, 13 Jan 2016 09:14:21 +0300 Subject: [PATCH 2/8] Fix typo in bibliography.md --- src/doc/book/bibliography.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/book/bibliography.md b/src/doc/book/bibliography.md index ba02053b6b894..d32b1a91944e4 100644 --- a/src/doc/book/bibliography.md +++ b/src/doc/book/bibliography.md @@ -33,7 +33,7 @@ Rust, as well as publications about Rust. * [Non-blocking steal-half work queues](http://www.cs.bgu.ac.il/%7Ehendlerd/papers/p280-hendler.pdf) * [Reagents: expressing and composing fine-grained concurrency](http://www.mpi-sws.org/~turon/reagents.pdf) * [Algorithms for scalable synchronization of shared-memory multiprocessors](https://www.cs.rochester.edu/u/scott/papers/1991_TOCS_synch.pdf) -* [Epoc-based reclamation](https://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-579.pdf). +* [Epoch-based reclamation](https://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-579.pdf). ### Others From 3ae71b1b69e3bf9855deac8151e75fa7eba30206 Mon Sep 17 00:00:00 2001 From: Oliver 'ker' Schneider Date: Mon, 28 Dec 2015 19:55:56 +0100 Subject: [PATCH 3/8] the reference was inferring values that didn't fit into their target type --- src/doc/reference.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/doc/reference.md b/src/doc/reference.md index 5f71ee4437958..87104b4526f72 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -3677,10 +3677,10 @@ sites are: * `let` statements where an explicit type is given. - For example, `128` is coerced to have type `i8` in the following: + For example, `42` is coerced to have type `i8` in the following: ```rust - let _: i8 = 128; + let _: i8 = 42; ``` * `static` and `const` statements (similar to `let` statements). @@ -3690,36 +3690,36 @@ sites are: The value being coerced is the actual parameter, and it is coerced to the type of the formal parameter. - For example, `128` is coerced to have type `i8` in the following: + For example, `42` is coerced to have type `i8` in the following: ```rust fn bar(_: i8) { } fn main() { - bar(128); + bar(42); } ``` * Instantiations of struct or variant fields - For example, `128` is coerced to have type `i8` in the following: + For example, `42` is coerced to have type `i8` in the following: ```rust struct Foo { x: i8 } fn main() { - Foo { x: 128 }; + Foo { x: 42 }; } ``` * Function results, either the final line of a block if it is not semicolon-terminated or any expression in a `return` statement - For example, `128` is coerced to have type `i8` in the following: + For example, `42` is coerced to have type `i8` in the following: ```rust fn foo() -> i8 { - 128 + 42 } ``` From 33b12be8b588214d2d51f12460ea87cbe4efe727 Mon Sep 17 00:00:00 2001 From: Alex Burka Date: Wed, 13 Jan 2016 13:50:41 -0500 Subject: [PATCH 4/8] update tracking issue for collections_range --- src/libcollections/range.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libcollections/range.rs b/src/libcollections/range.rs index c70aa67366b34..afcd779ddf19f 100644 --- a/src/libcollections/range.rs +++ b/src/libcollections/range.rs @@ -8,8 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![unstable(feature = "collections_range", reason = "was just added", - issue = "27711")] +#![unstable(feature = "collections_range", + reason = "waiting for dust to settle on inclusive ranges", + issue = "30877")] //! Range syntax. From a933526fc4526d63d92b181365b1a4f7c248611e Mon Sep 17 00:00:00 2001 From: Dave Huseby Date: Wed, 13 Jan 2016 09:32:19 -0800 Subject: [PATCH 5/8] Fixes #30873 --- mk/cfg/x86_64-unknown-bitrig.mk | 2 +- src/libstd/lib.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/mk/cfg/x86_64-unknown-bitrig.mk b/mk/cfg/x86_64-unknown-bitrig.mk index dd6d19f7491bb..afffec1a53a91 100644 --- a/mk/cfg/x86_64-unknown-bitrig.mk +++ b/mk/cfg/x86_64-unknown-bitrig.mk @@ -8,7 +8,7 @@ CFG_STATIC_LIB_NAME_x86_64-unknown-bitrig=lib$(1).a CFG_LIB_GLOB_x86_64-unknown-bitrig=lib$(1)-*.so CFG_LIB_DSYM_GLOB_x86_64-unknown-bitrig=$(1)-*.dylib.dSYM CFG_JEMALLOC_CFLAGS_x86_64-unknown-bitrig := -m64 -I/usr/include $(CFLAGS) -CFG_GCCISH_CFLAGS_x86_64-unknown-bitrig := -Wall -Werror -fPIC -m64 -I/usr/include $(CFLAGS) +CFG_GCCISH_CFLAGS_x86_64-unknown-bitrig := -Wall -Werror -fPIE -fPIC -m64 -I/usr/include $(CFLAGS) CFG_GCCISH_LINK_FLAGS_x86_64-unknown-bitrig := -shared -pic -pthread -m64 $(LDFLAGS) CFG_GCCISH_DEF_FLAG_x86_64-unknown-bitrig := -Wl,--export-dynamic,--dynamic-list= CFG_LLC_FLAGS_x86_64-unknown-bitrig := diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 824acda522f3c..f1b77986b65ae 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -410,6 +410,7 @@ pub mod num; pub mod thread; pub mod collections; +#[cfg(any(target_os = "linux", target_os = "windows"))] pub mod dynamic_lib; pub mod env; pub mod ffi; From 5ecccb109410c9329d4c9924c1e357ee1e8082ff Mon Sep 17 00:00:00 2001 From: Dave Huseby Date: Wed, 13 Jan 2016 11:23:33 -0800 Subject: [PATCH 6/8] removing the conditional compilation of the dynamic_lib reference --- src/libstd/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index f1b77986b65ae..824acda522f3c 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -410,7 +410,6 @@ pub mod num; pub mod thread; pub mod collections; -#[cfg(any(target_os = "linux", target_os = "windows"))] pub mod dynamic_lib; pub mod env; pub mod ffi; From 01cbdf4481915948773a8abfb67bcc1a44571dab Mon Sep 17 00:00:00 2001 From: Oliver Middleton Date: Wed, 13 Jan 2016 23:19:24 +0000 Subject: [PATCH 7/8] Fix some broken and missing links in the docs --- src/libcollections/lib.rs | 2 +- src/libcollections/str.rs | 2 +- src/libcollections/string.rs | 11 +++++++---- src/libcore/iter.rs | 2 +- src/librustc_unicode/char.rs | 8 ++++---- src/libstd/io/mod.rs | 26 +++++++++++++------------- 6 files changed, 27 insertions(+), 24 deletions(-) diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs index 370857287d6e6..8b876df32af52 100644 --- a/src/libcollections/lib.rs +++ b/src/libcollections/lib.rs @@ -10,7 +10,7 @@ //! Collection types. //! -//! See [std::collections](../std/collections) for a detailed discussion of +//! See [std::collections](../std/collections/index.html) for a detailed discussion of //! collections in Rust. #![crate_name = "collections"] diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index f3bdb0efeef1d..766867f284ee1 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -1384,7 +1384,7 @@ impl str { /// /// For iterating from the front, the [`matches()`] method can be used. /// - /// [`matches`]: #method.matches + /// [`matches()`]: #method.matches /// /// # Examples /// diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index d2cbcad875f34..a611110a91a67 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -62,6 +62,7 @@ use boxed::Box; /// hello.push_str("orld!"); /// ``` /// +/// [`char`]: ../primitive.char.html /// [`push()`]: #method.push /// [`push_str()`]: #method.push_str /// @@ -163,8 +164,8 @@ use boxed::Box; /// ``` /// /// [`as_ptr()`]: #method.as_ptr -/// [`len()`]: # method.len -/// [`capacity()`]: # method.capacity +/// [`len()`]: #method.len +/// [`capacity()`]: #method.capacity /// /// If a `String` has enough capacity, adding elements to it will not /// re-allocate. For example, consider this program: @@ -444,7 +445,7 @@ impl String { /// Converts a slice of bytes to a `String`, including invalid characters. /// /// A string slice ([`&str`]) is made of bytes ([`u8`]), and a slice of - /// bytes ([`&[u8]`]) is made of bytes, so this function converts between + /// bytes ([`&[u8]`][byteslice]) is made of bytes, so this function converts between /// the two. Not all byte slices are valid string slices, however: [`&str`] /// requires that it is valid UTF-8. During this conversion, /// `from_utf8_lossy()` will replace any invalid UTF-8 sequences with @@ -452,7 +453,7 @@ impl String { /// /// [`&str`]: ../primitive.str.html /// [`u8`]: ../primitive.u8.html - /// [`&[u8]`]: ../primitive.slice.html + /// [byteslice]: ../primitive.slice.html /// /// If you are sure that the byte slice is valid UTF-8, and you don't want /// to incur the overhead of the conversion, there is an unsafe version @@ -1311,6 +1312,8 @@ impl FromUtf8Error { /// /// [`Utf8Error`]: ../str/struct.Utf8Error.html /// [`std::str`]: ../str/index.html + /// [`u8`]: ../primitive.u8.html + /// [`&str`]: ../primitive.str.html /// /// # Examples /// diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index c3bea05055803..e3e783329ec81 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -1358,7 +1358,7 @@ pub trait Iterator { /// One of the keys to `collect()`'s power is that many things you might /// not think of as 'collections' actually are. For example, a [`String`] /// is a collection of [`char`]s. And a collection of [`Result`] can - /// be thought of as single [`Result, E>`]. See the examples + /// be thought of as single `Result, E>`. See the examples /// below for more. /// /// [`String`]: ../string/struct.String.html diff --git a/src/librustc_unicode/char.rs b/src/librustc_unicode/char.rs index 66f8068eae657..46ecd3a80b5d1 100644 --- a/src/librustc_unicode/char.rs +++ b/src/librustc_unicode/char.rs @@ -46,8 +46,8 @@ pub use tables::UNICODE_VERSION; /// This `struct` is created by the [`to_lowercase()`] method on [`char`]. See /// its documentation for more. /// -/// [`to_lowercase()`]: primitive.char.html#method.escape_to_lowercase -/// [`char`]: primitive.char.html +/// [`to_lowercase()`]: ../primitive.char.html#method.to_lowercase +/// [`char`]: ../primitive.char.html #[stable(feature = "rust1", since = "1.0.0")] pub struct ToLowercase(CaseMappingIter); @@ -64,8 +64,8 @@ impl Iterator for ToLowercase { /// This `struct` is created by the [`to_uppercase()`] method on [`char`]. See /// its documentation for more. /// -/// [`to_uppercase()`]: primitive.char.html#method.escape_to_uppercase -/// [`char`]: primitive.char.html +/// [`to_uppercase()`]: ../primitive.char.html#method.to_uppercase +/// [`char`]: ../primitive.char.html #[stable(feature = "rust1", since = "1.0.0")] pub struct ToUppercase(CaseMappingIter); diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index b5ba6ff54c0e3..40533117f06c2 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -112,7 +112,7 @@ //! ``` //! //! `BufWriter` doesn't add any new ways of writing; it just buffers every call -//! to [`write()`][write]: +//! to [`write()`][write()]: //! //! ``` //! use std::io; @@ -134,7 +134,7 @@ //! # } //! ``` //! -//! [write]: trait.Write.html#tymethod.write +//! [write()]: trait.Write.html#tymethod.write //! //! ## Standard input and output //! @@ -399,7 +399,7 @@ fn read_to_end(r: &mut R, buf: &mut Vec) -> Result /// /// [`File`][file]s implement `Read`: /// -/// [file]: ../std/fs/struct.File.html +/// [file]: ../fs/struct.File.html /// /// ``` /// use std::io; @@ -459,7 +459,7 @@ pub trait Read { /// /// [`File`][file]s implement `Read`: /// - /// [file]: ../std/fs/struct.File.html + /// [file]: ../fs/struct.File.html /// /// ``` /// use std::io; @@ -501,7 +501,7 @@ pub trait Read { /// /// [`File`][file]s implement `Read`: /// - /// [file]: ../std/fs/struct.File.html + /// [file]: ../fs/struct.File.html /// /// ``` /// use std::io; @@ -540,7 +540,7 @@ pub trait Read { /// /// [`File`][file]s implement `Read`: /// - /// [file]: ../std/fs/struct.File.html + /// [file]: ../fs/struct.File.html /// /// ``` /// use std::io; @@ -600,7 +600,7 @@ pub trait Read { /// /// [`File`][file]s implement `Read`: /// - /// [file]: ../std/fs/struct.File.html + /// [file]: ../fs/struct.File.html /// /// ``` /// use std::io; @@ -643,7 +643,7 @@ pub trait Read { /// /// [`File`][file]s implement `Read`: /// - /// [file]: ../std/fs/struct.File.html + /// [file]: ../fs/struct.File.html /// /// ``` /// use std::io; @@ -682,7 +682,7 @@ pub trait Read { /// /// [`File`][file]s implement `Read`: /// - /// [file]: ../std/fs/struct.File.html + /// [file]: ../fs/struct.File.html /// /// ``` /// use std::io; @@ -718,7 +718,7 @@ pub trait Read { /// /// [`File`][file]s implement `Read`: /// - /// [file]: ../std/fs/struct.File.html + /// [file]: ../fs/struct.File.html /// /// ``` /// #![feature(io)] @@ -753,7 +753,7 @@ pub trait Read { /// /// [`File`][file]s implement `Read`: /// - /// [file]: ../std/fs/struct.File.html + /// [file]: ../fs/struct.File.html /// /// ``` /// use std::io; @@ -789,7 +789,7 @@ pub trait Read { /// /// [`File`][file]s implement `Read`: /// - /// [file]: ../std/fs/struct.File.html + /// [file]: ../fs/struct.File.html /// /// ``` /// use std::io; @@ -823,7 +823,7 @@ pub trait Read { /// /// [`File`][file]s implement `Read`: /// - /// [file]: ../std/fs/struct.File.html + /// [file]: ../fs/struct.File.html /// /// ``` /// #![feature(io)] From 6a4f3b2335465aa0f13d66b38bd9b58742c75719 Mon Sep 17 00:00:00 2001 From: Jake Goulding Date: Wed, 13 Jan 2016 21:23:07 -0500 Subject: [PATCH 8/8] Improve grammar of Box::{into,from}_raw docs --- src/liballoc/boxed.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 1afb49d9184b5..efc28be92a45b 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -237,17 +237,17 @@ impl Box { } impl Box { - /// Constructs a box from the raw pointer. + /// Constructs a box from a raw pointer. /// - /// After this function call, pointer is owned by resulting box. - /// In particular, it means that `Box` destructor calls destructor - /// of `T` and releases memory. Since the way `Box` allocates and - /// releases memory is unspecified, the only valid pointer to pass - /// to this function is the one taken from another `Box` with - /// `Box::into_raw` function. + /// After calling this function, the raw pointer is owned by the + /// resulting `Box`. Specifically, the `Box` destructor will call + /// the destructor of `T` and free the allocated memory. Since the + /// way `Box` allocates and releases memory is unspecified, the + /// only valid pointer to pass to this function is the one taken + /// from another `Box` via the `Box::into_raw` function. /// - /// Function is unsafe, because improper use of this function may - /// lead to memory problems like double-free, for example if the + /// This function is unsafe because improper use may lead to + /// memory problems. For example, a double-free may occur if the /// function is called twice on the same raw pointer. #[stable(feature = "box_raw", since = "1.4.0")] #[inline] @@ -257,11 +257,11 @@ impl Box { /// Consumes the `Box`, returning the wrapped raw pointer. /// - /// After call to this function, caller is responsible for the memory - /// previously managed by `Box`, in particular caller should properly - /// destroy `T` and release memory. The proper way to do it is to - /// convert pointer back to `Box` with `Box::from_raw` function, because - /// `Box` does not specify, how memory is allocated. + /// After calling this function, the caller is responsible for the + /// memory previously managed by the `Box`. In particular, the + /// caller should properly destroy `T` and release the memory. The + /// proper way to do so is to convert the raw pointer back into a + /// `Box` with the `Box::from_raw` function. /// /// # Examples ///