Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 5 pull requests #39933

Merged
merged 11 commits into from
Feb 18, 2017
2 changes: 1 addition & 1 deletion src/doc/book/src/procedural-macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ So this is where quotes comes in. The `ast` argument is a struct that gives us
a representation of our type (which can be either a `struct` or an `enum`).
Check out the [docs](https://docs.rs/syn/0.10.5/syn/struct.MacroInput.html),
there is some useful information there. We are able to get the name of the
type using `ast.ident`. The `quote!` macro let's us write up the Rust code
type using `ast.ident`. The `quote!` macro lets us write up the Rust code
that we wish to return and convert it into `Tokens`. `quote!` let's us use some
really cool templating mechanics; we simply write `#name` and `quote!` will
replace it with the variable named `name`. You can even do some repetition
Expand Down
18 changes: 9 additions & 9 deletions src/libcollections/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1250,17 +1250,17 @@ impl String {
self.len() == 0
}

/// Divide one string into two at an index.
/// Splits the string into two at the given index.
///
/// The argument, `mid`, should be a byte offset from the start of the string. It must also
/// be on the boundary of a UTF-8 code point.
/// Returns a newly allocated `String`. `self` contains bytes `[0, at)`, and
/// the returned `String` contains bytes `[at, len)`. `at` must be on the
/// boundary of a UTF-8 code point.
///
/// The two strings returned go from the start of the string to `mid`, and from `mid` to the end
/// of the string.
/// Note that the capacity of `self` does not change.
///
/// # Panics
///
/// Panics if `mid` is not on a `UTF-8` code point boundary, or if it is beyond the last
/// Panics if `at` is not on a `UTF-8` code point boundary, or if it is beyond the last
/// code point of the string.
///
/// # Examples
Expand All @@ -1275,9 +1275,9 @@ impl String {
/// ```
#[inline]
#[stable(feature = "string_split_off", since = "1.16.0")]
pub fn split_off(&mut self, mid: usize) -> String {
assert!(self.is_char_boundary(mid));
let other = self.vec.split_off(mid);
pub fn split_off(&mut self, at: usize) -> String {
assert!(self.is_char_boundary(at));
let other = self.vec.split_off(at);
unsafe { String::from_utf8_unchecked(other) }
}

Expand Down
6 changes: 3 additions & 3 deletions src/libcore/iter/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1603,12 +1603,12 @@ pub trait Iterator {
let mut i = self.len();

while let Some(v) = self.next_back() {
if predicate(v) {
return Some(i - 1);
}
// No need for an overflow check here, because `ExactSizeIterator`
// implies that the number of elements fits into a `usize`.
i -= 1;
if predicate(v) {
return Some(i);
}
}
None
}
Expand Down
15 changes: 11 additions & 4 deletions src/libstd/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ pub struct VarsOs { inner: os_imp::Env }
///
/// While iterating, the returned iterator will panic if any key or value in the
/// environment is not valid unicode. If this is not desired, consider using the
/// `env::vars_os` function.
/// [`env::vars_os`] function.
///
/// [`env::vars_os`]: fn.vars_os.html
///
/// # Examples
///
Expand Down Expand Up @@ -171,9 +173,12 @@ impl fmt::Debug for VarsOs {

/// Fetches the environment variable `key` from the current process.
///
/// The returned result is `Ok(s)` if the environment variable is present and is
/// The returned result is [`Ok(s)`] if the environment variable is present and is
/// valid unicode. If the environment variable is not present, or it is not
/// valid unicode, then `Err` will be returned.
/// valid unicode, then [`Err`] will be returned.
///
/// [`Ok(s)`]: ../result/enum.Result.html#variant.Ok
/// [`Err`]: ../result/enum.Result.html#variant.Err
///
/// # Examples
///
Expand All @@ -199,7 +204,9 @@ fn _var(key: &OsStr) -> Result<String, VarError> {
}

/// Fetches the environment variable `key` from the current process, returning
/// `None` if the variable isn't set.
/// [`None`] if the variable isn't set.
///
/// [`None`]: ../option/enum.Option.html#variant.None
///
/// # Examples
///
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/sync/once.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ impl Once {
}

// Once we've enqueued ourselves, wait in a loop.
// Aftewards reload the state and continue with what we
// Afterwards reload the state and continue with what we
// were doing from before.
while !node.signaled.load(Ordering::SeqCst) {
thread::park();
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/thread/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ use mem;
/// # Initialization and Destruction
///
/// Initialization is dynamically performed on the first call to `with()`
/// within a thread, and values support destructors which will be run when a
/// thread exits.
/// within a thread, and values that implement `Drop` get destructed when a
/// thread exits. Some caveats apply, which are explained below.
///
/// # Examples
///
Expand Down