Skip to content

Commit 306035c

Browse files
committed
Auto merge of #39933 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 5 pull requests - Successful merges: #39847, #39862, #39898, #39904, #39928 - Failed merges:
2 parents 8f2fc9d + 98c2cf2 commit 306035c

File tree

6 files changed

+27
-20
lines changed

6 files changed

+27
-20
lines changed

src/doc/book/src/procedural-macros.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ So this is where quotes comes in. The `ast` argument is a struct that gives us
169169
a representation of our type (which can be either a `struct` or an `enum`).
170170
Check out the [docs](https://docs.rs/syn/0.10.5/syn/struct.MacroInput.html),
171171
there is some useful information there. We are able to get the name of the
172-
type using `ast.ident`. The `quote!` macro let's us write up the Rust code
172+
type using `ast.ident`. The `quote!` macro lets us write up the Rust code
173173
that we wish to return and convert it into `Tokens`. `quote!` let's us use some
174174
really cool templating mechanics; we simply write `#name` and `quote!` will
175175
replace it with the variable named `name`. You can even do some repetition

src/libcollections/string.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -1250,17 +1250,17 @@ impl String {
12501250
self.len() == 0
12511251
}
12521252

1253-
/// Divide one string into two at an index.
1253+
/// Splits the string into two at the given index.
12541254
///
1255-
/// The argument, `mid`, should be a byte offset from the start of the string. It must also
1256-
/// be on the boundary of a UTF-8 code point.
1255+
/// Returns a newly allocated `String`. `self` contains bytes `[0, at)`, and
1256+
/// the returned `String` contains bytes `[at, len)`. `at` must be on the
1257+
/// boundary of a UTF-8 code point.
12571258
///
1258-
/// The two strings returned go from the start of the string to `mid`, and from `mid` to the end
1259-
/// of the string.
1259+
/// Note that the capacity of `self` does not change.
12601260
///
12611261
/// # Panics
12621262
///
1263-
/// Panics if `mid` is not on a `UTF-8` code point boundary, or if it is beyond the last
1263+
/// Panics if `at` is not on a `UTF-8` code point boundary, or if it is beyond the last
12641264
/// code point of the string.
12651265
///
12661266
/// # Examples
@@ -1275,9 +1275,9 @@ impl String {
12751275
/// ```
12761276
#[inline]
12771277
#[stable(feature = "string_split_off", since = "1.16.0")]
1278-
pub fn split_off(&mut self, mid: usize) -> String {
1279-
assert!(self.is_char_boundary(mid));
1280-
let other = self.vec.split_off(mid);
1278+
pub fn split_off(&mut self, at: usize) -> String {
1279+
assert!(self.is_char_boundary(at));
1280+
let other = self.vec.split_off(at);
12811281
unsafe { String::from_utf8_unchecked(other) }
12821282
}
12831283

src/libcore/iter/iterator.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1603,12 +1603,12 @@ pub trait Iterator {
16031603
let mut i = self.len();
16041604

16051605
while let Some(v) = self.next_back() {
1606-
if predicate(v) {
1607-
return Some(i - 1);
1608-
}
16091606
// No need for an overflow check here, because `ExactSizeIterator`
16101607
// implies that the number of elements fits into a `usize`.
16111608
i -= 1;
1609+
if predicate(v) {
1610+
return Some(i);
1611+
}
16121612
}
16131613
None
16141614
}

src/libstd/env.rs

+11-4
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ pub struct VarsOs { inner: os_imp::Env }
9696
///
9797
/// While iterating, the returned iterator will panic if any key or value in the
9898
/// environment is not valid unicode. If this is not desired, consider using the
99-
/// `env::vars_os` function.
99+
/// [`env::vars_os`] function.
100+
///
101+
/// [`env::vars_os`]: fn.vars_os.html
100102
///
101103
/// # Examples
102104
///
@@ -171,9 +173,12 @@ impl fmt::Debug for VarsOs {
171173

172174
/// Fetches the environment variable `key` from the current process.
173175
///
174-
/// The returned result is `Ok(s)` if the environment variable is present and is
176+
/// The returned result is [`Ok(s)`] if the environment variable is present and is
175177
/// valid unicode. If the environment variable is not present, or it is not
176-
/// valid unicode, then `Err` will be returned.
178+
/// valid unicode, then [`Err`] will be returned.
179+
///
180+
/// [`Ok(s)`]: ../result/enum.Result.html#variant.Ok
181+
/// [`Err`]: ../result/enum.Result.html#variant.Err
177182
///
178183
/// # Examples
179184
///
@@ -199,7 +204,9 @@ fn _var(key: &OsStr) -> Result<String, VarError> {
199204
}
200205

201206
/// Fetches the environment variable `key` from the current process, returning
202-
/// `None` if the variable isn't set.
207+
/// [`None`] if the variable isn't set.
208+
///
209+
/// [`None`]: ../option/enum.Option.html#variant.None
203210
///
204211
/// # Examples
205212
///

src/libstd/sync/once.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ impl Once {
316316
}
317317

318318
// Once we've enqueued ourselves, wait in a loop.
319-
// Aftewards reload the state and continue with what we
319+
// Afterwards reload the state and continue with what we
320320
// were doing from before.
321321
while !node.signaled.load(Ordering::SeqCst) {
322322
thread::park();

src/libstd/thread/local.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ use mem;
2828
/// # Initialization and Destruction
2929
///
3030
/// Initialization is dynamically performed on the first call to `with()`
31-
/// within a thread, and values support destructors which will be run when a
32-
/// thread exits.
31+
/// within a thread, and values that implement `Drop` get destructed when a
32+
/// thread exits. Some caveats apply, which are explained below.
3333
///
3434
/// # Examples
3535
///

0 commit comments

Comments
 (0)