From 302de36c8f647bd394d75f1ab28255f00c8d703a Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Tue, 13 Oct 2015 13:49:53 -0400 Subject: [PATCH 1/6] Properly link up iterator documentation Due to the way iterators work, the std::iter module is chock full of structs that you, humble Rust programmer, will never actually use. However, they have URLs, and therefore get linked to, because they are real structs that do exist. So, rather than just have a tiny sentence about each one of them, this patch adds links back to the functions and methods on Iterator which actually create the structs, where helpful documentation already exists. --- src/libcore/iter.rs | 157 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 137 insertions(+), 20 deletions(-) diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 2f12579d67411..d54817f5201e1 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -1618,7 +1618,13 @@ impl ExactSizeIterator for Map where impl ExactSizeIterator for Zip where A: ExactSizeIterator, B: ExactSizeIterator {} -/// An double-ended iterator with the direction inverted +/// An double-ended iterator with the direction inverted. +/// +/// This `struct` is created by the [`rev()`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`rev()`]: trait.Iterator.html#method.rev +/// [`Iterator`]: trait.Iterator.html #[derive(Clone)] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[stable(feature = "rust1", since = "1.0.0")] @@ -1642,7 +1648,13 @@ impl DoubleEndedIterator for Rev where I: DoubleEndedIterator { fn next_back(&mut self) -> Option<::Item> { self.iter.next() } } -/// An iterator that clones the elements of an underlying iterator +/// An iterator that clones the elements of an underlying iterator. +/// +/// This `struct` is created by the [`cloned()`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`cloned()`]: trait.Iterator.html#method.cloned +/// [`Iterator`]: trait.Iterator.html #[stable(feature = "iter_cloned", since = "1.1.0")] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[derive(Clone)] @@ -1679,7 +1691,13 @@ impl<'a, I, T: 'a> ExactSizeIterator for Cloned where I: ExactSizeIterator, T: Clone {} -/// An iterator that repeats endlessly +/// An iterator that repeats endlessly. +/// +/// This `struct` is created by the [`cycle()`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`cycle()`]: trait.Iterator.html#method.cycle +/// [`Iterator`]: trait.Iterator.html #[derive(Clone)] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[stable(feature = "rust1", since = "1.0.0")] @@ -1711,7 +1729,13 @@ impl Iterator for Cycle where I: Clone + Iterator { } } -/// An iterator that strings two iterators together +/// An iterator that strings two iterators together. +/// +/// This `struct` is created by the [`chain()`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`chain()`]: trait.Iterator.html#method.chain +/// [`Iterator`]: trait.Iterator.html #[derive(Clone)] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[stable(feature = "rust1", since = "1.0.0")] @@ -1849,7 +1873,13 @@ impl DoubleEndedIterator for Chain where } } -/// An iterator that iterates two other iterators simultaneously +/// An iterator that iterates two other iterators simultaneously. +/// +/// This `struct` is created by the [`zip()`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`zip()`]: trait.Iterator.html#method.zip +/// [`Iterator`]: trait.Iterator.html #[derive(Clone)] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[stable(feature = "rust1", since = "1.0.0")] @@ -1915,7 +1945,13 @@ impl DoubleEndedIterator for Zip where } } -/// An iterator that maps the values of `iter` with `f` +/// An iterator that maps the values of `iter` with `f`. +/// +/// This `struct` is created by the [`map()`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`map()`]: trait.Iterator.html#method.map +/// [`Iterator`]: trait.Iterator.html #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[stable(feature = "rust1", since = "1.0.0")] #[derive(Clone)] @@ -1949,7 +1985,13 @@ impl DoubleEndedIterator for Map where } } -/// An iterator that filters the elements of `iter` with `predicate` +/// An iterator that filters the elements of `iter` with `predicate`. +/// +/// This `struct` is created by the [`filter()`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`filter()`]: trait.Iterator.html#method.filter +/// [`Iterator`]: trait.Iterator.html #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[stable(feature = "rust1", since = "1.0.0")] #[derive(Clone)] @@ -1994,7 +2036,13 @@ impl DoubleEndedIterator for Filter } } -/// An iterator that uses `f` to both filter and map elements from `iter` +/// An iterator that uses `f` to both filter and map elements from `iter`. +/// +/// This `struct` is created by the [`filter_map()`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`filter_map()`]: trait.Iterator.html#method.filter_map +/// [`Iterator`]: trait.Iterator.html #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[stable(feature = "rust1", since = "1.0.0")] #[derive(Clone)] @@ -2041,7 +2089,13 @@ impl DoubleEndedIterator for FilterMap } } -/// An iterator that yields the current count and the element during iteration +/// An iterator that yields the current count and the element during iteration. +/// +/// This `struct` is created by the [`enumerate()`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`enumerate()`]: trait.Iterator.html#method.enumerate +/// [`Iterator`]: trait.Iterator.html #[derive(Clone)] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[stable(feature = "rust1", since = "1.0.0")] @@ -2108,7 +2162,14 @@ impl DoubleEndedIterator for Enumerate where } } -/// An iterator with a `peek()` that returns an optional reference to the next element. +/// An iterator with a `peek()` that returns an optional reference to the next +/// element. +/// +/// This `struct` is created by the [`peekable()`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`peekable()`]: trait.Iterator.html#method.peekable +/// [`Iterator`]: trait.Iterator.html #[derive(Clone)] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[stable(feature = "rust1", since = "1.0.0")] @@ -2190,7 +2251,13 @@ impl Peekable { } } -/// An iterator that rejects elements while `predicate` is true +/// An iterator that rejects elements while `predicate` is true. +/// +/// This `struct` is created by the [`skip_while()`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`skip_while()`]: trait.Iterator.html#method.skip_while +/// [`Iterator`]: trait.Iterator.html #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[stable(feature = "rust1", since = "1.0.0")] #[derive(Clone)] @@ -2224,7 +2291,13 @@ impl Iterator for SkipWhile } } -/// An iterator that only accepts elements while `predicate` is true +/// An iterator that only accepts elements while `predicate` is true. +/// +/// This `struct` is created by the [`take_while()`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`take_while()`]: trait.Iterator.html#method.take_while +/// [`Iterator`]: trait.Iterator.html #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[stable(feature = "rust1", since = "1.0.0")] #[derive(Clone)] @@ -2264,6 +2337,12 @@ impl Iterator for TakeWhile } /// An iterator that skips over `n` elements of `iter`. +/// +/// This `struct` is created by the [`skip()`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`skip()`]: trait.Iterator.html#method.skip +/// [`Iterator`]: trait.Iterator.html #[derive(Clone)] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[stable(feature = "rust1", since = "1.0.0")] @@ -2338,6 +2417,12 @@ impl Iterator for Skip where I: Iterator { impl ExactSizeIterator for Skip where I: ExactSizeIterator {} /// An iterator that only iterates over the first `n` iterations of `iter`. +/// +/// This `struct` is created by the [`take()`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`take()`]: trait.Iterator.html#method.take +/// [`Iterator`]: trait.Iterator.html #[derive(Clone)] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[stable(feature = "rust1", since = "1.0.0")] @@ -2393,7 +2478,13 @@ impl Iterator for Take where I: Iterator{ impl ExactSizeIterator for Take where I: ExactSizeIterator {} -/// An iterator to maintain state while iterating another iterator +/// An iterator to maintain state while iterating another iterator. +/// +/// This `struct` is created by the [`scan()`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`scan()`]: trait.Iterator.html#method.scan +/// [`Iterator`]: trait.Iterator.html #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[stable(feature = "rust1", since = "1.0.0")] #[derive(Clone)] @@ -2422,9 +2513,14 @@ impl Iterator for Scan where } } -/// An iterator that maps each element to an iterator, -/// and yields the elements of the produced iterators +/// An iterator that maps each element to an iterator, and yields the elements +/// of the produced iterators. /// +/// This `struct` is created by the [`flat_map()`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`flat_map()`]: trait.Iterator.html#method.flat_map +/// [`Iterator`]: trait.Iterator.html #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[stable(feature = "rust1", since = "1.0.0")] #[derive(Clone)] @@ -2493,8 +2589,11 @@ impl DoubleEndedIterator for FlatMap wher /// An iterator that yields `None` forever after the underlying iterator /// yields `None` once. /// -/// These can be created through -/// [`iter.fuse()`](trait.Iterator.html#method.fuse). +/// This `struct` is created by the [`fuse()`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`fuse()`]: trait.Iterator.html#method.fuse +/// [`Iterator`]: trait.Iterator.html #[derive(Clone)] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[stable(feature = "rust1", since = "1.0.0")] @@ -2574,8 +2673,14 @@ impl DoubleEndedIterator for Fuse where I: DoubleEndedIterator { #[stable(feature = "rust1", since = "1.0.0")] impl ExactSizeIterator for Fuse where I: ExactSizeIterator {} -/// An iterator that calls a function with a reference to each -/// element before yielding it. +/// An iterator that calls a function with a reference to each element before +/// yielding it. +/// +/// This `struct` is created by the [`inspect()`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`inspect()`]: trait.Iterator.html#method.inspect +/// [`Iterator`]: trait.Iterator.html #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[stable(feature = "rust1", since = "1.0.0")] #[derive(Clone)] @@ -3009,7 +3114,11 @@ impl Iterator for ops::RangeFrom where } } -/// An iterator that repeats an element endlessly +/// An iterator that repeats an element endlessly. +/// +/// This `struct` is created by the [`repeat()`] function. See its documentation for more. +/// +/// [`repeat()`]: fn.repeat.html #[derive(Clone)] #[stable(feature = "rust1", since = "1.0.0")] pub struct Repeat { @@ -3040,6 +3149,10 @@ pub fn repeat(elt: T) -> Repeat { } /// An iterator that yields nothing. +/// +/// This `struct` is created by the [`empty()`] function. See its documentation for more. +/// +/// [`empty()`]: fn.empty.html #[stable(feature = "iter_empty", since = "1.2.0")] pub struct Empty(marker::PhantomData); @@ -3095,6 +3208,10 @@ pub fn empty() -> Empty { } /// An iterator that yields an element exactly once. +/// +/// This `struct` is created by the [`once()`] function. See its documentation for more. +/// +/// [`once()`]: fn.once.html #[derive(Clone)] #[stable(feature = "iter_once", since = "1.2.0")] pub struct Once { From c3058a25d8794e9e47cc1d1e05c1428512949d57 Mon Sep 17 00:00:00 2001 From: Kevin Yap Date: Sat, 17 Oct 2015 12:34:25 -0700 Subject: [PATCH 2/6] Fix minor issues with std::io docs --- src/libstd/io/mod.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 166909f20b7e1..ebe50a6e2b8a2 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -20,11 +20,11 @@ //! //! # Read and Write //! -//! Because they are traits, they're implemented by a number of other types, -//! and you can implement them for your types too. As such, you'll see a -//! few different types of I/O throughout the documentation in this module: -//! `File`s, `TcpStream`s, and sometimes even `Vec`s. For example, `Read` -//! adds a `read()` method, which we can use on `File`s: +//! Because they are traits, `Read` and `Write` are implemented by a number +//! of other types, and you can implement them for your types too. As such, +//! you'll see a few different types of I/O throughout the documentation in +//! this module: `File`s, `TcpStream`s, and sometimes even `Vec`s. For +//! example, `Read` adds a `read()` method, which we can use on `File`s: //! //! ``` //! use std::io; @@ -111,7 +111,7 @@ //! # } //! ``` //! -//! `BufWriter` doesn't add any new ways of writing, it just buffers every call +//! `BufWriter` doesn't add any new ways of writing; it just buffers every call //! to [`write()`][write]: //! //! ``` @@ -165,7 +165,7 @@ //! # } //! ``` //! -//! Of course, using `io::stdout()` directly is less comon than something like +//! Of course, using `io::stdout()` directly is less common than something like //! `println!`. //! //! ## Iterator types From 1e68c91666ab0f88461c62559f0e2aaf1d431b5a Mon Sep 17 00:00:00 2001 From: Stefan O'Rear Date: Sat, 17 Oct 2015 17:39:31 -0700 Subject: [PATCH 3/6] Document that Ordering::Relaxed is Monotonic --- src/libcore/sync/atomic.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs index 0f72dcc1281a4..7225b4f6e0d2a 100644 --- a/src/libcore/sync/atomic.rs +++ b/src/libcore/sync/atomic.rs @@ -153,7 +153,8 @@ unsafe impl Sync for AtomicPtr {} #[stable(feature = "rust1", since = "1.0.0")] #[derive(Copy, Clone)] pub enum Ordering { - /// No ordering constraints, only atomic operations. + /// No ordering constraints, only atomic operations. Corresponds to LLVM's + /// `Monotonic` ordering. #[stable(feature = "rust1", since = "1.0.0")] Relaxed, /// When coupled with a store, all previous writes become visible From e2ecf279b6795d0a86a964fdc7a31c1f3981456f Mon Sep 17 00:00:00 2001 From: "Irving A.J. Rivas Z." Date: Mon, 19 Oct 2015 10:02:46 -0400 Subject: [PATCH 4/6] Made the example capable of consistent deadlocking To augment the didactic effect, made placed the thread::sleep_ms call in the last example, so that there will be time for the other locks to happen; without this, I was unable to observe the deadlock in over 1,000 runs when there was no left-handed philosopher. --- src/doc/trpl/dining-philosophers.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/doc/trpl/dining-philosophers.md b/src/doc/trpl/dining-philosophers.md index 28702d95b60a7..e81ae4648ad43 100644 --- a/src/doc/trpl/dining-philosophers.md +++ b/src/doc/trpl/dining-philosophers.md @@ -512,6 +512,7 @@ impl Philosopher { fn eat(&self, table: &Table) { let _left = table.forks[self.left].lock().unwrap(); + thread::sleep_ms(150); let _right = table.forks[self.right].lock().unwrap(); println!("{} is eating.", self.name); @@ -597,6 +598,7 @@ We now need to construct those `left` and `right` values, so we add them to ```rust,ignore fn eat(&self, table: &Table) { let _left = table.forks[self.left].lock().unwrap(); + thread::sleep_ms(150); let _right = table.forks[self.right].lock().unwrap(); println!("{} is eating.", self.name); @@ -607,11 +609,14 @@ fn eat(&self, table: &Table) { } ``` -We have two new lines. We’ve also added an argument, `table`. We access the +We have three new lines. We’ve added an argument, `table`. We access the `Table`’s list of forks, and then use `self.left` and `self.right` to access the fork at that particular index. That gives us access to the `Mutex` at that index, and we call `lock()` on it. If the mutex is currently being accessed by -someone else, we’ll block until it becomes available. +someone else, we’ll block until it becomes available. We have also a call to +`thread::sleep_ms` between the moment first fork is picked and the moment the +second forked is picked, as the process of picking up the fork is not +immediate. The call to `lock()` might fail, and if it does, we want to crash. In this case, the error that could happen is that the mutex is [‘poisoned’][poison], @@ -660,7 +665,9 @@ We need to pass in our `left` and `right` values to the constructors for our you look at the pattern, it’s all consistent until the very end. Monsieur Foucault should have `4, 0` as arguments, but instead, has `0, 4`. This is what prevents deadlock, actually: one of our philosophers is left handed! This is -one way to solve the problem, and in my opinion, it’s the simplest. +one way to solve the problem, and in my opinion, it’s the simplest. If you +change the order of the parameters, you will be able to observe the deadlock +taking place. ```rust,ignore let handles: Vec<_> = philosophers.into_iter().map(|p| { From f9d056f1b7866df2822498a55650f70280aa6f76 Mon Sep 17 00:00:00 2001 From: Carlos Liam Date: Mon, 19 Oct 2015 11:16:31 -0400 Subject: [PATCH 5/6] Clean whitespace Remove leading newlines; replace lines containing only whitespace with empty lines; replace multiple trailing newlines with a single newline; remove trailing whitespace in lines --- README.md | 2 +- src/doc/trpl/documentation.md | 2 +- src/doc/trpl/method-syntax.md | 2 +- src/doc/trpl/mutability.md | 2 +- src/doc/trpl/ownership.md | 6 +++--- src/doc/trpl/references-and-borrowing.md | 6 +++--- src/doc/trpl/strings.md | 4 ++-- src/libbacktrace/Makefile.am | 4 ++-- src/libbacktrace/Makefile.in | 20 ++++++++++---------- src/libbacktrace/alloc.c | 4 ++-- src/libbacktrace/atomic.c | 4 ++-- src/libbacktrace/backtrace-supported.h.in | 4 ++-- src/libbacktrace/backtrace.c | 4 ++-- src/libbacktrace/backtrace.h | 4 ++-- src/libbacktrace/btest.c | 6 +++--- src/libbacktrace/configure.ac | 4 ++-- src/libbacktrace/dwarf.c | 6 +++--- src/libbacktrace/elf.c | 4 ++-- src/libbacktrace/fileline.c | 4 ++-- src/libbacktrace/internal.h | 4 ++-- src/libbacktrace/mmap.c | 4 ++-- src/libbacktrace/mmapio.c | 4 ++-- src/libbacktrace/nounwind.c | 4 ++-- src/libbacktrace/posix.c | 4 ++-- src/libbacktrace/print.c | 4 ++-- src/libbacktrace/read.c | 4 ++-- src/libbacktrace/simple.c | 4 ++-- src/libbacktrace/sort.c | 4 ++-- src/libbacktrace/state.c | 4 ++-- src/libbacktrace/stest.c | 4 ++-- src/libbacktrace/unknown.c | 4 ++-- src/test/run-make/save-analysis/Makefile | 2 +- 32 files changed, 71 insertions(+), 71 deletions(-) diff --git a/README.md b/README.md index c4a3becacb42f..a040ff0921a9e 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ Building the documentation requires building the compiler, so the above details will apply. Once you have the compiler built, you can ```sh -$ make docs NO_REBUILD=1 +$ make docs NO_REBUILD=1 ``` To make sure you don’t re-build the compiler because you made a change diff --git a/src/doc/trpl/documentation.md b/src/doc/trpl/documentation.md index 8cb58ecf2c747..ac4b51333a3c1 100644 --- a/src/doc/trpl/documentation.md +++ b/src/doc/trpl/documentation.md @@ -73,7 +73,7 @@ hello.rs:4 } ``` This [unfortunate error](https://github.com/rust-lang/rust/issues/22547) is -correct: documentation comments apply to the thing after them, and there's +correct: documentation comments apply to the thing after them, and there's nothing after that last comment. [rc-new]: https://doc.rust-lang.org/nightly/std/rc/struct.Rc.html#method.new diff --git a/src/doc/trpl/method-syntax.md b/src/doc/trpl/method-syntax.md index a2bdd66b0c253..d31d823247082 100644 --- a/src/doc/trpl/method-syntax.md +++ b/src/doc/trpl/method-syntax.md @@ -55,7 +55,7 @@ kinds of things `foo` could be: `self` if it’s just a value on the stack, `&self` if it’s a reference, and `&mut self` if it’s a mutable reference. Because we took the `&self` parameter to `area`, we can use it just like any other parameter. Because we know it’s a `Circle`, we can access the `radius` -just like we would with any other `struct`. +just like we would with any other `struct`. We should default to using `&self`, as you should prefer borrowing over taking ownership, as well as taking immutable references over mutable ones. Here’s an diff --git a/src/doc/trpl/mutability.md b/src/doc/trpl/mutability.md index 2c4316e651a8e..71acb551e6e3c 100644 --- a/src/doc/trpl/mutability.md +++ b/src/doc/trpl/mutability.md @@ -84,7 +84,7 @@ philosophy, memory safety, and the mechanism by which Rust guarantees it, the > You may have one or the other of these two kinds of borrows, but not both at > the same time: -> +> > * one or more references (`&T`) to a resource, > * exactly one mutable reference (`&mut T`). diff --git a/src/doc/trpl/ownership.md b/src/doc/trpl/ownership.md index 89116f77b415a..d8ef44b782a1d 100644 --- a/src/doc/trpl/ownership.md +++ b/src/doc/trpl/ownership.md @@ -42,7 +42,7 @@ With that in mind, let’s learn about ownership. # Ownership [Variable bindings][bindings] have a property in Rust: they ‘have ownership’ -of what they’re bound to. This means that when a binding goes out of scope, +of what they’re bound to. This means that when a binding goes out of scope, Rust will free the bound resources. For example: ```rust @@ -158,8 +158,8 @@ has no pointers to data somewhere else, copying it is a full copy. All primitive types implement the `Copy` trait and their ownership is therefore not moved like one would assume, following the ´ownership rules´. -To give an example, the two following snippets of code only compile because the -`i32` and `bool` types implement the `Copy` trait. +To give an example, the two following snippets of code only compile because the +`i32` and `bool` types implement the `Copy` trait. ```rust fn main() { diff --git a/src/doc/trpl/references-and-borrowing.md b/src/doc/trpl/references-and-borrowing.md index 3027f10aca59e..13cfecdf1a729 100644 --- a/src/doc/trpl/references-and-borrowing.md +++ b/src/doc/trpl/references-and-borrowing.md @@ -233,7 +233,7 @@ So when we add the curly braces: ```rust let mut x = 5; -{ +{ let y = &mut x; // -+ &mut borrow starts here *y += 1; // | } // -+ ... and ends here @@ -306,7 +306,7 @@ which was invalid. For example: ```rust,ignore let y: &i32; -{ +{ let x = 5; y = &x; } @@ -323,7 +323,7 @@ error: `x` does not live long enough note: reference must be valid for the block suffix following statement 0 at 2:16... let y: &i32; -{ +{ let x = 5; y = &x; } diff --git a/src/doc/trpl/strings.md b/src/doc/trpl/strings.md index aa1944a099335..1848366498981 100644 --- a/src/doc/trpl/strings.md +++ b/src/doc/trpl/strings.md @@ -102,8 +102,8 @@ println!(""); This prints: ```text -229, 191, 160, 231, 138, 172, 227, 131, 143, 227, 131, 129, 229, 133, 172, -忠, 犬, ハ, チ, 公, +229, 191, 160, 231, 138, 172, 227, 131, 143, 227, 131, 129, 229, 133, 172, +忠, 犬, ハ, チ, 公, ``` As you can see, there are more bytes than `char`s. diff --git a/src/libbacktrace/Makefile.am b/src/libbacktrace/Makefile.am index c5f0dcbcf7a19..ea78c70163216 100644 --- a/src/libbacktrace/Makefile.am +++ b/src/libbacktrace/Makefile.am @@ -6,12 +6,12 @@ # met: # (1) Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. +# notice, this list of conditions and the following disclaimer. # (2) Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in # the documentation and/or other materials provided with the -# distribution. +# distribution. # (3) The name of the author may not be used to # endorse or promote products derived from this software without diff --git a/src/libbacktrace/Makefile.in b/src/libbacktrace/Makefile.in index b434d76edb620..16b1a72712ffd 100644 --- a/src/libbacktrace/Makefile.in +++ b/src/libbacktrace/Makefile.in @@ -23,12 +23,12 @@ # met: # (1) Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. +# notice, this list of conditions and the following disclaimer. # (2) Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in # the documentation and/or other materials provided with the -# distribution. +# distribution. # (3) The name of the author may not be used to # endorse or promote products derived from this software without @@ -137,10 +137,10 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libbacktrace_la_SOURCES) $(EXTRA_libbacktrace_la_SOURCES) \ $(btest_SOURCES) $(stest_SOURCES) -MULTISRCTOP = -MULTIBUILDTOP = -MULTIDIRS = -MULTISUBDIR = +MULTISRCTOP = +MULTIBUILDTOP = +MULTIDIRS = +MULTISUBDIR = MULTIDO = true MULTICLEAN = true am__can_run_installinfo = \ @@ -389,7 +389,7 @@ config.h: stamp-h1 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h -$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) +$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ @@ -407,7 +407,7 @@ clean-noinstLTLIBRARIES: echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done -libbacktrace.la: $(libbacktrace_la_OBJECTS) $(libbacktrace_la_DEPENDENCIES) $(EXTRA_libbacktrace_la_DEPENDENCIES) +libbacktrace.la: $(libbacktrace_la_OBJECTS) $(libbacktrace_la_DEPENDENCIES) $(EXTRA_libbacktrace_la_DEPENDENCIES) $(LINK) $(libbacktrace_la_OBJECTS) $(libbacktrace_la_LIBADD) $(LIBS) clean-checkPROGRAMS: @@ -418,10 +418,10 @@ clean-checkPROGRAMS: list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list -btest$(EXEEXT): $(btest_OBJECTS) $(btest_DEPENDENCIES) $(EXTRA_btest_DEPENDENCIES) +btest$(EXEEXT): $(btest_OBJECTS) $(btest_DEPENDENCIES) $(EXTRA_btest_DEPENDENCIES) @rm -f btest$(EXEEXT) $(btest_LINK) $(btest_OBJECTS) $(btest_LDADD) $(LIBS) -stest$(EXEEXT): $(stest_OBJECTS) $(stest_DEPENDENCIES) $(EXTRA_stest_DEPENDENCIES) +stest$(EXEEXT): $(stest_OBJECTS) $(stest_DEPENDENCIES) $(EXTRA_stest_DEPENDENCIES) @rm -f stest$(EXEEXT) $(LINK) $(stest_OBJECTS) $(stest_LDADD) $(LIBS) diff --git a/src/libbacktrace/alloc.c b/src/libbacktrace/alloc.c index b35afc603ba32..c9d6a1406b7b2 100644 --- a/src/libbacktrace/alloc.c +++ b/src/libbacktrace/alloc.c @@ -7,12 +7,12 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. + distribution. (3) The name of the author may not be used to endorse or promote products derived from this software without diff --git a/src/libbacktrace/atomic.c b/src/libbacktrace/atomic.c index 096a2bed284a1..40e4ff93cf68a 100644 --- a/src/libbacktrace/atomic.c +++ b/src/libbacktrace/atomic.c @@ -7,12 +7,12 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. + distribution. (3) The name of the author may not be used to endorse or promote products derived from this software without diff --git a/src/libbacktrace/backtrace-supported.h.in b/src/libbacktrace/backtrace-supported.h.in index 7d4b03350c934..976963e71041b 100644 --- a/src/libbacktrace/backtrace-supported.h.in +++ b/src/libbacktrace/backtrace-supported.h.in @@ -7,12 +7,12 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. + distribution. (3) The name of the author may not be used to endorse or promote products derived from this software without diff --git a/src/libbacktrace/backtrace.c b/src/libbacktrace/backtrace.c index c87175cc892b2..8941375c6cd55 100644 --- a/src/libbacktrace/backtrace.c +++ b/src/libbacktrace/backtrace.c @@ -7,12 +7,12 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. + distribution. (3) The name of the author may not be used to endorse or promote products derived from this software without diff --git a/src/libbacktrace/backtrace.h b/src/libbacktrace/backtrace.h index 3802d2579a208..f16ee36cbce9a 100644 --- a/src/libbacktrace/backtrace.h +++ b/src/libbacktrace/backtrace.h @@ -7,12 +7,12 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. + distribution. (3) The name of the author may not be used to endorse or promote products derived from this software without diff --git a/src/libbacktrace/btest.c b/src/libbacktrace/btest.c index c555165dcd8f4..a950a704f071d 100644 --- a/src/libbacktrace/btest.c +++ b/src/libbacktrace/btest.c @@ -7,12 +7,12 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. + distribution. (3) The name of the author may not be used to endorse or promote products derived from this software without @@ -460,7 +460,7 @@ f23 (int f1line, int f2line) (unsigned int) bdata.index, j + 1); bdata.failed = 1; } - } + } check ("test3", 0, all, f3line, "f23", &bdata.failed); check ("test3", 1, all, f2line, "f22", &bdata.failed); diff --git a/src/libbacktrace/configure.ac b/src/libbacktrace/configure.ac index f2c345cc3614f..30d890ef14a9f 100644 --- a/src/libbacktrace/configure.ac +++ b/src/libbacktrace/configure.ac @@ -6,12 +6,12 @@ # met: # (1) Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. +# notice, this list of conditions and the following disclaimer. # (2) Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in # the documentation and/or other materials provided with the -# distribution. +# distribution. # (3) The name of the author may not be used to # endorse or promote products derived from this software without diff --git a/src/libbacktrace/dwarf.c b/src/libbacktrace/dwarf.c index 9ba1a384f3250..fd3beac01fbaf 100644 --- a/src/libbacktrace/dwarf.c +++ b/src/libbacktrace/dwarf.c @@ -7,12 +7,12 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. + distribution. (3) The name of the author may not be used to endorse or promote products derived from this software without @@ -1246,7 +1246,7 @@ add_unit_ranges (struct backtrace_state *state, uintptr_t base_address, static int find_address_ranges (struct backtrace_state *state, uintptr_t base_address, - struct dwarf_buf *unit_buf, + struct dwarf_buf *unit_buf, const unsigned char *dwarf_str, size_t dwarf_str_size, const unsigned char *dwarf_ranges, size_t dwarf_ranges_size, diff --git a/src/libbacktrace/elf.c b/src/libbacktrace/elf.c index 292e5c0f07c8d..f0709c9c355dc 100644 --- a/src/libbacktrace/elf.c +++ b/src/libbacktrace/elf.c @@ -7,12 +7,12 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. + distribution. (3) The name of the author may not be used to endorse or promote products derived from this software without diff --git a/src/libbacktrace/fileline.c b/src/libbacktrace/fileline.c index e4b70795bf3c4..c151147213431 100644 --- a/src/libbacktrace/fileline.c +++ b/src/libbacktrace/fileline.c @@ -7,12 +7,12 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. + distribution. (3) The name of the author may not be used to endorse or promote products derived from this software without diff --git a/src/libbacktrace/internal.h b/src/libbacktrace/internal.h index 98ecc4c24a788..f6046ee6057c5 100644 --- a/src/libbacktrace/internal.h +++ b/src/libbacktrace/internal.h @@ -7,12 +7,12 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. + distribution. (3) The name of the author may not be used to endorse or promote products derived from this software without diff --git a/src/libbacktrace/mmap.c b/src/libbacktrace/mmap.c index 7f6601bc004a2..610548a8a4e22 100644 --- a/src/libbacktrace/mmap.c +++ b/src/libbacktrace/mmap.c @@ -7,12 +7,12 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. + distribution. (3) The name of the author may not be used to endorse or promote products derived from this software without diff --git a/src/libbacktrace/mmapio.c b/src/libbacktrace/mmapio.c index 4c038b94c5826..45f81a8593d9f 100644 --- a/src/libbacktrace/mmapio.c +++ b/src/libbacktrace/mmapio.c @@ -7,12 +7,12 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. + distribution. (3) The name of the author may not be used to endorse or promote products derived from this software without diff --git a/src/libbacktrace/nounwind.c b/src/libbacktrace/nounwind.c index 247986076b210..9952c0bcbfb7b 100644 --- a/src/libbacktrace/nounwind.c +++ b/src/libbacktrace/nounwind.c @@ -7,12 +7,12 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. + distribution. (3) The name of the author may not be used to endorse or promote products derived from this software without diff --git a/src/libbacktrace/posix.c b/src/libbacktrace/posix.c index b847ec64781b5..f6260a0044eaa 100644 --- a/src/libbacktrace/posix.c +++ b/src/libbacktrace/posix.c @@ -7,12 +7,12 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. + distribution. (3) The name of the author may not be used to endorse or promote products derived from this software without diff --git a/src/libbacktrace/print.c b/src/libbacktrace/print.c index 99c50099eab7d..271f41c0c59bf 100644 --- a/src/libbacktrace/print.c +++ b/src/libbacktrace/print.c @@ -7,12 +7,12 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. + distribution. (3) The name of the author may not be used to endorse or promote products derived from this software without diff --git a/src/libbacktrace/read.c b/src/libbacktrace/read.c index 641a3748399c8..70dd91ee97c8f 100644 --- a/src/libbacktrace/read.c +++ b/src/libbacktrace/read.c @@ -7,12 +7,12 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. + distribution. (3) The name of the author may not be used to endorse or promote products derived from this software without diff --git a/src/libbacktrace/simple.c b/src/libbacktrace/simple.c index 542a53ecb1795..fc0f4f498012c 100644 --- a/src/libbacktrace/simple.c +++ b/src/libbacktrace/simple.c @@ -7,12 +7,12 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. + distribution. (3) The name of the author may not be used to endorse or promote products derived from this software without diff --git a/src/libbacktrace/sort.c b/src/libbacktrace/sort.c index 9b61149e26aff..01b1cb2b8a555 100644 --- a/src/libbacktrace/sort.c +++ b/src/libbacktrace/sort.c @@ -7,12 +7,12 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. + distribution. (3) The name of the author may not be used to endorse or promote products derived from this software without diff --git a/src/libbacktrace/state.c b/src/libbacktrace/state.c index 071c93945d5ff..373938865c7ff 100644 --- a/src/libbacktrace/state.c +++ b/src/libbacktrace/state.c @@ -7,12 +7,12 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. + distribution. (3) The name of the author may not be used to endorse or promote products derived from this software without diff --git a/src/libbacktrace/stest.c b/src/libbacktrace/stest.c index c4f9f5ec3b896..510715291895c 100644 --- a/src/libbacktrace/stest.c +++ b/src/libbacktrace/stest.c @@ -7,12 +7,12 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. + distribution. (3) The name of the author may not be used to endorse or promote products derived from this software without diff --git a/src/libbacktrace/unknown.c b/src/libbacktrace/unknown.c index 76dab7a21c1d8..953e96e510e59 100644 --- a/src/libbacktrace/unknown.c +++ b/src/libbacktrace/unknown.c @@ -7,12 +7,12 @@ modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the - distribution. + distribution. (3) The name of the author may not be used to endorse or promote products derived from this software without diff --git a/src/test/run-make/save-analysis/Makefile b/src/test/run-make/save-analysis/Makefile index 701bdee1109ed..7296fb9cc5936 100644 --- a/src/test/run-make/save-analysis/Makefile +++ b/src/test/run-make/save-analysis/Makefile @@ -1,6 +1,6 @@ -include ../tools.mk all: code krate2: krate2.rs - $(RUSTC) $< + $(RUSTC) $< code: foo.rs krate2 $(RUSTC) foo.rs -Zsave-analysis From 9431f3cc7b131a3413508901ed98e0c6cc0505c7 Mon Sep 17 00:00:00 2001 From: Andrew Paseltiner Date: Mon, 19 Oct 2015 13:45:33 -0400 Subject: [PATCH 6/6] Correct spelling in docs --- src/doc/nomicon/safe-unsafe-meaning.md | 2 +- src/libcollections/str.rs | 2 +- src/libcore/iter.rs | 2 +- src/libstd/process.rs | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/doc/nomicon/safe-unsafe-meaning.md b/src/doc/nomicon/safe-unsafe-meaning.md index 827ea255053c2..5fd61eb51dd1c 100644 --- a/src/doc/nomicon/safe-unsafe-meaning.md +++ b/src/doc/nomicon/safe-unsafe-meaning.md @@ -42,7 +42,7 @@ Some examples of unsafe functions: * `slice::get_unchecked` will perform unchecked indexing, allowing memory safety to be freely violated. * every raw pointer to sized type has intrinsic `offset` method that invokes - Undefined Behaviour if it is not "in bounds" as defined by LLVM. + Undefined Behavior if it is not "in bounds" as defined by LLVM. * `mem::transmute` reinterprets some value as having the given type, bypassing type safety in arbitrary ways. (see [conversions] for details) * All FFI functions are `unsafe` because they can do arbitrary things. diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 5f1ace19f6d74..023edf29341e9 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -102,7 +102,7 @@ impl> SliceConcatExt for [S] { } } -/// External iterator for a string's UTF16 codeunits. +/// External iterator for a string's UTF-16 code units. /// /// For use with the `std::iter` module. #[derive(Clone)] diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index f9dc65b95aade..e164fbf6d815d 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -3135,7 +3135,7 @@ impl Default for Empty { /// Creates an iterator that yields nothing. /// -/// # Exampes +/// # Examples /// /// Basic usage: /// diff --git a/src/libstd/process.rs b/src/libstd/process.rs index 4e80fb2ceb09e..6e3c5eaf217f6 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -100,7 +100,7 @@ impl IntoInner for ChildStdin { fn into_inner(self) -> AnonPipe { self.inner } } -/// A handle to a child procesess's stdout +/// A handle to a child process's stdout #[stable(feature = "process", since = "1.0.0")] pub struct ChildStdout { inner: AnonPipe @@ -121,7 +121,7 @@ impl IntoInner for ChildStdout { fn into_inner(self) -> AnonPipe { self.inner } } -/// A handle to a child procesess's stderr +/// A handle to a child process's stderr #[stable(feature = "process", since = "1.0.0")] pub struct ChildStderr { inner: AnonPipe