Auto merge of #29236 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #29170, #29180, #29193, #29207, #29213, #29224, #29230 - Failed merges:
This commit is contained in:
commit
7beebbe564
|
@ -72,6 +72,9 @@ Read ["Installing Rust"] from [The Book].
|
|||
$ pacman -S mingw-w64-i686-toolchain
|
||||
$ pacman -S mingw-w64-x86_64-toolchain
|
||||
|
||||
# Make git available in MSYS2 (if not already available on path)
|
||||
$ pacman -S git
|
||||
|
||||
$ pacman -S base-devel
|
||||
```
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
% Atomics
|
||||
|
||||
Rust pretty blatantly just inherits C11's memory model for atomics. This is not
|
||||
due this model being particularly excellent or easy to understand. Indeed, this
|
||||
model is quite complex and known to have [several flaws][C11-busted]. Rather, it
|
||||
is a pragmatic concession to the fact that *everyone* is pretty bad at modeling
|
||||
atomics. At very least, we can benefit from existing tooling and research around
|
||||
C.
|
||||
due to this model being particularly excellent or easy to understand. Indeed,
|
||||
this model is quite complex and known to have [several flaws][C11-busted].
|
||||
Rather, it is a pragmatic concession to the fact that *everyone* is pretty bad
|
||||
at modeling atomics. At very least, we can benefit from existing tooling and
|
||||
research around C.
|
||||
|
||||
Trying to fully explain the model in this book is fairly hopeless. It's defined
|
||||
in terms of madness-inducing causality graphs that require a full book to
|
||||
|
|
|
@ -1545,7 +1545,7 @@ cargo build --release
|
|||
|
||||
## Argument parsing
|
||||
|
||||
Let's get argument parsing out of the way. we won't go into too much
|
||||
Let's get argument parsing out of the way. We won't go into too much
|
||||
detail on Getopts, but there is [some good documentation][15]
|
||||
describing it. The short story is that Getopts generates an argument
|
||||
parser and a help message from a vector of options (The fact that it
|
||||
|
@ -1855,7 +1855,7 @@ In our program, we accept a single file for input and do one pass over the
|
|||
data. This means we probably should be able to accept input on stdin. But maybe
|
||||
we like the current format too—so let's have both!
|
||||
|
||||
Adding support for stdin is actually quite easy. There are only two things we
|
||||
Adding support for stdin is actually quite easy. There are only three things we
|
||||
have to do:
|
||||
|
||||
1. Tweak the program arguments so that a single parameter—the
|
||||
|
@ -2057,7 +2057,7 @@ so. This can be a little clumsy, especially if you intend for the program to
|
|||
be used in shell scripts.
|
||||
|
||||
So let's start by adding the flags. Like before, we need to tweak the usage
|
||||
string and add a flag to the Option variable. Once were done that, Getopts does the rest:
|
||||
string and add a flag to the Option variable. Once we've done that, Getopts does the rest:
|
||||
|
||||
```rust,ignore
|
||||
...
|
||||
|
|
|
@ -37,8 +37,9 @@ If we’re on Windows and not using PowerShell, the `~` may not work. Consult th
|
|||
documentation for our shell for more details.
|
||||
|
||||
Let’s make a new source file next. We’ll call our file `main.rs`. Rust files
|
||||
always end in a `.rs` extension. If we’re using more than one word in our
|
||||
filename, use an underscore: `hello_world.rs` rather than `helloworld.rs`.
|
||||
always end in a `.rs` extension, and if we’re using more than one word in a
|
||||
Rust filename, we use an underscore: for example, `linked_list.rs`, not
|
||||
`linkedlist.rs` or `LinkedList.rs`.
|
||||
|
||||
Now that we’ve got our file open, type this in:
|
||||
|
||||
|
|
|
@ -784,9 +784,6 @@ impl<'b, T: ?Sized> DerefMut for RefMut<'b, T> {
|
|||
///
|
||||
/// unsafe impl<T> Sync for NotThreadSafe<T> {}
|
||||
/// ```
|
||||
///
|
||||
/// **NOTE:** `UnsafeCell<T>`'s fields are public to allow static initializers. It is not
|
||||
/// recommended to access its fields directly, `get` should be used instead.
|
||||
#[lang = "unsafe_cell"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct UnsafeCell<T: ?Sized> {
|
||||
|
@ -799,8 +796,7 @@ impl<T> UnsafeCell<T> {
|
|||
/// Constructs a new instance of `UnsafeCell` which will wrap the specified
|
||||
/// value.
|
||||
///
|
||||
/// All access to the inner value through methods is `unsafe`, and it is highly discouraged to
|
||||
/// access the fields directly.
|
||||
/// All access to the inner value through methods is `unsafe`.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
|
|
@ -69,7 +69,7 @@ use slice;
|
|||
/// use std::io::Cursor;
|
||||
/// let mut buff = Cursor::new(vec![0; 15]);
|
||||
///
|
||||
/// write_ten_bytes(&mut buff).unwrap();
|
||||
/// write_ten_bytes_at_end(&mut buff).unwrap();
|
||||
///
|
||||
/// assert_eq!(&buff.get_ref()[5..15], &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
|
||||
/// }
|
||||
|
|
Loading…
Reference in New Issue