Skip to content

Commit

Permalink
Auto merge of rust-lang#29172 - steveklabnik:rollup, r=steveklabnik
Browse files Browse the repository at this point in the history
  • Loading branch information
bors committed Oct 19, 2015
2 parents c74454a + 2f2d8df commit 2258159
Show file tree
Hide file tree
Showing 39 changed files with 232 additions and 107 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/doc/nomicon/safe-unsafe-meaning.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
13 changes: 10 additions & 3 deletions src/doc/trpl/dining-philosophers.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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],
Expand Down Expand Up @@ -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| {
Expand Down
2 changes: 1 addition & 1 deletion src/doc/trpl/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/doc/trpl/method-syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/doc/trpl/mutability.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`).
Expand Down
6 changes: 3 additions & 3 deletions src/doc/trpl/ownership.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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() {
Expand Down
6 changes: 3 additions & 3 deletions src/doc/trpl/references-and-borrowing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -306,7 +306,7 @@ which was invalid. For example:

```rust,ignore
let y: &i32;
{
{
let x = 5;
y = &x;
}
Expand All @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/doc/trpl/strings.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/libbacktrace/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 10 additions & 10 deletions src/libbacktrace/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 = \
Expand Down Expand Up @@ -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 $@
Expand All @@ -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:
Expand All @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions src/libbacktrace/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/libbacktrace/atomic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/libbacktrace/backtrace-supported.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/libbacktrace/backtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/libbacktrace/backtrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/libbacktrace/btest.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/libbacktrace/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/libbacktrace/dwarf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/libbacktrace/elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/libbacktrace/fileline.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 2258159

Please sign in to comment.