1
Fork 0

Auto merge of #40598 - frewsxcv:rollup, r=frewsxcv

Rollup of 23 pull requests

- Successful merges: #40387, #40433, #40452, #40456, #40457, #40458, #40463, #40466, #40467, #40495, #40496, #40497, #40499, #40500, #40503, #40505, #40512, #40514, #40517, #40520, #40536, #40545, #40586
- Failed merges:
This commit is contained in:
bors 2017-03-17 17:26:52 +00:00
commit a559452b05
122 changed files with 1008 additions and 705 deletions

4
.gitmodules vendored
View file

@ -20,10 +20,10 @@
url = https://github.com/rust-lang/libc.git url = https://github.com/rust-lang/libc.git
[submodule "src/doc/nomicon"] [submodule "src/doc/nomicon"]
path = src/doc/nomicon path = src/doc/nomicon
url = https://github.com/rust-lang-nursery/nomicon url = https://github.com/rust-lang-nursery/nomicon.git
[submodule "src/tools/cargo"] [submodule "src/tools/cargo"]
path = cargo path = cargo
url = https://github.com/rust-lang/cargo url = https://github.com/rust-lang/cargo.git
[submodule "reference"] [submodule "reference"]
path = src/doc/reference path = src/doc/reference
url = https://github.com/rust-lang-nursery/reference.git url = https://github.com/rust-lang-nursery/reference.git

View file

@ -161,8 +161,9 @@ If youd like to build the documentation, its almost the same:
$ ./x.py doc $ ./x.py doc
``` ```
The generated documentation will appear in a top-level `doc` directory, The generated documentation will appear under `doc` in the `build` directory for
created by the `make` rule. the ABI used. I.e., if the ABI was `x86_64-pc-windows-msvc`, the directory will be
`build\x86_64-pc-windows-msvc\doc`.
## Notes ## Notes

View file

@ -4,7 +4,6 @@ Version 1.16.0 (2017-03-16)
Language Language
-------- --------
* Lifetimes in statics and consts default to `'static`. [RFC 1623]
* [The compiler's `dead_code` lint now accounts for type aliases][38051]. * [The compiler's `dead_code` lint now accounts for type aliases][38051].
* [Uninhabitable enums (those without any variants) no longer permit wildcard * [Uninhabitable enums (those without any variants) no longer permit wildcard
match patterns][38069] match patterns][38069]
@ -5056,7 +5055,7 @@ Version 0.1 (2012-01-20)
* Compiler works with the following configurations: * Compiler works with the following configurations:
* Linux: x86 and x86_64 hosts and targets * Linux: x86 and x86_64 hosts and targets
* MacOS: x86 and x86_64 hosts and targets * macOS: x86 and x86_64 hosts and targets
* Windows: x86 hosts and targets * Windows: x86 hosts and targets
* Cross compilation / multi-target configuration supported. * Cross compilation / multi-target configuration supported.

2
cargo

@ -1 +1 @@
Subproject commit 4a3c0a63b07e9a4feb41cb11de37c92a09db5a60 Subproject commit 5f3b9c4c6a7be1f177d6024cb83d150b6479148a

View file

@ -182,7 +182,7 @@ fn main() {
if env::var("RUSTC_RPATH") == Ok("true".to_string()) { if env::var("RUSTC_RPATH") == Ok("true".to_string()) {
let rpath = if target.contains("apple") { let rpath = if target.contains("apple") {
// Note that we need to take one extra step on OSX to also pass // Note that we need to take one extra step on macOS to also pass
// `-Wl,-instal_name,@rpath/...` to get things to work right. To // `-Wl,-instal_name,@rpath/...` to get things to work right. To
// do that we pass a weird flag to the compiler to get it to do // do that we pass a weird flag to the compiler to get it to do
// so. Note that this is definitely a hack, and we should likely // so. Note that this is definitely a hack, and we should likely

View file

@ -176,7 +176,7 @@ pub fn compiletest(build: &Build,
cmd.arg("--docck-python").arg(build.python()); cmd.arg("--docck-python").arg(build.python());
if build.config.build.ends_with("apple-darwin") { if build.config.build.ends_with("apple-darwin") {
// Force /usr/bin/python on OSX for LLDB tests because we're loading the // Force /usr/bin/python on macOS for LLDB tests because we're loading the
// LLDB plugin's compiled module which only works with the system python // LLDB plugin's compiled module which only works with the system python
// (namely not Homebrew-installed python) // (namely not Homebrew-installed python)
cmd.arg("--lldb-python").arg("/usr/bin/python"); cmd.arg("--lldb-python").arg("/usr/bin/python");

View file

@ -249,7 +249,7 @@ pub fn rustc(build: &Build, target: &str, compiler: &Compiler) {
cargo.env("CFG_LLVM_ROOT", s); cargo.env("CFG_LLVM_ROOT", s);
} }
// Building with a static libstdc++ is only supported on linux right now, // Building with a static libstdc++ is only supported on linux right now,
// not for MSVC or OSX // not for MSVC or macOS
if build.config.llvm_static_stdcpp && if build.config.llvm_static_stdcpp &&
!target.contains("windows") && !target.contains("windows") &&
!target.contains("apple") { !target.contains("apple") {

View file

@ -846,7 +846,7 @@ impl Build {
.filter(|s| !s.starts_with("-O") && !s.starts_with("/O")) .filter(|s| !s.starts_with("-O") && !s.starts_with("/O"))
.collect::<Vec<_>>(); .collect::<Vec<_>>();
// If we're compiling on OSX then we add a few unconditional flags // If we're compiling on macOS then we add a few unconditional flags
// indicating that we want libc++ (more filled out than libstdc++) and // indicating that we want libc++ (more filled out than libstdc++) and
// we want to compile for 10.7. This way we can ensure that // we want to compile for 10.7. This way we can ensure that
// LLVM/jemalloc/etc are all properly compiled. // LLVM/jemalloc/etc are all properly compiled.

View file

@ -222,9 +222,24 @@ pub fn openssl(build: &Build, target: &str) {
let tarball = out.join(&name); let tarball = out.join(&name);
if !tarball.exists() { if !tarball.exists() {
let tmp = tarball.with_extension("tmp"); let tmp = tarball.with_extension("tmp");
build.run(Command::new("curl") // originally from https://www.openssl.org/source/...
.arg("-o").arg(&tmp) let url = format!("https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/{}",
.arg(format!("https://www.openssl.org/source/{}", name))); name);
let mut ok = false;
for _ in 0..3 {
let status = Command::new("curl")
.arg("-o").arg(&tmp)
.arg(&url)
.status()
.expect("failed to spawn curl");
if status.success() {
ok = true;
break
}
}
if !ok {
panic!("failed to download openssl source")
}
let mut shasum = if target.contains("apple") { let mut shasum = if target.contains("apple") {
let mut cmd = Command::new("shasum"); let mut cmd = Command::new("shasum");
cmd.arg("-a").arg("256"); cmd.arg("-a").arg("256");

View file

@ -151,10 +151,10 @@ pub fn check(build: &mut Build) {
} }
for target in build.config.target.iter() { for target in build.config.target.iter() {
// Can't compile for iOS unless we're on OSX // Can't compile for iOS unless we're on macOS
if target.contains("apple-ios") && if target.contains("apple-ios") &&
!build.config.build.contains("apple-darwin") { !build.config.build.contains("apple-darwin") {
panic!("the iOS target is only supported on OSX"); panic!("the iOS target is only supported on macOS");
} }
// Make sure musl-root is valid if specified // Make sure musl-root is valid if specified

View file

@ -170,8 +170,6 @@ more than one section:
# fn foo() {} # fn foo() {}
``` ```
Let's discuss the details of these code blocks.
#### Code block annotations #### Code block annotations
To write some Rust code in a comment, use the triple graves: To write some Rust code in a comment, use the triple graves:
@ -183,23 +181,8 @@ To write some Rust code in a comment, use the triple graves:
# fn foo() {} # fn foo() {}
``` ```
If you want something that's not Rust code, you can add an annotation: This will add code highlighting. If you are only showing plain text, put `text`
instead of `rust` after the triple graves (see below).
```rust
/// ```c
/// printf("Hello, world\n");
/// ```
# fn foo() {}
```
This will highlight according to whatever language you're showing off.
If you're only showing plain text, choose `text`.
It's important to choose the correct annotation here, because `rustdoc` uses it
in an interesting way: It can be used to actually test your examples in a
library crate, so that they don't get out of date. If you have some C code but
`rustdoc` thinks it's Rust because you left off the annotation, `rustdoc` will
complain when trying to generate the documentation.
## Documentation as tests ## Documentation as tests

View file

@ -687,7 +687,7 @@ attribute turns off Rust's name mangling, so that it is easier to link to.
Its important to be mindful of `panic!`s when working with FFI. A `panic!` Its important to be mindful of `panic!`s when working with FFI. A `panic!`
across an FFI boundary is undefined behavior. If youre writing code that may across an FFI boundary is undefined behavior. If youre writing code that may
panic, you should run it in a closure with [`catch_unwind()`]: panic, you should run it in a closure with [`catch_unwind`]:
```rust ```rust
use std::panic::catch_unwind; use std::panic::catch_unwind;
@ -706,11 +706,11 @@ pub extern fn oh_no() -> i32 {
fn main() {} fn main() {}
``` ```
Please note that [`catch_unwind()`] will only catch unwinding panics, not Please note that [`catch_unwind`] will only catch unwinding panics, not
those who abort the process. See the documentation of [`catch_unwind()`] those who abort the process. See the documentation of [`catch_unwind`]
for more information. for more information.
[`catch_unwind()`]: ../std/panic/fn.catch_unwind.html [`catch_unwind`]: ../std/panic/fn.catch_unwind.html
# Representing opaque structs # Representing opaque structs

View file

@ -217,7 +217,7 @@ The next part will use this handle to get input from the user:
.read_line(&mut guess) .read_line(&mut guess)
``` ```
Here, we call the [`read_line()`][read_line] method on our handle. Here, we call the [`read_line`][read_line] method on our handle.
[Methods][method] are like associated functions, but are only available on a [Methods][method] are like associated functions, but are only available on a
particular instance of a type, rather than the type itself. Were also passing particular instance of a type, rather than the type itself. Were also passing
one argument to `read_line()`: `&mut guess`. one argument to `read_line()`: `&mut guess`.

View file

@ -147,7 +147,7 @@ And that's reflected in the summary line:
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured
``` ```
We also get a non-zero status code. We can use `$?` on OS X and Linux: We also get a non-zero status code. We can use `$?` on macOS and Linux:
```bash ```bash
$ echo $? $ echo $?

View file

@ -11,18 +11,18 @@ Other unofficial documentation may exist elsewhere; for example, the [Rust
Learning] project collects documentation from the community, and [Docs.rs] Learning] project collects documentation from the community, and [Docs.rs]
builds documentation for individual Rust packages. builds documentation for individual Rust packages.
## API Documentation # API Documentation
Rust provides a standard library with a number of features; [we host its Rust provides a standard library with a number of features; [we host its
documentation here][api]. documentation here][api].
## Extended Error Documentation # Extended Error Documentation
Many of Rust's errors come with error codes, and you can request extended Many of Rust's errors come with error codes, and you can request extended
diagnostics from the compiler on those errors. We also [have the text of those diagnostics from the compiler on those errors. We also [have the text of those
extended errors on the web][err], if you prefer to read them that way. extended errors on the web][err], if you prefer to read them that way.
## The Rust Bookshelf # The Rust Bookshelf
Rust provides a number of book-length sets of documentation, collectively Rust provides a number of book-length sets of documentation, collectively
nicknamed 'The Rust Bookshelf.' nicknamed 'The Rust Bookshelf.'

View file

@ -75,6 +75,7 @@
- [simd](simd.md) - [simd](simd.md)
- [simd_ffi](simd-ffi.md) - [simd_ffi](simd-ffi.md)
- [slice_patterns](slice-patterns.md) - [slice_patterns](slice-patterns.md)
- [sort_unstable](sort-unstable.md)
- [specialization](specialization.md) - [specialization](specialization.md)
- [staged_api](staged-api.md) - [staged_api](staged-api.md)
- [start](start.md) - [start](start.md)

View file

@ -6,5 +6,17 @@ The tracking issue for this feature is: [#29599]
------------------------ ------------------------
The `concat_idents` feature adds a macro for concatenating multiple identifiers
into one identifier.
## Examples
```rust
#![feature(concat_idents)]
fn main() {
fn foobar() -> u32 { 23 }
let f = concat_idents!(foo, bar);
assert_eq!(f(), 23);
}
```

View file

@ -6,5 +6,61 @@ The tracking issue for this feature is: [#34511]
------------------------ ------------------------
The `conservative_impl_trait` feature allows a conservative form of abstract
return types.
Abstract return types allow a function to hide a concrete return type behind a
trait interface similar to trait objects, while still generating the same
statically dispatched code as with concrete types.
## Examples
```rust
#![feature(conservative_impl_trait)]
fn even_iter() -> impl Iterator<Item=u32> {
(0..).map(|n| n * 2)
}
fn main() {
let first_four_even_numbers = even_iter().take(4).collect::<Vec<_>>();
assert_eq!(first_four_even_numbers, vec![0, 2, 4, 6]);
}
```
## Background
In today's Rust, you can write function signatures like:
````rust,ignore
fn consume_iter_static<I: Iterator<u8>>(iter: I) { }
fn consume_iter_dynamic(iter: Box<Iterator<u8>>) { }
````
In both cases, the function does not depend on the exact type of the argument.
The type held is "abstract", and is assumed only to satisfy a trait bound.
* In the `_static` version using generics, each use of the function is
specialized to a concrete, statically-known type, giving static dispatch,
inline layout, and other performance wins.
* In the `_dynamic` version using trait objects, the concrete argument type is
only known at runtime using a vtable.
On the other hand, while you can write:
````rust,ignore
fn produce_iter_dynamic() -> Box<Iterator<u8>> { }
````
...but you _cannot_ write something like:
````rust,ignore
fn produce_iter_static() -> Iterator<u8> { }
````
That is, in today's Rust, abstract return types can only be written using trait
objects, which can be a significant performance penalty. This RFC proposes
"unboxed abstract types" as a way of achieving signatures like
`produce_iter_static`. Like generics, unboxed abstract types guarantee static
dispatch and inline data layout.

View file

@ -6,5 +6,24 @@ The tracking issue for this feature is: [#24111]
------------------------ ------------------------
The `const_fn` feature allows marking free functions and inherent methods as
`const`, enabling them to be called in constants contexts, with constant
arguments.
## Examples
```rust
#![feature(const_fn)]
const fn double(x: i32) -> i32 {
x * 2
}
const FIVE: i32 = 5;
const TEN: i32 = double(FIVE);
fn main() {
assert_eq!(5, FIVE);
assert_eq!(10, TEN);
}
```

View file

@ -6,5 +6,14 @@ The tracking issue for this feature is: [#29947]
------------------------ ------------------------
The `const_indexing` feature allows the constant evaluation of index operations
on constant arrays and repeat expressions.
## Examples
```rust
#![feature(const_indexing)]
const ARR: [usize; 5] = [1, 2, 3, 4, 5];
const ARR2: [usize; ARR[1]] = [42, 99];
```

View file

@ -6,5 +6,20 @@ The tracking issue for this feature is: [#35118]
------------------------ ------------------------
The `i128_type` feature adds support for 128 bit signed and unsigned integer
types.
```rust
#![feature(i128_type)]
fn main() {
assert_eq!(1u128 + 1u128, 2u128);
assert_eq!(u128::min_value(), 0);
assert_eq!(u128::max_value(), 340282366920938463463374607431768211455);
assert_eq!(1i128 - 2i128, -1i128);
assert_eq!(i128::min_value(), -170141183460469231731687303715884105728);
assert_eq!(i128::max_value(), 170141183460469231731687303715884105727);
}
```

View file

@ -6,5 +6,13 @@ The tracking issue for this feature is: [#28979]
------------------------ ------------------------
The `non_ascii_idents` feature adds support for non-ASCII identifiers.
## Examples
```rust
#![feature(non_ascii_idents)]
const ε: f64 = 0.00001f64;
const Π: f64 = 3.14f64;
```

View file

@ -0,0 +1,9 @@
# `sort_unstable`
The tracking issue for this feature is: [#40585]
[#40585]: https://github.com/rust-lang/rust/issues/40585
------------------------

View file

@ -13,7 +13,7 @@
//! Single-threaded reference-counting pointers. //! Single-threaded reference-counting pointers.
//! //!
//! The type [`Rc<T>`][`Rc`] provides shared ownership of a value of type `T`, //! The type [`Rc<T>`][`Rc`] provides shared ownership of a value of type `T`,
//! allocated in the heap. Invoking [`clone()`][clone] on [`Rc`] produces a new //! allocated in the heap. Invoking [`clone`][clone] on [`Rc`] produces a new
//! pointer to the same value in the heap. When the last [`Rc`] pointer to a //! pointer to the same value in the heap. When the last [`Rc`] pointer to a
//! given value is destroyed, the pointed-to value is also destroyed. //! given value is destroyed, the pointed-to value is also destroyed.
//! //!
@ -30,7 +30,7 @@
//! threads. If you need multi-threaded, atomic reference counting, use //! threads. If you need multi-threaded, atomic reference counting, use
//! [`sync::Arc`][arc]. //! [`sync::Arc`][arc].
//! //!
//! The [`downgrade()`][downgrade] method can be used to create a non-owning //! The [`downgrade`][downgrade] method can be used to create a non-owning
//! [`Weak`] pointer. A [`Weak`] pointer can be [`upgrade`][upgrade]d //! [`Weak`] pointer. A [`Weak`] pointer can be [`upgrade`][upgrade]d
//! to an [`Rc`], but this will return [`None`] if the value has //! to an [`Rc`], but this will return [`None`] if the value has
//! already been dropped. //! already been dropped.

View file

@ -30,7 +30,7 @@ pub use imp::*;
mod imp { mod imp {
use libc::{c_int, c_void, size_t}; use libc::{c_int, c_void, size_t};
// Note that the symbols here are prefixed by default on OSX and Windows (we // Note that the symbols here are prefixed by default on macOS and Windows (we
// don't explicitly request it), and on Android and DragonFly we explicitly // don't explicitly request it), and on Android and DragonFly we explicitly
// request it as unprefixing cause segfaults (mismatches in allocators). // request it as unprefixing cause segfaults (mismatches in allocators).
extern "C" { extern "C" {

View file

@ -218,10 +218,10 @@ pub struct BinaryHeap<T> {
data: Vec<T>, data: Vec<T>,
} }
/// A container object that represents the result of the [`peek_mut()`] method /// A container object that represents the result of the [`peek_mut`] method
/// on `BinaryHeap`. See its documentation for details. /// on `BinaryHeap`. See its documentation for details.
/// ///
/// [`peek_mut()`]: struct.BinaryHeap.html#method.peek_mut /// [`peek_mut`]: struct.BinaryHeap.html#method.peek_mut
#[stable(feature = "binary_heap_peek_mut", since = "1.12.0")] #[stable(feature = "binary_heap_peek_mut", since = "1.12.0")]
pub struct PeekMut<'a, T: 'a + Ord> { pub struct PeekMut<'a, T: 'a + Ord> {
heap: &'a mut BinaryHeap<T>, heap: &'a mut BinaryHeap<T>,

View file

@ -306,7 +306,8 @@
//! `%`. The actual grammar for the formatting syntax is: //! `%`. The actual grammar for the formatting syntax is:
//! //!
//! ```text //! ```text
//! format_string := <text> [ format <text> ] * //! format_string := <text> [ maybe-format <text> ] *
//! maybe-format := '{' '{' | '}' '}' | <format>
//! format := '{' [ argument ] [ ':' format_spec ] '}' //! format := '{' [ argument ] [ ':' format_spec ] '}'
//! argument := integer | identifier //! argument := integer | identifier
//! //!

View file

@ -73,10 +73,10 @@
//! the element type of the slice is `i32`, the element type of the iterator is //! the element type of the slice is `i32`, the element type of the iterator is
//! `&mut i32`. //! `&mut i32`.
//! //!
//! * [`.iter()`] and [`.iter_mut()`] are the explicit methods to return the default //! * [`.iter`] and [`.iter_mut`] are the explicit methods to return the default
//! iterators. //! iterators.
//! * Further methods that return iterators are [`.split()`], [`.splitn()`], //! * Further methods that return iterators are [`.split`], [`.splitn`],
//! [`.chunks()`], [`.windows()`] and more. //! [`.chunks`], [`.windows`] and more.
//! //!
//! *[See also the slice primitive type](../../std/primitive.slice.html).* //! *[See also the slice primitive type](../../std/primitive.slice.html).*
//! //!
@ -85,12 +85,12 @@
//! [`Ord`]: ../../std/cmp/trait.Ord.html //! [`Ord`]: ../../std/cmp/trait.Ord.html
//! [`Iter`]: struct.Iter.html //! [`Iter`]: struct.Iter.html
//! [`Hash`]: ../../std/hash/trait.Hash.html //! [`Hash`]: ../../std/hash/trait.Hash.html
//! [`.iter()`]: ../../std/primitive.slice.html#method.iter //! [`.iter`]: ../../std/primitive.slice.html#method.iter
//! [`.iter_mut()`]: ../../std/primitive.slice.html#method.iter_mut //! [`.iter_mut`]: ../../std/primitive.slice.html#method.iter_mut
//! [`.split()`]: ../../std/primitive.slice.html#method.split //! [`.split`]: ../../std/primitive.slice.html#method.split
//! [`.splitn()`]: ../../std/primitive.slice.html#method.splitn //! [`.splitn`]: ../../std/primitive.slice.html#method.splitn
//! [`.chunks()`]: ../../std/primitive.slice.html#method.chunks //! [`.chunks`]: ../../std/primitive.slice.html#method.chunks
//! [`.windows()`]: ../../std/primitive.slice.html#method.windows //! [`.windows`]: ../../std/primitive.slice.html#method.windows
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
// Many of the usings in this module are only used in the test configuration. // Many of the usings in this module are only used in the test configuration.
@ -368,9 +368,9 @@ impl<T> [T] {
} }
/// Returns a mutable reference to an element or subslice depending on the /// Returns a mutable reference to an element or subslice depending on the
/// type of index (see [`get()`]) or `None` if the index is out of bounds. /// type of index (see [`get`]) or `None` if the index is out of bounds.
/// ///
/// [`get()`]: #method.get /// [`get`]: #method.get
/// ///
/// # Examples /// # Examples
/// ///

View file

@ -298,9 +298,9 @@ impl str {
/// excluding `end`. /// excluding `end`.
/// ///
/// To get a mutable string slice instead, see the /// To get a mutable string slice instead, see the
/// [`slice_mut_unchecked()`] method. /// [`slice_mut_unchecked`] method.
/// ///
/// [`slice_mut_unchecked()`]: #method.slice_mut_unchecked /// [`slice_mut_unchecked`]: #method.slice_mut_unchecked
/// ///
/// # Safety /// # Safety
/// ///
@ -341,9 +341,9 @@ impl str {
/// excluding `end`. /// excluding `end`.
/// ///
/// To get an immutable string slice instead, see the /// To get an immutable string slice instead, see the
/// [`slice_unchecked()`] method. /// [`slice_unchecked`] method.
/// ///
/// [`slice_unchecked()`]: #method.slice_unchecked /// [`slice_unchecked`]: #method.slice_unchecked
/// ///
/// # Safety /// # Safety
/// ///
@ -367,10 +367,10 @@ impl str {
/// The two slices returned go from the start of the string slice to `mid`, /// The two slices returned go from the start of the string slice to `mid`,
/// and from `mid` to the end of the string slice. /// and from `mid` to the end of the string slice.
/// ///
/// To get mutable string slices instead, see the [`split_at_mut()`] /// To get mutable string slices instead, see the [`split_at_mut`]
/// method. /// method.
/// ///
/// [`split_at_mut()`]: #method.split_at_mut /// [`split_at_mut`]: #method.split_at_mut
/// ///
/// # Panics /// # Panics
/// ///
@ -403,9 +403,9 @@ impl str {
/// The two slices returned go from the start of the string slice to `mid`, /// The two slices returned go from the start of the string slice to `mid`,
/// and from `mid` to the end of the string slice. /// and from `mid` to the end of the string slice.
/// ///
/// To get immutable string slices instead, see the [`split_at()`] method. /// To get immutable string slices instead, see the [`split_at`] method.
/// ///
/// [`split_at()`]: #method.split_at /// [`split_at`]: #method.split_at
/// ///
/// # Panics /// # Panics
/// ///
@ -824,10 +824,10 @@ impl str {
/// [`DoubleEndedIterator`]: iter/trait.DoubleEndedIterator.html /// [`DoubleEndedIterator`]: iter/trait.DoubleEndedIterator.html
/// ///
/// If the pattern allows a reverse search but its results might differ /// If the pattern allows a reverse search but its results might differ
/// from a forward search, the [`rsplit()`] method can be used. /// from a forward search, the [`rsplit`] method can be used.
/// ///
/// [`char`]: primitive.char.html /// [`char`]: primitive.char.html
/// [`rsplit()`]: #method.rsplit /// [`rsplit`]: #method.rsplit
/// ///
/// # Examples /// # Examples
/// ///
@ -912,9 +912,9 @@ impl str {
/// assert_eq!(d, &["a", "b", "c"]); /// assert_eq!(d, &["a", "b", "c"]);
/// ``` /// ```
/// ///
/// Use [`split_whitespace()`] for this behavior. /// Use [`split_whitespace`] for this behavior.
/// ///
/// [`split_whitespace()`]: #method.split_whitespace /// [`split_whitespace`]: #method.split_whitespace
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn split<'a, P: Pattern<'a>>(&'a self, pat: P) -> Split<'a, P> { pub fn split<'a, P: Pattern<'a>>(&'a self, pat: P) -> Split<'a, P> {
core_str::StrExt::split(self, pat) core_str::StrExt::split(self, pat)
@ -936,9 +936,9 @@ impl str {
/// ///
/// [`DoubleEndedIterator`]: iter/trait.DoubleEndedIterator.html /// [`DoubleEndedIterator`]: iter/trait.DoubleEndedIterator.html
/// ///
/// For iterating from the front, the [`split()`] method can be used. /// For iterating from the front, the [`split`] method can be used.
/// ///
/// [`split()`]: #method.split /// [`split`]: #method.split
/// ///
/// # Examples /// # Examples
/// ///
@ -977,10 +977,10 @@ impl str {
/// The pattern can be a `&str`, [`char`], or a closure that determines the /// The pattern can be a `&str`, [`char`], or a closure that determines the
/// split. /// split.
/// ///
/// Equivalent to [`split()`], except that the trailing substring /// Equivalent to [`split`], except that the trailing substring
/// is skipped if empty. /// is skipped if empty.
/// ///
/// [`split()`]: #method.split /// [`split`]: #method.split
/// ///
/// This method can be used for string data that is _terminated_, /// This method can be used for string data that is _terminated_,
/// rather than _separated_ by a pattern. /// rather than _separated_ by a pattern.
@ -995,9 +995,9 @@ impl str {
/// [`char`]: primitive.char.html /// [`char`]: primitive.char.html
/// ///
/// If the pattern allows a reverse search but its results might differ /// If the pattern allows a reverse search but its results might differ
/// from a forward search, the [`rsplit_terminator()`] method can be used. /// from a forward search, the [`rsplit_terminator`] method can be used.
/// ///
/// [`rsplit_terminator()`]: #method.rsplit_terminator /// [`rsplit_terminator`]: #method.rsplit_terminator
/// ///
/// # Examples /// # Examples
/// ///
@ -1025,10 +1025,10 @@ impl str {
/// ///
/// [`char`]: primitive.char.html /// [`char`]: primitive.char.html
/// ///
/// Equivalent to [`split()`], except that the trailing substring is /// Equivalent to [`split`], except that the trailing substring is
/// skipped if empty. /// skipped if empty.
/// ///
/// [`split()`]: #method.split /// [`split`]: #method.split
/// ///
/// This method can be used for string data that is _terminated_, /// This method can be used for string data that is _terminated_,
/// rather than _separated_ by a pattern. /// rather than _separated_ by a pattern.
@ -1039,10 +1039,10 @@ impl str {
/// reverse search, and it will be double ended if a forward/reverse /// reverse search, and it will be double ended if a forward/reverse
/// search yields the same elements. /// search yields the same elements.
/// ///
/// For iterating from the front, the [`split_terminator()`] method can be /// For iterating from the front, the [`split_terminator`] method can be
/// used. /// used.
/// ///
/// [`split_terminator()`]: #method.split_terminator /// [`split_terminator`]: #method.split_terminator
/// ///
/// # Examples /// # Examples
/// ///
@ -1076,10 +1076,10 @@ impl str {
/// The returned iterator will not be double ended, because it is /// The returned iterator will not be double ended, because it is
/// not efficient to support. /// not efficient to support.
/// ///
/// If the pattern allows a reverse search, the [`rsplitn()`] method can be /// If the pattern allows a reverse search, the [`rsplitn`] method can be
/// used. /// used.
/// ///
/// [`rsplitn()`]: #method.rsplitn /// [`rsplitn`]: #method.rsplitn
/// ///
/// # Examples /// # Examples
/// ///
@ -1127,9 +1127,9 @@ impl str {
/// The returned iterator will not be double ended, because it is not /// The returned iterator will not be double ended, because it is not
/// efficient to support. /// efficient to support.
/// ///
/// For splitting from the front, the [`splitn()`] method can be used. /// For splitting from the front, the [`splitn`] method can be used.
/// ///
/// [`splitn()`]: #method.splitn /// [`splitn`]: #method.splitn
/// ///
/// # Examples /// # Examples
/// ///
@ -1177,9 +1177,9 @@ impl str {
/// [`char`]: primitive.char.html /// [`char`]: primitive.char.html
/// ///
/// If the pattern allows a reverse search but its results might differ /// If the pattern allows a reverse search but its results might differ
/// from a forward search, the [`rmatches()`] method can be used. /// from a forward search, the [`rmatches`] method can be used.
/// ///
/// [`rmatches()`]: #method.rmatches /// [`rmatches`]: #method.rmatches
/// ///
/// # Examples /// # Examples
/// ///
@ -1213,9 +1213,9 @@ impl str {
/// ///
/// [`DoubleEndedIterator`]: iter/trait.DoubleEndedIterator.html /// [`DoubleEndedIterator`]: iter/trait.DoubleEndedIterator.html
/// ///
/// For iterating from the front, the [`matches()`] method can be used. /// For iterating from the front, the [`matches`] method can be used.
/// ///
/// [`matches()`]: #method.matches /// [`matches`]: #method.matches
/// ///
/// # Examples /// # Examples
/// ///
@ -1255,9 +1255,9 @@ impl str {
/// [`DoubleEndedIterator`]: iter/trait.DoubleEndedIterator.html /// [`DoubleEndedIterator`]: iter/trait.DoubleEndedIterator.html
/// ///
/// If the pattern allows a reverse search but its results might differ /// If the pattern allows a reverse search but its results might differ
/// from a forward search, the [`rmatch_indices()`] method can be used. /// from a forward search, the [`rmatch_indices`] method can be used.
/// ///
/// [`rmatch_indices()`]: #method.rmatch_indices /// [`rmatch_indices`]: #method.rmatch_indices
/// ///
/// # Examples /// # Examples
/// ///
@ -1297,9 +1297,9 @@ impl str {
/// ///
/// [`DoubleEndedIterator`]: iter/trait.DoubleEndedIterator.html /// [`DoubleEndedIterator`]: iter/trait.DoubleEndedIterator.html
/// ///
/// For iterating from the front, the [`match_indices()`] method can be used. /// For iterating from the front, the [`match_indices`] method can be used.
/// ///
/// [`match_indices()`]: #method.match_indices /// [`match_indices`]: #method.match_indices
/// ///
/// # Examples /// # Examples
/// ///

View file

@ -89,8 +89,8 @@ use boxed::Box;
/// let hello = String::from("Hello, world!"); /// let hello = String::from("Hello, world!");
/// ``` /// ```
/// ///
/// You can append a [`char`] to a `String` with the [`push()`] method, and /// You can append a [`char`] to a `String` with the [`push`] method, and
/// append a [`&str`] with the [`push_str()`] method: /// append a [`&str`] with the [`push_str`] method:
/// ///
/// ``` /// ```
/// let mut hello = String::from("Hello, "); /// let mut hello = String::from("Hello, ");
@ -100,11 +100,11 @@ use boxed::Box;
/// ``` /// ```
/// ///
/// [`char`]: ../../std/primitive.char.html /// [`char`]: ../../std/primitive.char.html
/// [`push()`]: #method.push /// [`push`]: #method.push
/// [`push_str()`]: #method.push_str /// [`push_str`]: #method.push_str
/// ///
/// If you have a vector of UTF-8 bytes, you can create a `String` from it with /// If you have a vector of UTF-8 bytes, you can create a `String` from it with
/// the [`from_utf8()`] method: /// the [`from_utf8`] method:
/// ///
/// ``` /// ```
/// // some bytes, in a vector /// // some bytes, in a vector
@ -116,7 +116,7 @@ use boxed::Box;
/// assert_eq!("💖", sparkle_heart); /// assert_eq!("💖", sparkle_heart);
/// ``` /// ```
/// ///
/// [`from_utf8()`]: #method.from_utf8 /// [`from_utf8`]: #method.from_utf8
/// ///
/// # UTF-8 /// # UTF-8
/// ///
@ -136,11 +136,11 @@ use boxed::Box;
/// Indexing is intended to be a constant-time operation, but UTF-8 encoding /// Indexing is intended to be a constant-time operation, but UTF-8 encoding
/// does not allow us to do this. Furthermore, it's not clear what sort of /// does not allow us to do this. Furthermore, it's not clear what sort of
/// thing the index should return: a byte, a codepoint, or a grapheme cluster. /// thing the index should return: a byte, a codepoint, or a grapheme cluster.
/// The [`bytes()`] and [`chars()`] methods return iterators over the first /// The [`bytes`] and [`chars`] methods return iterators over the first
/// two, respectively. /// two, respectively.
/// ///
/// [`bytes()`]: #method.bytes /// [`bytes`]: #method.bytes
/// [`chars()`]: #method.chars /// [`chars`]: #method.chars
/// ///
/// # Deref /// # Deref
/// ///
@ -174,7 +174,7 @@ use boxed::Box;
/// ///
/// This buffer is always stored on the heap. /// This buffer is always stored on the heap.
/// ///
/// You can look at these with the [`as_ptr()`], [`len()`], and [`capacity()`] /// You can look at these with the [`as_ptr`], [`len`], and [`capacity`]
/// methods: /// methods:
/// ///
/// ``` /// ```
@ -200,9 +200,9 @@ use boxed::Box;
/// assert_eq!(String::from("Once upon a time..."), s); /// assert_eq!(String::from("Once upon a time..."), s);
/// ``` /// ```
/// ///
/// [`as_ptr()`]: #method.as_ptr /// [`as_ptr`]: #method.as_ptr
/// [`len()`]: #method.len /// [`len`]: #method.len
/// [`capacity()`]: #method.capacity /// [`capacity`]: #method.capacity
/// ///
/// If a `String` has enough capacity, adding elements to it will not /// If a `String` has enough capacity, adding elements to it will not
/// re-allocate. For example, consider this program: /// re-allocate. For example, consider this program:
@ -231,7 +231,7 @@ use boxed::Box;
/// ///
/// At first, we have no memory allocated at all, but as we append to the /// At first, we have no memory allocated at all, but as we append to the
/// string, it increases its capacity appropriately. If we instead use the /// string, it increases its capacity appropriately. If we instead use the
/// [`with_capacity()`] method to allocate the correct capacity initially: /// [`with_capacity`] method to allocate the correct capacity initially:
/// ///
/// ``` /// ```
/// let mut s = String::with_capacity(25); /// let mut s = String::with_capacity(25);
@ -244,7 +244,7 @@ use boxed::Box;
/// } /// }
/// ``` /// ```
/// ///
/// [`with_capacity()`]: #method.with_capacity /// [`with_capacity`]: #method.with_capacity
/// ///
/// We end up with a different output: /// We end up with a different output:
/// ///
@ -266,25 +266,25 @@ pub struct String {
/// A possible error value when converting a `String` from a UTF-8 byte vector. /// A possible error value when converting a `String` from a UTF-8 byte vector.
/// ///
/// This type is the error type for the [`from_utf8()`] method on [`String`]. It /// This type is the error type for the [`from_utf8`] method on [`String`]. It
/// is designed in such a way to carefully avoid reallocations: the /// is designed in such a way to carefully avoid reallocations: the
/// [`into_bytes()`] method will give back the byte vector that was used in the /// [`into_bytes`] method will give back the byte vector that was used in the
/// conversion attempt. /// conversion attempt.
/// ///
/// [`from_utf8()`]: struct.String.html#method.from_utf8 /// [`from_utf8`]: struct.String.html#method.from_utf8
/// [`String`]: struct.String.html /// [`String`]: struct.String.html
/// [`into_bytes()`]: struct.FromUtf8Error.html#method.into_bytes /// [`into_bytes`]: struct.FromUtf8Error.html#method.into_bytes
/// ///
/// The [`Utf8Error`] type provided by [`std::str`] represents an error that may /// The [`Utf8Error`] type provided by [`std::str`] represents an error that may
/// occur when converting a slice of [`u8`]s to a [`&str`]. In this sense, it's /// occur when converting a slice of [`u8`]s to a [`&str`]. In this sense, it's
/// an analogue to `FromUtf8Error`, and you can get one from a `FromUtf8Error` /// an analogue to `FromUtf8Error`, and you can get one from a `FromUtf8Error`
/// through the [`utf8_error()`] method. /// through the [`utf8_error`] method.
/// ///
/// [`Utf8Error`]: ../../std/str/struct.Utf8Error.html /// [`Utf8Error`]: ../../std/str/struct.Utf8Error.html
/// [`std::str`]: ../../std/str/index.html /// [`std::str`]: ../../std/str/index.html
/// [`u8`]: ../../std/primitive.u8.html /// [`u8`]: ../../std/primitive.u8.html
/// [`&str`]: ../../std/primitive.str.html /// [`&str`]: ../../std/primitive.str.html
/// [`utf8_error()`]: #method.utf8_error /// [`utf8_error`]: #method.utf8_error
/// ///
/// # Examples /// # Examples
/// ///
@ -308,9 +308,9 @@ pub struct FromUtf8Error {
/// A possible error value when converting a `String` from a UTF-16 byte slice. /// A possible error value when converting a `String` from a UTF-16 byte slice.
/// ///
/// This type is the error type for the [`from_utf16()`] method on [`String`]. /// This type is the error type for the [`from_utf16`] method on [`String`].
/// ///
/// [`from_utf16()`]: struct.String.html#method.from_utf16 /// [`from_utf16`]: struct.String.html#method.from_utf16
/// [`String`]: struct.String.html /// [`String`]: struct.String.html
/// ///
/// # Examples /// # Examples
@ -335,10 +335,10 @@ impl String {
/// buffer. While that means that this initial operation is very /// buffer. While that means that this initial operation is very
/// inexpensive, but may cause excessive allocation later, when you add /// inexpensive, but may cause excessive allocation later, when you add
/// data. If you have an idea of how much data the `String` will hold, /// data. If you have an idea of how much data the `String` will hold,
/// consider the [`with_capacity()`] method to prevent excessive /// consider the [`with_capacity`] method to prevent excessive
/// re-allocation. /// re-allocation.
/// ///
/// [`with_capacity()`]: #method.with_capacity /// [`with_capacity`]: #method.with_capacity
/// ///
/// # Examples /// # Examples
/// ///
@ -356,18 +356,18 @@ impl String {
/// Creates a new empty `String` with a particular capacity. /// Creates a new empty `String` with a particular capacity.
/// ///
/// `String`s have an internal buffer to hold their data. The capacity is /// `String`s have an internal buffer to hold their data. The capacity is
/// the length of that buffer, and can be queried with the [`capacity()`] /// the length of that buffer, and can be queried with the [`capacity`]
/// method. This method creates an empty `String`, but one with an initial /// method. This method creates an empty `String`, but one with an initial
/// buffer that can hold `capacity` bytes. This is useful when you may be /// buffer that can hold `capacity` bytes. This is useful when you may be
/// appending a bunch of data to the `String`, reducing the number of /// appending a bunch of data to the `String`, reducing the number of
/// reallocations it needs to do. /// reallocations it needs to do.
/// ///
/// [`capacity()`]: #method.capacity /// [`capacity`]: #method.capacity
/// ///
/// If the given capacity is `0`, no allocation will occur, and this method /// If the given capacity is `0`, no allocation will occur, and this method
/// is identical to the [`new()`] method. /// is identical to the [`new`] method.
/// ///
/// [`new()`]: #method.new /// [`new`]: #method.new
/// ///
/// # Examples /// # Examples
/// ///
@ -420,18 +420,18 @@ impl String {
/// ///
/// If you are sure that the byte slice is valid UTF-8, and you don't want /// If you are sure that the byte slice is valid UTF-8, and you don't want
/// to incur the overhead of the validity check, there is an unsafe version /// to incur the overhead of the validity check, there is an unsafe version
/// of this function, [`from_utf8_unchecked()`], which has the same behavior /// of this function, [`from_utf8_unchecked`], which has the same behavior
/// but skips the check. /// but skips the check.
/// ///
/// [`from_utf8_unchecked()`]: struct.String.html#method.from_utf8_unchecked /// [`from_utf8_unchecked`]: struct.String.html#method.from_utf8_unchecked
/// ///
/// This method will take care to not copy the vector, for efficiency's /// This method will take care to not copy the vector, for efficiency's
/// sake. /// sake.
/// ///
/// If you need a `&str` instead of a `String`, consider /// If you need a `&str` instead of a `String`, consider
/// [`str::from_utf8()`]. /// [`str::from_utf8`].
/// ///
/// [`str::from_utf8()`]: ../../std/str/fn.from_utf8.html /// [`str::from_utf8`]: ../../std/str/fn.from_utf8.html
/// ///
/// The inverse of this method is [`as_bytes`]. /// The inverse of this method is [`as_bytes`].
/// ///
@ -497,10 +497,10 @@ impl String {
/// ///
/// If you are sure that the byte slice is valid UTF-8, and you don't want /// If you are sure that the byte slice is valid UTF-8, and you don't want
/// to incur the overhead of the conversion, there is an unsafe version /// to incur the overhead of the conversion, there is an unsafe version
/// of this function, [`from_utf8_unchecked()`], which has the same behavior /// of this function, [`from_utf8_unchecked`], which has the same behavior
/// but skips the checks. /// but skips the checks.
/// ///
/// [`from_utf8_unchecked()`]: struct.String.html#method.from_utf8_unchecked /// [`from_utf8_unchecked`]: struct.String.html#method.from_utf8_unchecked
/// ///
/// This function returns a [`Cow<'a, str>`]. If our byte slice is invalid /// This function returns a [`Cow<'a, str>`]. If our byte slice is invalid
/// UTF-8, then we need to insert the replacement characters, which will /// UTF-8, then we need to insert the replacement characters, which will
@ -738,9 +738,9 @@ impl String {
/// Converts a vector of bytes to a `String` without checking that the /// Converts a vector of bytes to a `String` without checking that the
/// string contains valid UTF-8. /// string contains valid UTF-8.
/// ///
/// See the safe version, [`from_utf8()`], for more details. /// See the safe version, [`from_utf8`], for more details.
/// ///
/// [`from_utf8()`]: struct.String.html#method.from_utf8 /// [`from_utf8`]: struct.String.html#method.from_utf8
/// ///
/// # Safety /// # Safety
/// ///
@ -845,10 +845,10 @@ impl String {
/// The capacity may be increased by more than `additional` bytes if it /// The capacity may be increased by more than `additional` bytes if it
/// chooses, to prevent frequent reallocations. /// chooses, to prevent frequent reallocations.
/// ///
/// If you do not want this "at least" behavior, see the [`reserve_exact()`] /// If you do not want this "at least" behavior, see the [`reserve_exact`]
/// method. /// method.
/// ///
/// [`reserve_exact()`]: #method.reserve_exact /// [`reserve_exact`]: #method.reserve_exact
/// ///
/// # Panics /// # Panics
/// ///
@ -892,10 +892,10 @@ impl String {
/// Ensures that this `String`'s capacity is `additional` bytes /// Ensures that this `String`'s capacity is `additional` bytes
/// larger than its length. /// larger than its length.
/// ///
/// Consider using the [`reserve()`] method unless you absolutely know /// Consider using the [`reserve`] method unless you absolutely know
/// better than the allocator. /// better than the allocator.
/// ///
/// [`reserve()`]: #method.reserve /// [`reserve`]: #method.reserve
/// ///
/// # Panics /// # Panics
/// ///
@ -1699,9 +1699,9 @@ impl<'a> Add<&'a str> for String {
/// Implements the `+=` operator for appending to a `String`. /// Implements the `+=` operator for appending to a `String`.
/// ///
/// This has the same behavior as the [`push_str()`] method. /// This has the same behavior as the [`push_str`] method.
/// ///
/// [`push_str()`]: struct.String.html#method.push_str /// [`push_str`]: struct.String.html#method.push_str
#[stable(feature = "stringaddassign", since = "1.12.0")] #[stable(feature = "stringaddassign", since = "1.12.0")]
impl<'a> AddAssign<&'a str> for String { impl<'a> AddAssign<&'a str> for String {
#[inline] #[inline]
@ -1830,14 +1830,14 @@ impl ops::DerefMut for String {
/// ///
/// This `enum` is slightly awkward: it will never actually exist. This error is /// This `enum` is slightly awkward: it will never actually exist. This error is
/// part of the type signature of the implementation of [`FromStr`] on /// part of the type signature of the implementation of [`FromStr`] on
/// [`String`]. The return type of [`from_str()`], requires that an error be /// [`String`]. The return type of [`from_str`], requires that an error be
/// defined, but, given that a [`String`] can always be made into a new /// defined, but, given that a [`String`] can always be made into a new
/// [`String`] without error, this type will never actually be returned. As /// [`String`] without error, this type will never actually be returned. As
/// such, it is only here to satisfy said signature, and is useless otherwise. /// such, it is only here to satisfy said signature, and is useless otherwise.
/// ///
/// [`FromStr`]: ../../std/str/trait.FromStr.html /// [`FromStr`]: ../../std/str/trait.FromStr.html
/// [`String`]: struct.String.html /// [`String`]: struct.String.html
/// [`from_str()`]: ../../std/str/trait.FromStr.html#tymethod.from_str /// [`from_str`]: ../../std/str/trait.FromStr.html#tymethod.from_str
#[stable(feature = "str_parse_error", since = "1.5.0")] #[stable(feature = "str_parse_error", since = "1.5.0")]
#[derive(Copy)] #[derive(Copy)]
pub enum ParseError {} pub enum ParseError {}
@ -2058,10 +2058,10 @@ impl fmt::Write for String {
/// A draining iterator for `String`. /// A draining iterator for `String`.
/// ///
/// This struct is created by the [`drain()`] method on [`String`]. See its /// This struct is created by the [`drain`] method on [`String`]. See its
/// documentation for more. /// documentation for more.
/// ///
/// [`drain()`]: struct.String.html#method.drain /// [`drain`]: struct.String.html#method.drain
/// [`String`]: struct.String.html /// [`String`]: struct.String.html
#[stable(feature = "drain", since = "1.6.0")] #[stable(feature = "drain", since = "1.6.0")]
pub struct Drain<'a> { pub struct Drain<'a> {

View file

@ -16,7 +16,7 @@
//! //!
//! # Examples //! # Examples
//! //!
//! You can explicitly create a [`Vec<T>`] with [`new()`]: //! You can explicitly create a [`Vec<T>`] with [`new`]:
//! //!
//! ``` //! ```
//! let v: Vec<i32> = Vec::new(); //! let v: Vec<i32> = Vec::new();
@ -58,7 +58,7 @@
//! ``` //! ```
//! //!
//! [`Vec<T>`]: ../../std/vec/struct.Vec.html //! [`Vec<T>`]: ../../std/vec/struct.Vec.html
//! [`new()`]: ../../std/vec/struct.Vec.html#method.new //! [`new`]: ../../std/vec/struct.Vec.html#method.new
//! [`push`]: ../../std/vec/struct.Vec.html#method.push //! [`push`]: ../../std/vec/struct.Vec.html#method.push
//! [`Index`]: ../../std/ops/trait.Index.html //! [`Index`]: ../../std/ops/trait.Index.html
//! [`IndexMut`]: ../../std/ops/trait.IndexMut.html //! [`IndexMut`]: ../../std/ops/trait.IndexMut.html
@ -216,19 +216,19 @@ use Bound::{Excluded, Included, Unbounded};
/// The pointer will never be null, so this type is null-pointer-optimized. /// The pointer will never be null, so this type is null-pointer-optimized.
/// ///
/// However, the pointer may not actually point to allocated memory. In particular, /// However, the pointer may not actually point to allocated memory. In particular,
/// if you construct a `Vec` with capacity 0 via [`Vec::new()`], [`vec![]`][`vec!`], /// if you construct a `Vec` with capacity 0 via [`Vec::new`], [`vec![]`][`vec!`],
/// [`Vec::with_capacity(0)`][`Vec::with_capacity`], or by calling [`shrink_to_fit()`] /// [`Vec::with_capacity(0)`][`Vec::with_capacity`], or by calling [`shrink_to_fit`]
/// on an empty Vec, it will not allocate memory. Similarly, if you store zero-sized /// on an empty Vec, it will not allocate memory. Similarly, if you store zero-sized
/// types inside a `Vec`, it will not allocate space for them. *Note that in this case /// types inside a `Vec`, it will not allocate space for them. *Note that in this case
/// the `Vec` may not report a [`capacity()`] of 0*. `Vec` will allocate if and only /// the `Vec` may not report a [`capacity`] of 0*. `Vec` will allocate if and only
/// if [`mem::size_of::<T>()`]` * capacity() > 0`. In general, `Vec`'s allocation /// if [`mem::size_of::<T>`]` * capacity() > 0`. In general, `Vec`'s allocation
/// details are subtle enough that it is strongly recommended that you only /// details are subtle enough that it is strongly recommended that you only
/// free memory allocated by a `Vec` by creating a new `Vec` and dropping it. /// free memory allocated by a `Vec` by creating a new `Vec` and dropping it.
/// ///
/// If a `Vec` *has* allocated memory, then the memory it points to is on the heap /// If a `Vec` *has* allocated memory, then the memory it points to is on the heap
/// (as defined by the allocator Rust is configured to use by default), and its /// (as defined by the allocator Rust is configured to use by default), and its
/// pointer points to [`len()`] initialized elements in order (what you would see /// pointer points to [`len`] initialized elements in order (what you would see
/// if you coerced it to a slice), followed by [`capacity()`]` - `[`len()`] /// if you coerced it to a slice), followed by [`capacity`]` - `[`len`]
/// logically uninitialized elements. /// logically uninitialized elements.
/// ///
/// `Vec` will never perform a "small optimization" where elements are actually /// `Vec` will never perform a "small optimization" where elements are actually
@ -244,13 +244,13 @@ use Bound::{Excluded, Included, Unbounded};
/// ///
/// `Vec` will never automatically shrink itself, even if completely empty. This /// `Vec` will never automatically shrink itself, even if completely empty. This
/// ensures no unnecessary allocations or deallocations occur. Emptying a `Vec` /// ensures no unnecessary allocations or deallocations occur. Emptying a `Vec`
/// and then filling it back up to the same [`len()`] should incur no calls to /// and then filling it back up to the same [`len`] should incur no calls to
/// the allocator. If you wish to free up unused memory, use /// the allocator. If you wish to free up unused memory, use
/// [`shrink_to_fit`][`shrink_to_fit()`]. /// [`shrink_to_fit`][`shrink_to_fit`].
/// ///
/// [`push`] and [`insert`] will never (re)allocate if the reported capacity is /// [`push`] and [`insert`] will never (re)allocate if the reported capacity is
/// sufficient. [`push`] and [`insert`] *will* (re)allocate if /// sufficient. [`push`] and [`insert`] *will* (re)allocate if
/// [`len()`]` == `[`capacity()`]. That is, the reported capacity is completely /// [`len`]` == `[`capacity`]. That is, the reported capacity is completely
/// accurate, and can be relied on. It can even be used to manually free the memory /// accurate, and can be relied on. It can even be used to manually free the memory
/// allocated by a `Vec` if desired. Bulk insertion methods *may* reallocate, even /// allocated by a `Vec` if desired. Bulk insertion methods *may* reallocate, even
/// when not necessary. /// when not necessary.
@ -262,7 +262,7 @@ use Bound::{Excluded, Included, Unbounded};
/// ///
/// `vec![x; n]`, `vec![a, b, c, d]`, and /// `vec![x; n]`, `vec![a, b, c, d]`, and
/// [`Vec::with_capacity(n)`][`Vec::with_capacity`], will all produce a `Vec` /// [`Vec::with_capacity(n)`][`Vec::with_capacity`], will all produce a `Vec`
/// with exactly the requested capacity. If [`len()`]` == `[`capacity()`], /// with exactly the requested capacity. If [`len`]` == `[`capacity`],
/// (as is the case for the [`vec!`] macro), then a `Vec<T>` can be converted to /// (as is the case for the [`vec!`] macro), then a `Vec<T>` can be converted to
/// and from a [`Box<[T]>`][owned slice] without reallocating or moving the elements. /// and from a [`Box<[T]>`][owned slice] without reallocating or moving the elements.
/// ///
@ -283,11 +283,11 @@ use Bound::{Excluded, Included, Unbounded};
/// [`String`]: ../../std/string/struct.String.html /// [`String`]: ../../std/string/struct.String.html
/// [`&str`]: ../../std/primitive.str.html /// [`&str`]: ../../std/primitive.str.html
/// [`Vec::with_capacity`]: ../../std/vec/struct.Vec.html#method.with_capacity /// [`Vec::with_capacity`]: ../../std/vec/struct.Vec.html#method.with_capacity
/// [`Vec::new()`]: ../../std/vec/struct.Vec.html#method.new /// [`Vec::new`]: ../../std/vec/struct.Vec.html#method.new
/// [`shrink_to_fit()`]: ../../std/vec/struct.Vec.html#method.shrink_to_fit /// [`shrink_to_fit`]: ../../std/vec/struct.Vec.html#method.shrink_to_fit
/// [`capacity()`]: ../../std/vec/struct.Vec.html#method.capacity /// [`capacity`]: ../../std/vec/struct.Vec.html#method.capacity
/// [`mem::size_of::<T>()`]: ../../std/mem/fn.size_of.html /// [`mem::size_of::<T>`]: ../../std/mem/fn.size_of.html
/// [`len()`]: ../../std/vec/struct.Vec.html#method.len /// [`len`]: ../../std/vec/struct.Vec.html#method.len
/// [`push`]: ../../std/vec/struct.Vec.html#method.push /// [`push`]: ../../std/vec/struct.Vec.html#method.push
/// [`insert`]: ../../std/vec/struct.Vec.html#method.insert /// [`insert`]: ../../std/vec/struct.Vec.html#method.insert
/// [`reserve`]: ../../std/vec/struct.Vec.html#method.reserve /// [`reserve`]: ../../std/vec/struct.Vec.html#method.reserve
@ -504,12 +504,12 @@ impl<T> Vec<T> {
/// Converts the vector into [`Box<[T]>`][owned slice]. /// Converts the vector into [`Box<[T]>`][owned slice].
/// ///
/// Note that this will drop any excess capacity. Calling this and /// Note that this will drop any excess capacity. Calling this and
/// converting back to a vector with [`into_vec()`] is equivalent to calling /// converting back to a vector with [`into_vec`] is equivalent to calling
/// [`shrink_to_fit()`]. /// [`shrink_to_fit`].
/// ///
/// [owned slice]: ../../std/boxed/struct.Box.html /// [owned slice]: ../../std/boxed/struct.Box.html
/// [`into_vec()`]: ../../std/primitive.slice.html#method.into_vec /// [`into_vec`]: ../../std/primitive.slice.html#method.into_vec
/// [`shrink_to_fit()`]: #method.shrink_to_fit /// [`shrink_to_fit`]: #method.shrink_to_fit
/// ///
/// # Examples /// # Examples
/// ///
@ -838,7 +838,11 @@ impl<T> Vec<T> {
self.dedup_by(|a, b| key(a) == key(b)) self.dedup_by(|a, b| key(a) == key(b))
} }
/// Removes consecutive elements in the vector that resolve to the same key. /// Removes consecutive elements in the vector according to a predicate.
///
/// The `same_bucket` function is passed references to two elements from the vector, and
/// returns `true` if the elements compare equal, or `false` if they do not. Only the first
/// of adjacent equal items is kept.
/// ///
/// If the vector is sorted, this removes all duplicates. /// If the vector is sorted, this removes all duplicates.
/// ///

View file

@ -97,9 +97,9 @@ pub const MAX: char = '\u{10ffff}';
/// [`as`]: ../../book/casting-between-types.html#as /// [`as`]: ../../book/casting-between-types.html#as
/// ///
/// For an unsafe version of this function which ignores these checks, see /// For an unsafe version of this function which ignores these checks, see
/// [`from_u32_unchecked()`]. /// [`from_u32_unchecked`].
/// ///
/// [`from_u32_unchecked()`]: fn.from_u32_unchecked.html /// [`from_u32_unchecked`]: fn.from_u32_unchecked.html
/// ///
/// # Examples /// # Examples
/// ///
@ -152,9 +152,9 @@ pub fn from_u32(i: u32) -> Option<char> {
/// ///
/// This function is unsafe, as it may construct invalid `char` values. /// This function is unsafe, as it may construct invalid `char` values.
/// ///
/// For a safe version of this function, see the [`from_u32()`] function. /// For a safe version of this function, see the [`from_u32`] function.
/// ///
/// [`from_u32()`]: fn.from_u32.html /// [`from_u32`]: fn.from_u32.html
/// ///
/// # Examples /// # Examples
/// ///
@ -479,10 +479,10 @@ impl CharExt for char {
/// Returns an iterator that yields the hexadecimal Unicode escape of a /// Returns an iterator that yields the hexadecimal Unicode escape of a
/// character, as `char`s. /// character, as `char`s.
/// ///
/// This `struct` is created by the [`escape_unicode()`] method on [`char`]. See /// This `struct` is created by the [`escape_unicode`] method on [`char`]. See
/// its documentation for more. /// its documentation for more.
/// ///
/// [`escape_unicode()`]: ../../std/primitive.char.html#method.escape_unicode /// [`escape_unicode`]: ../../std/primitive.char.html#method.escape_unicode
/// [`char`]: ../../std/primitive.char.html /// [`char`]: ../../std/primitive.char.html
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@ -600,10 +600,10 @@ impl fmt::Display for EscapeUnicode {
/// An iterator that yields the literal escape code of a `char`. /// An iterator that yields the literal escape code of a `char`.
/// ///
/// This `struct` is created by the [`escape_default()`] method on [`char`]. See /// This `struct` is created by the [`escape_default`] method on [`char`]. See
/// its documentation for more. /// its documentation for more.
/// ///
/// [`escape_default()`]: ../../std/primitive.char.html#method.escape_default /// [`escape_default`]: ../../std/primitive.char.html#method.escape_default
/// [`char`]: ../../std/primitive.char.html /// [`char`]: ../../std/primitive.char.html
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@ -713,10 +713,10 @@ impl fmt::Display for EscapeDefault {
/// An iterator that yields the literal escape code of a `char`. /// An iterator that yields the literal escape code of a `char`.
/// ///
/// This `struct` is created by the [`escape_debug()`] method on [`char`]. See its /// This `struct` is created by the [`escape_debug`] method on [`char`]. See its
/// documentation for more. /// documentation for more.
/// ///
/// [`escape_debug()`]: ../../std/primitive.char.html#method.escape_debug /// [`escape_debug`]: ../../std/primitive.char.html#method.escape_debug
/// [`char`]: ../../std/primitive.char.html /// [`char`]: ../../std/primitive.char.html
#[unstable(feature = "char_escape_debug", issue = "35068")] #[unstable(feature = "char_escape_debug", issue = "35068")]
#[derive(Clone, Debug)] #[derive(Clone, Debug)]

View file

@ -61,7 +61,7 @@
/// ## Derivable /// ## Derivable
/// ///
/// This trait can be used with `#[derive]` if all fields are `Clone`. The `derive`d /// This trait can be used with `#[derive]` if all fields are `Clone`. The `derive`d
/// implementation of [`clone()`] calls [`clone()`] on each field. /// implementation of [`clone`] calls [`clone`] on each field.
/// ///
/// ## How can I implement `Clone`? /// ## How can I implement `Clone`?
/// ///
@ -75,7 +75,7 @@
/// `Clone` cannot be `derive`d, but can be implemented as: /// `Clone` cannot be `derive`d, but can be implemented as:
/// ///
/// [`Copy`]: ../../std/marker/trait.Copy.html /// [`Copy`]: ../../std/marker/trait.Copy.html
/// [`clone()`]: trait.Clone.html#tymethod.clone /// [`clone`]: trait.Clone.html#tymethod.clone
/// ///
/// ``` /// ```
/// #[derive(Copy)] /// #[derive(Copy)]

View file

@ -277,6 +277,7 @@ impl Ordering {
/// ///
/// assert_eq!(result, Ordering::Less); /// assert_eq!(result, Ordering::Less);
/// ``` /// ```
#[inline]
#[unstable(feature = "ordering_chaining", issue = "37053")] #[unstable(feature = "ordering_chaining", issue = "37053")]
pub fn then(self, other: Ordering) -> Ordering { pub fn then(self, other: Ordering) -> Ordering {
match self { match self {
@ -315,6 +316,7 @@ impl Ordering {
/// ///
/// assert_eq!(result, Ordering::Less); /// assert_eq!(result, Ordering::Less);
/// ``` /// ```
#[inline]
#[unstable(feature = "ordering_chaining", issue = "37053")] #[unstable(feature = "ordering_chaining", issue = "37053")]
pub fn then_with<F: FnOnce() -> Ordering>(self, f: F) -> Ordering { pub fn then_with<F: FnOnce() -> Ordering>(self, f: F) -> Ordering {
match self { match self {

View file

@ -154,14 +154,14 @@ pub trait AsMut<T: ?Sized> {
/// # Generic Impls /// # Generic Impls
/// ///
/// - [`From<T>`][From]` for U` implies `Into<U> for T` /// - [`From<T>`][From]` for U` implies `Into<U> for T`
/// - [`into()`] is reflexive, which means that `Into<T> for T` is implemented /// - [`into`] is reflexive, which means that `Into<T> for T` is implemented
/// ///
/// [`TryInto`]: trait.TryInto.html /// [`TryInto`]: trait.TryInto.html
/// [`Option<T>`]: ../../std/option/enum.Option.html /// [`Option<T>`]: ../../std/option/enum.Option.html
/// [`Result<T, E>`]: ../../std/result/enum.Result.html /// [`Result<T, E>`]: ../../std/result/enum.Result.html
/// [`String`]: ../../std/string/struct.String.html /// [`String`]: ../../std/string/struct.String.html
/// [From]: trait.From.html /// [From]: trait.From.html
/// [`into()`]: trait.Into.html#tymethod.into /// [`into`]: trait.Into.html#tymethod.into
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait Into<T>: Sized { pub trait Into<T>: Sized {
/// Performs the conversion. /// Performs the conversion.
@ -187,14 +187,14 @@ pub trait Into<T>: Sized {
/// # Generic impls /// # Generic impls
/// ///
/// - `From<T> for U` implies [`Into<U>`]` for T` /// - `From<T> for U` implies [`Into<U>`]` for T`
/// - [`from()`] is reflexive, which means that `From<T> for T` is implemented /// - [`from`] is reflexive, which means that `From<T> for T` is implemented
/// ///
/// [`TryFrom`]: trait.TryFrom.html /// [`TryFrom`]: trait.TryFrom.html
/// [`Option<T>`]: ../../std/option/enum.Option.html /// [`Option<T>`]: ../../std/option/enum.Option.html
/// [`Result<T, E>`]: ../../std/result/enum.Result.html /// [`Result<T, E>`]: ../../std/result/enum.Result.html
/// [`String`]: ../../std/string/struct.String.html /// [`String`]: ../../std/string/struct.String.html
/// [`Into<U>`]: trait.Into.html /// [`Into<U>`]: trait.Into.html
/// [`from()`]: trait.From.html#tymethod.from /// [`from`]: trait.From.html#tymethod.from
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait From<T>: Sized { pub trait From<T>: Sized {
/// Performs the conversion. /// Performs the conversion.

View file

@ -16,7 +16,8 @@
//! # Examples //! # Examples
//! //!
//! ```rust //! ```rust
//! use std::hash::{Hash, SipHasher, Hasher}; //! use std::collections::hash_map::DefaultHasher;
//! use std::hash::{Hash, Hasher};
//! //!
//! #[derive(Hash)] //! #[derive(Hash)]
//! struct Person { //! struct Person {
@ -25,13 +26,21 @@
//! phone: u64, //! phone: u64,
//! } //! }
//! //!
//! let person1 = Person { id: 5, name: "Janet".to_string(), phone: 555_666_7777 }; //! let person1 = Person {
//! let person2 = Person { id: 5, name: "Bob".to_string(), phone: 555_666_7777 }; //! id: 5,
//! name: "Janet".to_string(),
//! phone: 555_666_7777,
//! };
//! let person2 = Person {
//! id: 5,
//! name: "Bob".to_string(),
//! phone: 555_666_7777,
//! };
//! //!
//! assert!(hash(&person1) != hash(&person2)); //! assert!(calculate_hash(&person1) != calculate_hash(&person2));
//! //!
//! fn hash<T: Hash>(t: &T) -> u64 { //! fn calculate_hash<T: Hash>(t: &T) -> u64 {
//! let mut s = SipHasher::new(); //! let mut s = DefaultHasher::new();
//! t.hash(&mut s); //! t.hash(&mut s);
//! s.finish() //! s.finish()
//! } //! }
@ -43,11 +52,12 @@
//! [`Hash`]: trait.Hash.html //! [`Hash`]: trait.Hash.html
//! //!
//! ```rust //! ```rust
//! use std::hash::{Hash, Hasher, SipHasher}; //! use std::collections::hash_map::DefaultHasher;
//! use std::hash::{Hash, Hasher};
//! //!
//! struct Person { //! struct Person {
//! id: u32, //! id: u32,
//! # #[allow(dead_code)] //! # #[allow(dead_code)]
//! name: String, //! name: String,
//! phone: u64, //! phone: u64,
//! } //! }
@ -59,13 +69,21 @@
//! } //! }
//! } //! }
//! //!
//! let person1 = Person { id: 5, name: "Janet".to_string(), phone: 555_666_7777 }; //! let person1 = Person {
//! let person2 = Person { id: 5, name: "Bob".to_string(), phone: 555_666_7777 }; //! id: 5,
//! name: "Janet".to_string(),
//! phone: 555_666_7777,
//! };
//! let person2 = Person {
//! id: 5,
//! name: "Bob".to_string(),
//! phone: 555_666_7777,
//! };
//! //!
//! assert_eq!(hash(&person1), hash(&person2)); //! assert_eq!(calculate_hash(&person1), calculate_hash(&person2));
//! //!
//! fn hash<T: Hash>(t: &T) -> u64 { //! fn calculate_hash<T: Hash>(t: &T) -> u64 {
//! let mut s = SipHasher::new(); //! let mut s = DefaultHasher::new();
//! t.hash(&mut s); //! t.hash(&mut s);
//! s.finish() //! s.finish()
//! } //! }
@ -106,7 +124,7 @@ mod sip;
/// ///
/// This trait can be used with `#[derive]` if all fields implement `Hash`. /// This trait can be used with `#[derive]` if all fields implement `Hash`.
/// When `derive`d, the resulting hash will be the combination of the values /// When `derive`d, the resulting hash will be the combination of the values
/// from calling [`.hash()`] on each field. /// from calling [`.hash`] on each field.
/// ///
/// ## How can I implement `Hash`? /// ## How can I implement `Hash`?
/// ///
@ -133,7 +151,7 @@ mod sip;
/// [`Eq`]: ../../std/cmp/trait.Eq.html /// [`Eq`]: ../../std/cmp/trait.Eq.html
/// [`HashMap`]: ../../std/collections/struct.HashMap.html /// [`HashMap`]: ../../std/collections/struct.HashMap.html
/// [`HashSet`]: ../../std/collections/struct.HashSet.html /// [`HashSet`]: ../../std/collections/struct.HashSet.html
/// [`.hash()`]: #tymethod.hash /// [`.hash`]: #tymethod.hash
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait Hash { pub trait Hash {
/// Feeds this value into the state given, updating the hasher as necessary. /// Feeds this value into the state given, updating the hasher as necessary.

View file

@ -140,11 +140,11 @@ pub trait Iterator {
/// Consumes the iterator, counting the number of iterations and returning it. /// Consumes the iterator, counting the number of iterations and returning it.
/// ///
/// This method will evaluate the iterator until its [`next()`] returns /// This method will evaluate the iterator until its [`next`] returns
/// [`None`]. Once [`None`] is encountered, `count()` returns the number of /// [`None`]. Once [`None`] is encountered, `count()` returns the number of
/// times it called [`next()`]. /// times it called [`next`].
/// ///
/// [`next()`]: #tymethod.next /// [`next`]: #tymethod.next
/// [`None`]: ../../std/option/enum.Option.html#variant.None /// [`None`]: ../../std/option/enum.Option.html#variant.None
/// ///
/// # Overflow Behavior /// # Overflow Behavior
@ -323,7 +323,7 @@ pub trait Iterator {
/// ///
/// In other words, it zips two iterators together, into a single one. /// In other words, it zips two iterators together, into a single one.
/// ///
/// When either iterator returns [`None`], all further calls to [`next()`] /// When either iterator returns [`None`], all further calls to [`next`]
/// will return [`None`]. /// will return [`None`].
/// ///
/// # Examples /// # Examples
@ -364,7 +364,7 @@ pub trait Iterator {
/// ///
/// `zip()` is often used to zip an infinite iterator to a finite one. /// `zip()` is often used to zip an infinite iterator to a finite one.
/// This works because the finite iterator will eventually return [`None`], /// This works because the finite iterator will eventually return [`None`],
/// ending the zipper. Zipping with `(0..)` can look a lot like [`enumerate()`]: /// ending the zipper. Zipping with `(0..)` can look a lot like [`enumerate`]:
/// ///
/// ``` /// ```
/// let enumerate: Vec<_> = "foo".chars().enumerate().collect(); /// let enumerate: Vec<_> = "foo".chars().enumerate().collect();
@ -381,8 +381,8 @@ pub trait Iterator {
/// assert_eq!((2, 'o'), zipper[2]); /// assert_eq!((2, 'o'), zipper[2]);
/// ``` /// ```
/// ///
/// [`enumerate()`]: trait.Iterator.html#method.enumerate /// [`enumerate`]: trait.Iterator.html#method.enumerate
/// [`next()`]: ../../std/iter/trait.Iterator.html#tymethod.next /// [`next`]: ../../std/iter/trait.Iterator.html#tymethod.next
/// [`None`]: ../../std/option/enum.Option.html#variant.None /// [`None`]: ../../std/option/enum.Option.html#variant.None
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@ -524,11 +524,11 @@ pub trait Iterator {
/// closure returns [`None`], it will try again, and call the closure on the /// closure returns [`None`], it will try again, and call the closure on the
/// next element, seeing if it will return [`Some`]. /// next element, seeing if it will return [`Some`].
/// ///
/// Why `filter_map()` and not just [`filter()`].[`map()`]? The key is in this /// Why `filter_map()` and not just [`filter()`].[`map`]? The key is in this
/// part: /// part:
/// ///
/// [`filter()`]: #method.filter /// [`filter`]: #method.filter
/// [`map()`]: #method.map /// [`map`]: #method.map
/// ///
/// > If the closure returns [`Some(element)`][`Some`], then that element is returned. /// > If the closure returns [`Some(element)`][`Some`], then that element is returned.
/// ///
@ -550,7 +550,7 @@ pub trait Iterator {
/// assert_eq!(iter.next(), None); /// assert_eq!(iter.next(), None);
/// ``` /// ```
/// ///
/// Here's the same example, but with [`filter()`] and [`map()`]: /// Here's the same example, but with [`filter`] and [`map`]:
/// ///
/// ``` /// ```
/// let a = ["1", "2", "lol"]; /// let a = ["1", "2", "lol"];
@ -585,7 +585,7 @@ pub trait Iterator {
/// iterator. /// iterator.
/// ///
/// `enumerate()` keeps its count as a [`usize`]. If you want to count by a /// `enumerate()` keeps its count as a [`usize`]. If you want to count by a
/// different sized integer, the [`zip()`] function provides similar /// different sized integer, the [`zip`] function provides similar
/// functionality. /// functionality.
/// ///
/// # Overflow Behavior /// # Overflow Behavior
@ -601,7 +601,7 @@ pub trait Iterator {
/// ///
/// [`usize::MAX`]: ../../std/usize/constant.MAX.html /// [`usize::MAX`]: ../../std/usize/constant.MAX.html
/// [`usize`]: ../../std/primitive.usize.html /// [`usize`]: ../../std/primitive.usize.html
/// [`zip()`]: #method.zip /// [`zip`]: #method.zip
/// ///
/// # Examples /// # Examples
/// ///
@ -624,16 +624,16 @@ pub trait Iterator {
/// Creates an iterator which can use `peek` to look at the next element of /// Creates an iterator which can use `peek` to look at the next element of
/// the iterator without consuming it. /// the iterator without consuming it.
/// ///
/// Adds a [`peek()`] method to an iterator. See its documentation for /// Adds a [`peek`] method to an iterator. See its documentation for
/// more information. /// more information.
/// ///
/// Note that the underlying iterator is still advanced when [`peek()`] is /// Note that the underlying iterator is still advanced when [`peek`] is
/// called for the first time: In order to retrieve the next element, /// called for the first time: In order to retrieve the next element,
/// [`next()`] is called on the underlying iterator, hence any side effects of /// [`next`] is called on the underlying iterator, hence any side effects of
/// the [`next()`] method will occur. /// the [`next`] method will occur.
/// ///
/// [`peek()`]: struct.Peekable.html#method.peek /// [`peek`]: struct.Peekable.html#method.peek
/// [`next()`]: ../../std/iter/trait.Iterator.html#tymethod.next /// [`next`]: ../../std/iter/trait.Iterator.html#tymethod.next
/// ///
/// # Examples /// # Examples
/// ///
@ -666,9 +666,9 @@ pub trait Iterator {
Peekable{iter: self, peeked: None} Peekable{iter: self, peeked: None}
} }
/// Creates an iterator that [`skip()`]s elements based on a predicate. /// Creates an iterator that [`skip`]s elements based on a predicate.
/// ///
/// [`skip()`]: #method.skip /// [`skip`]: #method.skip
/// ///
/// `skip_while()` takes a closure as an argument. It will call this /// `skip_while()` takes a closure as an argument. It will call this
/// closure on each element of the iterator, and ignore elements /// closure on each element of the iterator, and ignore elements
@ -863,10 +863,10 @@ pub trait Iterator {
Take{iter: self, n: n} Take{iter: self, n: n}
} }
/// An iterator adaptor similar to [`fold()`] that holds internal state and /// An iterator adaptor similar to [`fold`] that holds internal state and
/// produces a new iterator. /// produces a new iterator.
/// ///
/// [`fold()`]: #method.fold /// [`fold`]: #method.fold
/// ///
/// `scan()` takes two arguments: an initial value which seeds the internal /// `scan()` takes two arguments: an initial value which seeds the internal
/// state, and a closure with two arguments, the first being a mutable /// state, and a closure with two arguments, the first being a mutable
@ -910,16 +910,16 @@ pub trait Iterator {
/// Creates an iterator that works like map, but flattens nested structure. /// Creates an iterator that works like map, but flattens nested structure.
/// ///
/// The [`map()`] adapter is very useful, but only when the closure /// The [`map`] adapter is very useful, but only when the closure
/// argument produces values. If it produces an iterator instead, there's /// argument produces values. If it produces an iterator instead, there's
/// an extra layer of indirection. `flat_map()` will remove this extra layer /// an extra layer of indirection. `flat_map()` will remove this extra layer
/// on its own. /// on its own.
/// ///
/// Another way of thinking about `flat_map()`: [`map()`]'s closure returns /// Another way of thinking about `flat_map()`: [`map`]'s closure returns
/// one item for each element, and `flat_map()`'s closure returns an /// one item for each element, and `flat_map()`'s closure returns an
/// iterator for each element. /// iterator for each element.
/// ///
/// [`map()`]: #method.map /// [`map`]: #method.map
/// ///
/// # Examples /// # Examples
/// ///
@ -1106,7 +1106,7 @@ pub trait Iterator {
/// library, used in a variety of contexts. /// library, used in a variety of contexts.
/// ///
/// The most basic pattern in which `collect()` is used is to turn one /// The most basic pattern in which `collect()` is used is to turn one
/// collection into another. You take a collection, call [`iter()`] on it, /// collection into another. You take a collection, call [`iter`] on it,
/// do a bunch of transformations, and then `collect()` at the end. /// do a bunch of transformations, and then `collect()` at the end.
/// ///
/// One of the keys to `collect()`'s power is that many things you might /// One of the keys to `collect()`'s power is that many things you might
@ -1211,7 +1211,7 @@ pub trait Iterator {
/// assert_eq!(Ok(vec![1, 3]), result); /// assert_eq!(Ok(vec![1, 3]), result);
/// ``` /// ```
/// ///
/// [`iter()`]: ../../std/iter/trait.Iterator.html#tymethod.next /// [`iter`]: ../../std/iter/trait.Iterator.html#tymethod.next
/// [`String`]: ../../std/string/struct.String.html /// [`String`]: ../../std/string/struct.String.html
/// [`char`]: ../../std/primitive.char.html /// [`char`]: ../../std/primitive.char.html
/// [`Result`]: ../../std/result/enum.Result.html /// [`Result`]: ../../std/result/enum.Result.html
@ -1816,9 +1816,9 @@ pub trait Iterator {
/// collections: one from the left elements of the pairs, and one /// collections: one from the left elements of the pairs, and one
/// from the right elements. /// from the right elements.
/// ///
/// This function is, in some sense, the opposite of [`zip()`]. /// This function is, in some sense, the opposite of [`zip`].
/// ///
/// [`zip()`]: #method.zip /// [`zip`]: #method.zip
/// ///
/// # Examples /// # Examples
/// ///
@ -1849,12 +1849,12 @@ pub trait Iterator {
(ts, us) (ts, us)
} }
/// Creates an iterator which [`clone()`]s all of its elements. /// Creates an iterator which [`clone`]s all of its elements.
/// ///
/// This is useful when you have an iterator over `&T`, but you need an /// This is useful when you have an iterator over `&T`, but you need an
/// iterator over `T`. /// iterator over `T`.
/// ///
/// [`clone()`]: ../../std/clone/trait.Clone.html#tymethod.clone /// [`clone`]: ../../std/clone/trait.Clone.html#tymethod.clone
/// ///
/// # Examples /// # Examples
/// ///

View file

@ -48,15 +48,15 @@
//! } //! }
//! ``` //! ```
//! //!
//! An iterator has a method, [`next()`], which when called, returns an //! An iterator has a method, [`next`], which when called, returns an
//! [`Option`]`<Item>`. [`next()`] will return `Some(Item)` as long as there //! [`Option`]`<Item>`. [`next`] will return `Some(Item)` as long as there
//! are elements, and once they've all been exhausted, will return `None` to //! are elements, and once they've all been exhausted, will return `None` to
//! indicate that iteration is finished. Individual iterators may choose to //! indicate that iteration is finished. Individual iterators may choose to
//! resume iteration, and so calling [`next()`] again may or may not eventually //! resume iteration, and so calling [`next`] again may or may not eventually
//! start returning `Some(Item)` again at some point. //! start returning `Some(Item)` again at some point.
//! //!
//! [`Iterator`]'s full definition includes a number of other methods as well, //! [`Iterator`]'s full definition includes a number of other methods as well,
//! but they are default methods, built on top of [`next()`], and so you get //! but they are default methods, built on top of [`next`], and so you get
//! them for free. //! them for free.
//! //!
//! Iterators are also composable, and it's common to chain them together to do //! Iterators are also composable, and it's common to chain them together to do
@ -64,7 +64,7 @@
//! below for more details. //! below for more details.
//! //!
//! [`Iterator`]: trait.Iterator.html //! [`Iterator`]: trait.Iterator.html
//! [`next()`]: trait.Iterator.html#tymethod.next //! [`next`]: trait.Iterator.html#tymethod.next
//! [`Option`]: ../../std/option/enum.Option.html //! [`Option`]: ../../std/option/enum.Option.html
//! //!
//! # The three forms of iteration //! # The three forms of iteration
@ -168,13 +168,13 @@
//! produce an iterator. What gives? //! produce an iterator. What gives?
//! //!
//! There's a trait in the standard library for converting something into an //! There's a trait in the standard library for converting something into an
//! iterator: [`IntoIterator`]. This trait has one method, [`into_iter()`], //! iterator: [`IntoIterator`]. This trait has one method, [`into_iter`],
//! which converts the thing implementing [`IntoIterator`] into an iterator. //! which converts the thing implementing [`IntoIterator`] into an iterator.
//! Let's take a look at that `for` loop again, and what the compiler converts //! Let's take a look at that `for` loop again, and what the compiler converts
//! it into: //! it into:
//! //!
//! [`IntoIterator`]: trait.IntoIterator.html //! [`IntoIterator`]: trait.IntoIterator.html
//! [`into_iter()`]: trait.IntoIterator.html#tymethod.into_iter //! [`into_iter`]: trait.IntoIterator.html#tymethod.into_iter
//! //!
//! ``` //! ```
//! let values = vec![1, 2, 3, 4, 5]; //! let values = vec![1, 2, 3, 4, 5];
@ -202,7 +202,7 @@
//! ``` //! ```
//! //!
//! First, we call `into_iter()` on the value. Then, we match on the iterator //! First, we call `into_iter()` on the value. Then, we match on the iterator
//! that returns, calling [`next()`] over and over until we see a `None`. At //! that returns, calling [`next`] over and over until we see a `None`. At
//! that point, we `break` out of the loop, and we're done iterating. //! that point, we `break` out of the loop, and we're done iterating.
//! //!
//! There's one more subtle bit here: the standard library contains an //! There's one more subtle bit here: the standard library contains an
@ -225,19 +225,19 @@
//! often called 'iterator adapters', as they're a form of the 'adapter //! often called 'iterator adapters', as they're a form of the 'adapter
//! pattern'. //! pattern'.
//! //!
//! Common iterator adapters include [`map()`], [`take()`], and [`filter()`]. //! Common iterator adapters include [`map`], [`take`], and [`filter`].
//! For more, see their documentation. //! For more, see their documentation.
//! //!
//! [`map()`]: trait.Iterator.html#method.map //! [`map`]: trait.Iterator.html#method.map
//! [`take()`]: trait.Iterator.html#method.take //! [`take`]: trait.Iterator.html#method.take
//! [`filter()`]: trait.Iterator.html#method.filter //! [`filter`]: trait.Iterator.html#method.filter
//! //!
//! # Laziness //! # Laziness
//! //!
//! Iterators (and iterator [adapters](#adapters)) are *lazy*. This means that //! Iterators (and iterator [adapters](#adapters)) are *lazy*. This means that
//! just creating an iterator doesn't _do_ a whole lot. Nothing really happens //! just creating an iterator doesn't _do_ a whole lot. Nothing really happens
//! until you call [`next()`]. This is sometimes a source of confusion when //! until you call [`next`]. This is sometimes a source of confusion when
//! creating an iterator solely for its side effects. For example, the [`map()`] //! creating an iterator solely for its side effects. For example, the [`map`]
//! method calls a closure on each element it iterates over: //! method calls a closure on each element it iterates over:
//! //!
//! ``` //! ```
@ -254,7 +254,7 @@
//! do nothing unless consumed //! do nothing unless consumed
//! ``` //! ```
//! //!
//! The idiomatic way to write a [`map()`] for its side effects is to use a //! The idiomatic way to write a [`map`] for its side effects is to use a
//! `for` loop instead: //! `for` loop instead:
//! //!
//! ``` //! ```
@ -265,12 +265,12 @@
//! } //! }
//! ``` //! ```
//! //!
//! [`map()`]: trait.Iterator.html#method.map //! [`map`]: trait.Iterator.html#method.map
//! //!
//! The two most common ways to evaluate an iterator are to use a `for` loop //! The two most common ways to evaluate an iterator are to use a `for` loop
//! like this, or using the [`collect()`] method to produce a new collection. //! like this, or using the [`collect`] method to produce a new collection.
//! //!
//! [`collect()`]: trait.Iterator.html#method.collect //! [`collect`]: trait.Iterator.html#method.collect
//! //!
//! # Infinity //! # Infinity
//! //!
@ -281,7 +281,7 @@
//! let numbers = 0..; //! let numbers = 0..;
//! ``` //! ```
//! //!
//! It is common to use the [`take()`] iterator adapter to turn an infinite //! It is common to use the [`take`] iterator adapter to turn an infinite
//! iterator into a finite one: //! iterator into a finite one:
//! //!
//! ``` //! ```
@ -295,7 +295,7 @@
//! //!
//! This will print the numbers `0` through `4`, each on their own line. //! This will print the numbers `0` through `4`, each on their own line.
//! //!
//! [`take()`]: trait.Iterator.html#method.take //! [`take`]: trait.Iterator.html#method.take
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
@ -338,10 +338,10 @@ mod traits;
/// A double-ended iterator with the direction inverted. /// A double-ended iterator with the direction inverted.
/// ///
/// This `struct` is created by the [`rev()`] method on [`Iterator`]. See its /// This `struct` is created by the [`rev`] method on [`Iterator`]. See its
/// documentation for more. /// documentation for more.
/// ///
/// [`rev()`]: trait.Iterator.html#method.rev /// [`rev`]: trait.Iterator.html#method.rev
/// [`Iterator`]: trait.Iterator.html /// [`Iterator`]: trait.Iterator.html
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
@ -389,10 +389,10 @@ unsafe impl<I> TrustedLen for Rev<I>
/// 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 /// This `struct` is created by the [`cloned`] method on [`Iterator`]. See its
/// documentation for more. /// documentation for more.
/// ///
/// [`cloned()`]: trait.Iterator.html#method.cloned /// [`cloned`]: trait.Iterator.html#method.cloned
/// [`Iterator`]: trait.Iterator.html /// [`Iterator`]: trait.Iterator.html
#[stable(feature = "iter_cloned", since = "1.1.0")] #[stable(feature = "iter_cloned", since = "1.1.0")]
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
@ -469,10 +469,10 @@ unsafe impl<'a, I, T: 'a> TrustedLen for Cloned<I>
/// An iterator that repeats endlessly. /// An iterator that repeats endlessly.
/// ///
/// This `struct` is created by the [`cycle()`] method on [`Iterator`]. See its /// This `struct` is created by the [`cycle`] method on [`Iterator`]. See its
/// documentation for more. /// documentation for more.
/// ///
/// [`cycle()`]: trait.Iterator.html#method.cycle /// [`cycle`]: trait.Iterator.html#method.cycle
/// [`Iterator`]: trait.Iterator.html /// [`Iterator`]: trait.Iterator.html
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
@ -510,10 +510,10 @@ impl<I> FusedIterator for Cycle<I> 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 /// This `struct` is created by the [`chain`] method on [`Iterator`]. See its
/// documentation for more. /// documentation for more.
/// ///
/// [`chain()`]: trait.Iterator.html#method.chain /// [`chain`]: trait.Iterator.html#method.chain
/// [`Iterator`]: trait.Iterator.html /// [`Iterator`]: trait.Iterator.html
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
@ -703,10 +703,10 @@ unsafe impl<A, B> TrustedLen for Chain<A, B>
/// 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 /// This `struct` is created by the [`zip`] method on [`Iterator`]. See its
/// documentation for more. /// documentation for more.
/// ///
/// [`zip()`]: trait.Iterator.html#method.zip /// [`zip`]: trait.Iterator.html#method.zip
/// [`Iterator`]: trait.Iterator.html /// [`Iterator`]: trait.Iterator.html
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
@ -925,16 +925,16 @@ unsafe impl<A, B> TrustedLen for Zip<A, B>
/// 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 /// This `struct` is created by the [`map`] method on [`Iterator`]. See its
/// documentation for more. /// documentation for more.
/// ///
/// [`map()`]: trait.Iterator.html#method.map /// [`map`]: trait.Iterator.html#method.map
/// [`Iterator`]: trait.Iterator.html /// [`Iterator`]: trait.Iterator.html
/// ///
/// # Notes about side effects /// # Notes about side effects
/// ///
/// The [`map()`] iterator implements [`DoubleEndedIterator`], meaning that /// The [`map`] iterator implements [`DoubleEndedIterator`], meaning that
/// you can also [`map()`] backwards: /// you can also [`map`] backwards:
/// ///
/// ```rust /// ```rust
/// let v: Vec<i32> = vec![1, 2, 3].into_iter().map(|x| x + 1).rev().collect(); /// let v: Vec<i32> = vec![1, 2, 3].into_iter().map(|x| x + 1).rev().collect();
@ -1058,10 +1058,10 @@ unsafe impl<B, I, F> TrustedRandomAccess for Map<I, F>
/// 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 /// This `struct` is created by the [`filter`] method on [`Iterator`]. See its
/// documentation for more. /// documentation for more.
/// ///
/// [`filter()`]: trait.Iterator.html#method.filter /// [`filter`]: trait.Iterator.html#method.filter
/// [`Iterator`]: trait.Iterator.html /// [`Iterator`]: trait.Iterator.html
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@ -1142,10 +1142,10 @@ impl<I: FusedIterator, P> FusedIterator for Filter<I, P>
/// 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 /// This `struct` is created by the [`filter_map`] method on [`Iterator`]. See its
/// documentation for more. /// documentation for more.
/// ///
/// [`filter_map()`]: trait.Iterator.html#method.filter_map /// [`filter_map`]: trait.Iterator.html#method.filter_map
/// [`Iterator`]: trait.Iterator.html /// [`Iterator`]: trait.Iterator.html
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@ -1208,10 +1208,10 @@ impl<B, I: FusedIterator, F> FusedIterator for FilterMap<I, F>
/// 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 /// This `struct` is created by the [`enumerate`] method on [`Iterator`]. See its
/// documentation for more. /// documentation for more.
/// ///
/// [`enumerate()`]: trait.Iterator.html#method.enumerate /// [`enumerate`]: trait.Iterator.html#method.enumerate
/// [`Iterator`]: trait.Iterator.html /// [`Iterator`]: trait.Iterator.html
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
@ -1317,10 +1317,10 @@ unsafe impl<I> TrustedLen for Enumerate<I>
/// An iterator with a `peek()` that returns an optional reference to the next /// An iterator with a `peek()` that returns an optional reference to the next
/// element. /// element.
/// ///
/// This `struct` is created by the [`peekable()`] method on [`Iterator`]. See its /// This `struct` is created by the [`peekable`] method on [`Iterator`]. See its
/// documentation for more. /// documentation for more.
/// ///
/// [`peekable()`]: trait.Iterator.html#method.peekable /// [`peekable`]: trait.Iterator.html#method.peekable
/// [`Iterator`]: trait.Iterator.html /// [`Iterator`]: trait.Iterator.html
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
@ -1401,10 +1401,10 @@ impl<I: FusedIterator> FusedIterator for Peekable<I> {}
impl<I: Iterator> Peekable<I> { impl<I: Iterator> Peekable<I> {
/// Returns a reference to the next() value without advancing the iterator. /// Returns a reference to the next() value without advancing the iterator.
/// ///
/// Like [`next()`], if there is a value, it is wrapped in a `Some(T)`. /// Like [`next`], if there is a value, it is wrapped in a `Some(T)`.
/// But if the iteration is over, `None` is returned. /// But if the iteration is over, `None` is returned.
/// ///
/// [`next()`]: trait.Iterator.html#tymethod.next /// [`next`]: trait.Iterator.html#tymethod.next
/// ///
/// Because `peek()` returns a reference, and many iterators iterate over /// Because `peek()` returns a reference, and many iterators iterate over
/// references, there can be a possibly confusing situation where the /// references, there can be a possibly confusing situation where the
@ -1452,10 +1452,10 @@ impl<I: Iterator> Peekable<I> {
/// 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 /// This `struct` is created by the [`skip_while`] method on [`Iterator`]. See its
/// documentation for more. /// documentation for more.
/// ///
/// [`skip_while()`]: trait.Iterator.html#method.skip_while /// [`skip_while`]: trait.Iterator.html#method.skip_while
/// [`Iterator`]: trait.Iterator.html /// [`Iterator`]: trait.Iterator.html
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@ -1506,10 +1506,10 @@ impl<I, P> FusedIterator for SkipWhile<I, P>
/// 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 /// This `struct` is created by the [`take_while`] method on [`Iterator`]. See its
/// documentation for more. /// documentation for more.
/// ///
/// [`take_while()`]: trait.Iterator.html#method.take_while /// [`take_while`]: trait.Iterator.html#method.take_while
/// [`Iterator`]: trait.Iterator.html /// [`Iterator`]: trait.Iterator.html
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@ -1565,10 +1565,10 @@ impl<I, P> FusedIterator for TakeWhile<I, P>
/// An iterator that skips over `n` elements of `iter`. /// An iterator that skips over `n` elements of `iter`.
/// ///
/// This `struct` is created by the [`skip()`] method on [`Iterator`]. See its /// This `struct` is created by the [`skip`] method on [`Iterator`]. See its
/// documentation for more. /// documentation for more.
/// ///
/// [`skip()`]: trait.Iterator.html#method.skip /// [`skip`]: trait.Iterator.html#method.skip
/// [`Iterator`]: trait.Iterator.html /// [`Iterator`]: trait.Iterator.html
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
@ -1659,10 +1659,10 @@ impl<I> FusedIterator for Skip<I> where I: FusedIterator {}
/// An iterator that only iterates over the first `n` iterations of `iter`. /// An iterator that only iterates over the first `n` iterations of `iter`.
/// ///
/// This `struct` is created by the [`take()`] method on [`Iterator`]. See its /// This `struct` is created by the [`take`] method on [`Iterator`]. See its
/// documentation for more. /// documentation for more.
/// ///
/// [`take()`]: trait.Iterator.html#method.take /// [`take`]: trait.Iterator.html#method.take
/// [`Iterator`]: trait.Iterator.html /// [`Iterator`]: trait.Iterator.html
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
@ -1723,10 +1723,10 @@ impl<I> FusedIterator for Take<I> where I: FusedIterator {}
/// 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 /// This `struct` is created by the [`scan`] method on [`Iterator`]. See its
/// documentation for more. /// documentation for more.
/// ///
/// [`scan()`]: trait.Iterator.html#method.scan /// [`scan`]: trait.Iterator.html#method.scan
/// [`Iterator`]: trait.Iterator.html /// [`Iterator`]: trait.Iterator.html
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@ -1773,10 +1773,10 @@ impl<B, I, St, F> FusedIterator for Scan<I, St, F>
/// An iterator that maps each element to an iterator, and yields the elements /// An iterator that maps each element to an iterator, and yields the elements
/// of the produced iterators. /// of the produced iterators.
/// ///
/// This `struct` is created by the [`flat_map()`] method on [`Iterator`]. See its /// This `struct` is created by the [`flat_map`] method on [`Iterator`]. See its
/// documentation for more. /// documentation for more.
/// ///
/// [`flat_map()`]: trait.Iterator.html#method.flat_map /// [`flat_map`]: trait.Iterator.html#method.flat_map
/// [`Iterator`]: trait.Iterator.html /// [`Iterator`]: trait.Iterator.html
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@ -1863,10 +1863,10 @@ impl<I, U, F> FusedIterator for FlatMap<I, U, F>
/// An iterator that yields `None` forever after the underlying iterator /// An iterator that yields `None` forever after the underlying iterator
/// yields `None` once. /// yields `None` once.
/// ///
/// This `struct` is created by the [`fuse()`] method on [`Iterator`]. See its /// This `struct` is created by the [`fuse`] method on [`Iterator`]. See its
/// documentation for more. /// documentation for more.
/// ///
/// [`fuse()`]: trait.Iterator.html#method.fuse /// [`fuse`]: trait.Iterator.html#method.fuse
/// [`Iterator`]: trait.Iterator.html /// [`Iterator`]: trait.Iterator.html
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
@ -2012,10 +2012,10 @@ impl<I> ExactSizeIterator for Fuse<I> where I: ExactSizeIterator {
/// An iterator that calls a function with a reference to each element before /// An iterator that calls a function with a reference to each element before
/// yielding it. /// yielding it.
/// ///
/// This `struct` is created by the [`inspect()`] method on [`Iterator`]. See its /// This `struct` is created by the [`inspect`] method on [`Iterator`]. See its
/// documentation for more. /// documentation for more.
/// ///
/// [`inspect()`]: trait.Iterator.html#method.inspect /// [`inspect`]: trait.Iterator.html#method.inspect
/// [`Iterator`]: trait.Iterator.html /// [`Iterator`]: trait.Iterator.html
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]

View file

@ -16,9 +16,9 @@ use super::{FusedIterator, TrustedLen};
/// 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. /// This `struct` is created by the [`repeat`] function. See its documentation for more.
/// ///
/// [`repeat()`]: fn.repeat.html /// [`repeat`]: fn.repeat.html
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Repeat<A> { pub struct Repeat<A> {
@ -50,9 +50,9 @@ impl<A: Clone> FusedIterator for Repeat<A> {}
/// over and over and 🔁. /// over and over and 🔁.
/// ///
/// Infinite iterators like `repeat()` are often used with adapters like /// Infinite iterators like `repeat()` are often used with adapters like
/// [`take()`], in order to make them finite. /// [`take`], in order to make them finite.
/// ///
/// [`take()`]: trait.Iterator.html#method.take /// [`take`]: trait.Iterator.html#method.take
/// ///
/// # Examples /// # Examples
/// ///
@ -74,7 +74,7 @@ impl<A: Clone> FusedIterator for Repeat<A> {}
/// assert_eq!(Some(4), fours.next()); /// assert_eq!(Some(4), fours.next());
/// ``` /// ```
/// ///
/// Going finite with [`take()`]: /// Going finite with [`take`]:
/// ///
/// ``` /// ```
/// use std::iter; /// use std::iter;
@ -98,9 +98,9 @@ pub fn repeat<T: Clone>(elt: T) -> Repeat<T> {
/// An iterator that yields nothing. /// An iterator that yields nothing.
/// ///
/// This `struct` is created by the [`empty()`] function. See its documentation for more. /// This `struct` is created by the [`empty`] function. See its documentation for more.
/// ///
/// [`empty()`]: fn.empty.html /// [`empty`]: fn.empty.html
#[stable(feature = "iter_empty", since = "1.2.0")] #[stable(feature = "iter_empty", since = "1.2.0")]
pub struct Empty<T>(marker::PhantomData<T>); pub struct Empty<T>(marker::PhantomData<T>);
@ -183,9 +183,9 @@ pub fn empty<T>() -> Empty<T> {
/// An iterator that yields an element exactly once. /// An iterator that yields an element exactly once.
/// ///
/// This `struct` is created by the [`once()`] function. See its documentation for more. /// This `struct` is created by the [`once`] function. See its documentation for more.
/// ///
/// [`once()`]: fn.once.html /// [`once`]: fn.once.html
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
#[stable(feature = "iter_once", since = "1.2.0")] #[stable(feature = "iter_once", since = "1.2.0")]
pub struct Once<T> { pub struct Once<T> {
@ -227,12 +227,12 @@ impl<T> FusedIterator for Once<T> {}
/// Creates an iterator that yields an element exactly once. /// Creates an iterator that yields an element exactly once.
/// ///
/// This is commonly used to adapt a single value into a [`chain()`] of other /// This is commonly used to adapt a single value into a [`chain`] of other
/// kinds of iteration. Maybe you have an iterator that covers almost /// kinds of iteration. Maybe you have an iterator that covers almost
/// everything, but you need an extra special case. Maybe you have a function /// everything, but you need an extra special case. Maybe you have a function
/// which works on iterators, but you only need to process one value. /// which works on iterators, but you only need to process one value.
/// ///
/// [`chain()`]: trait.Iterator.html#method.chain /// [`chain`]: trait.Iterator.html#method.chain
/// ///
/// # Examples /// # Examples
/// ///

View file

@ -16,13 +16,13 @@ use num::Wrapping;
/// created from an iterator. This is common for types which describe a /// created from an iterator. This is common for types which describe a
/// collection of some kind. /// collection of some kind.
/// ///
/// `FromIterator`'s [`from_iter()`] is rarely called explicitly, and is instead /// `FromIterator`'s [`from_iter`] is rarely called explicitly, and is instead
/// used through [`Iterator`]'s [`collect()`] method. See [`collect()`]'s /// used through [`Iterator`]'s [`collect`] method. See [`collect`]'s
/// documentation for more examples. /// documentation for more examples.
/// ///
/// [`from_iter()`]: #tymethod.from_iter /// [`from_iter`]: #tymethod.from_iter
/// [`Iterator`]: trait.Iterator.html /// [`Iterator`]: trait.Iterator.html
/// [`collect()`]: trait.Iterator.html#method.collect /// [`collect`]: trait.Iterator.html#method.collect
/// ///
/// See also: [`IntoIterator`]. /// See also: [`IntoIterator`].
/// ///
@ -42,7 +42,7 @@ use num::Wrapping;
/// assert_eq!(v, vec![5, 5, 5, 5, 5]); /// assert_eq!(v, vec![5, 5, 5, 5, 5]);
/// ``` /// ```
/// ///
/// Using [`collect()`] to implicitly use `FromIterator`: /// Using [`collect`] to implicitly use `FromIterator`:
/// ///
/// ``` /// ```
/// let five_fives = std::iter::repeat(5).take(5); /// let five_fives = std::iter::repeat(5).take(5);
@ -487,17 +487,17 @@ impl<'a, I: DoubleEndedIterator + ?Sized> DoubleEndedIterator for &'a mut I {
/// backwards, a good start is to know where the end is. /// backwards, a good start is to know where the end is.
/// ///
/// When implementing an `ExactSizeIterator`, You must also implement /// When implementing an `ExactSizeIterator`, You must also implement
/// [`Iterator`]. When doing so, the implementation of [`size_hint()`] *must* /// [`Iterator`]. When doing so, the implementation of [`size_hint`] *must*
/// return the exact size of the iterator. /// return the exact size of the iterator.
/// ///
/// [`Iterator`]: trait.Iterator.html /// [`Iterator`]: trait.Iterator.html
/// [`size_hint()`]: trait.Iterator.html#method.size_hint /// [`size_hint`]: trait.Iterator.html#method.size_hint
/// ///
/// The [`len()`] method has a default implementation, so you usually shouldn't /// The [`len`] method has a default implementation, so you usually shouldn't
/// implement it. However, you may be able to provide a more performant /// implement it. However, you may be able to provide a more performant
/// implementation than the default, so overriding it in this case makes sense. /// implementation than the default, so overriding it in this case makes sense.
/// ///
/// [`len()`]: #method.len /// [`len`]: #method.len
/// ///
/// # Examples /// # Examples
/// ///
@ -557,11 +557,11 @@ pub trait ExactSizeIterator: Iterator {
/// implementation, you can do so. See the [trait-level] docs for an /// implementation, you can do so. See the [trait-level] docs for an
/// example. /// example.
/// ///
/// This function has the same safety guarantees as the [`size_hint()`] /// This function has the same safety guarantees as the [`size_hint`]
/// function. /// function.
/// ///
/// [trait-level]: trait.ExactSizeIterator.html /// [trait-level]: trait.ExactSizeIterator.html
/// [`size_hint()`]: trait.Iterator.html#method.size_hint /// [`size_hint`]: trait.Iterator.html#method.size_hint
/// ///
/// # Examples /// # Examples
/// ///
@ -624,14 +624,14 @@ impl<'a, I: ExactSizeIterator + ?Sized> ExactSizeIterator for &'a mut I {
/// Trait to represent types that can be created by summing up an iterator. /// Trait to represent types that can be created by summing up an iterator.
/// ///
/// This trait is used to implement the [`sum()`] method on iterators. Types which /// This trait is used to implement the [`sum`] method on iterators. Types which
/// implement the trait can be generated by the [`sum()`] method. Like /// implement the trait can be generated by the [`sum`] method. Like
/// [`FromIterator`] this trait should rarely be called directly and instead /// [`FromIterator`] this trait should rarely be called directly and instead
/// interacted with through [`Iterator::sum()`]. /// interacted with through [`Iterator::sum`].
/// ///
/// [`sum()`]: ../../std/iter/trait.Sum.html#tymethod.sum /// [`sum`]: ../../std/iter/trait.Sum.html#tymethod.sum
/// [`FromIterator`]: ../../std/iter/trait.FromIterator.html /// [`FromIterator`]: ../../std/iter/trait.FromIterator.html
/// [`Iterator::sum()`]: ../../std/iter/trait.Iterator.html#method.sum /// [`Iterator::sum`]: ../../std/iter/trait.Iterator.html#method.sum
#[stable(feature = "iter_arith_traits", since = "1.12.0")] #[stable(feature = "iter_arith_traits", since = "1.12.0")]
pub trait Sum<A = Self>: Sized { pub trait Sum<A = Self>: Sized {
/// Method which takes an iterator and generates `Self` from the elements by /// Method which takes an iterator and generates `Self` from the elements by
@ -643,14 +643,14 @@ pub trait Sum<A = Self>: Sized {
/// Trait to represent types that can be created by multiplying elements of an /// Trait to represent types that can be created by multiplying elements of an
/// iterator. /// iterator.
/// ///
/// This trait is used to implement the [`product()`] method on iterators. Types /// This trait is used to implement the [`product`] method on iterators. Types
/// which implement the trait can be generated by the [`product()`] method. Like /// which implement the trait can be generated by the [`product`] method. Like
/// [`FromIterator`] this trait should rarely be called directly and instead /// [`FromIterator`] this trait should rarely be called directly and instead
/// interacted with through [`Iterator::product()`]. /// interacted with through [`Iterator::product`].
/// ///
/// [`product()`]: ../../std/iter/trait.Product.html#tymethod.product /// [`product`]: ../../std/iter/trait.Product.html#tymethod.product
/// [`FromIterator`]: ../../std/iter/trait.FromIterator.html /// [`FromIterator`]: ../../std/iter/trait.FromIterator.html
/// [`Iterator::product()`]: ../../std/iter/trait.Iterator.html#method.product /// [`Iterator::product`]: ../../std/iter/trait.Iterator.html#method.product
#[stable(feature = "iter_arith_traits", since = "1.12.0")] #[stable(feature = "iter_arith_traits", since = "1.12.0")]
pub trait Product<A = Self>: Sized { pub trait Product<A = Self>: Sized {
/// Method which takes an iterator and generates `Self` from the elements by /// Method which takes an iterator and generates `Self` from the elements by
@ -823,12 +823,12 @@ impl<T, U, E> Product<Result<U, E>> for Result<T, E>
/// that behave this way because it allows for some significant optimizations. /// that behave this way because it allows for some significant optimizations.
/// ///
/// Note: In general, you should not use `FusedIterator` in generic bounds if /// Note: In general, you should not use `FusedIterator` in generic bounds if
/// you need a fused iterator. Instead, you should just call [`Iterator::fuse()`] /// you need a fused iterator. Instead, you should just call [`Iterator::fuse`]
/// on the iterator. If the iterator is already fused, the additional [`Fuse`] /// on the iterator. If the iterator is already fused, the additional [`Fuse`]
/// wrapper will be a no-op with no performance penalty. /// wrapper will be a no-op with no performance penalty.
/// ///
/// [`None`]: ../../std/option/enum.Option.html#variant.None /// [`None`]: ../../std/option/enum.Option.html#variant.None
/// [`Iterator::fuse()`]: ../../std/iter/trait.Iterator.html#method.fuse /// [`Iterator::fuse`]: ../../std/iter/trait.Iterator.html#method.fuse
/// [`Fuse`]: ../../std/iter/struct.Fuse.html /// [`Fuse`]: ../../std/iter/struct.Fuse.html
#[unstable(feature = "fused", issue = "35602")] #[unstable(feature = "fused", issue = "35602")]
pub trait FusedIterator: Iterator {} pub trait FusedIterator: Iterator {}
@ -848,11 +848,11 @@ impl<'a, I: FusedIterator + ?Sized> FusedIterator for &'a mut I {}
/// # Safety /// # Safety
/// ///
/// This trait must only be implemented when the contract is upheld. /// This trait must only be implemented when the contract is upheld.
/// Consumers of this trait must inspect [`.size_hint()`]s upper bound. /// Consumers of this trait must inspect [`.size_hint`]s upper bound.
/// ///
/// [`None`]: ../../std/option/enum.Option.html#variant.None /// [`None`]: ../../std/option/enum.Option.html#variant.None
/// [`usize::MAX`]: ../../std/usize/constant.MAX.html /// [`usize::MAX`]: ../../std/usize/constant.MAX.html
/// [`.size_hint()`]: ../../std/iter/trait.Iterator.html#method.size_hint /// [`.size_hint`]: ../../std/iter/trait.Iterator.html#method.size_hint
#[unstable(feature = "trusted_len", issue = "37572")] #[unstable(feature = "trusted_len", issue = "37572")]
pub unsafe trait TrustedLen : Iterator {} pub unsafe trait TrustedLen : Iterator {}

View file

@ -90,10 +90,10 @@ macro_rules! assert {
/// On panic, this macro will print the values of the expressions with their /// On panic, this macro will print the values of the expressions with their
/// debug representations. /// debug representations.
/// ///
/// Like [`assert!()`], this macro has a second version, where a custom /// Like [`assert!`], this macro has a second version, where a custom
/// panic message can be provided. /// panic message can be provided.
/// ///
/// [`assert!()`]: macro.assert.html /// [`assert!`]: macro.assert.html
/// ///
/// # Examples /// # Examples
/// ///

View file

@ -245,7 +245,7 @@ pub trait Unsize<T: ?Sized> {
/// [`String`]'s buffer, leading to a double free. /// [`String`]'s buffer, leading to a double free.
/// ///
/// Generalizing the latter case, any type implementing [`Drop`] can't be `Copy`, because it's /// Generalizing the latter case, any type implementing [`Drop`] can't be `Copy`, because it's
/// managing some resource besides its own [`size_of::<T>()`] bytes. /// managing some resource besides its own [`size_of::<T>`] bytes.
/// ///
/// If you try to implement `Copy` on a struct or enum containing non-`Copy` data, you will get /// If you try to implement `Copy` on a struct or enum containing non-`Copy` data, you will get
/// the error [E0204]. /// the error [E0204].
@ -262,7 +262,7 @@ pub trait Unsize<T: ?Sized> {
/// [`Vec<T>`]: ../../std/vec/struct.Vec.html /// [`Vec<T>`]: ../../std/vec/struct.Vec.html
/// [`String`]: ../../std/string/struct.String.html /// [`String`]: ../../std/string/struct.String.html
/// [`Drop`]: ../../std/ops/trait.Drop.html /// [`Drop`]: ../../std/ops/trait.Drop.html
/// [`size_of::<T>()`]: ../../std/mem/fn.size_of.html /// [`size_of::<T>`]: ../../std/mem/fn.size_of.html
/// [`Clone`]: ../clone/trait.Clone.html /// [`Clone`]: ../clone/trait.Clone.html
/// [`String`]: ../../std/string/struct.String.html /// [`String`]: ../../std/string/struct.String.html
/// [`i32`]: ../../std/primitive.i32.html /// [`i32`]: ../../std/primitive.i32.html

View file

@ -617,7 +617,7 @@ pub fn drop<T>(_x: T) { }
/// the contained value. /// the contained value.
/// ///
/// This function will unsafely assume the pointer `src` is valid for /// This function will unsafely assume the pointer `src` is valid for
/// [`size_of::<U>()`][size_of] bytes by transmuting `&T` to `&U` and then reading /// [`size_of::<U>`][size_of] bytes by transmuting `&T` to `&U` and then reading
/// the `&U`. It will also unsafely create a copy of the contained value instead of /// the `&U`. It will also unsafely create a copy of the contained value instead of
/// moving out of `src`. /// moving out of `src`.
/// ///

View file

@ -2390,11 +2390,11 @@ impl usize {
/// A classification of floating point numbers. /// A classification of floating point numbers.
/// ///
/// This `enum` is used as the return type for [`f32::classify()`] and [`f64::classify()`]. See /// This `enum` is used as the return type for [`f32::classify`] and [`f64::classify`]. See
/// their documentation for more. /// their documentation for more.
/// ///
/// [`f32::classify()`]: ../../std/primitive.f32.html#method.classify /// [`f32::classify`]: ../../std/primitive.f32.html#method.classify
/// [`f64::classify()`]: ../../std/primitive.f64.html#method.classify /// [`f64::classify`]: ../../std/primitive.f64.html#method.classify
/// ///
/// # Examples /// # Examples
/// ///
@ -2756,9 +2756,9 @@ fn from_str_radix<T: FromStrRadixHelper>(src: &str, radix: u32) -> Result<T, Par
/// An error which can be returned when parsing an integer. /// An error which can be returned when parsing an integer.
/// ///
/// This error is used as the error type for the `from_str_radix()` functions /// This error is used as the error type for the `from_str_radix()` functions
/// on the primitive integer types, such as [`i8::from_str_radix()`]. /// on the primitive integer types, such as [`i8::from_str_radix`].
/// ///
/// [`i8::from_str_radix()`]: ../../std/primitive.i8.html#method.from_str_radix /// [`i8::from_str_radix`]: ../../std/primitive.i8.html#method.from_str_radix
#[derive(Debug, Clone, PartialEq, Eq)] #[derive(Debug, Clone, PartialEq, Eq)]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct ParseIntError { pub struct ParseIntError {

View file

@ -30,7 +30,7 @@
//! contexts involving built-in types, this is usually not a problem. //! contexts involving built-in types, this is usually not a problem.
//! However, using these operators in generic code, requires some //! However, using these operators in generic code, requires some
//! attention if values have to be reused as opposed to letting the operators //! attention if values have to be reused as opposed to letting the operators
//! consume them. One option is to occasionally use [`clone()`]. //! consume them. One option is to occasionally use [`clone`].
//! Another option is to rely on the types involved providing additional //! Another option is to rely on the types involved providing additional
//! operator implementations for references. For example, for a user-defined //! operator implementations for references. For example, for a user-defined
//! type `T` which is supposed to support addition, it is probably a good //! type `T` which is supposed to support addition, it is probably a good
@ -143,7 +143,7 @@
//! [`FnOnce`]: trait.FnOnce.html //! [`FnOnce`]: trait.FnOnce.html
//! [`Add`]: trait.Add.html //! [`Add`]: trait.Add.html
//! [`Sub`]: trait.Sub.html //! [`Sub`]: trait.Sub.html
//! [`clone()`]: ../clone/trait.Clone.html#tymethod.clone //! [`clone`]: ../clone/trait.Clone.html#tymethod.clone
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
@ -2027,7 +2027,7 @@ impl fmt::Debug for RangeFull {
/// A (half-open) range which is bounded at both ends: { x | start <= x < end }. /// A (half-open) range which is bounded at both ends: { x | start <= x < end }.
/// Use `start..end` (two dots) for its shorthand. /// Use `start..end` (two dots) for its shorthand.
/// ///
/// See the [`contains()`](#method.contains) method for its characterization. /// See the [`contains`](#method.contains) method for its characterization.
/// ///
/// # Examples /// # Examples
/// ///
@ -2085,7 +2085,7 @@ impl<Idx: PartialOrd<Idx>> Range<Idx> {
/// A range which is only bounded below: { x | start <= x }. /// A range which is only bounded below: { x | start <= x }.
/// Use `start..` for its shorthand. /// Use `start..` for its shorthand.
/// ///
/// See the [`contains()`](#method.contains) method for its characterization. /// See the [`contains`](#method.contains) method for its characterization.
/// ///
/// Note: Currently, no overflow checking is done for the iterator /// Note: Currently, no overflow checking is done for the iterator
/// implementation; if you use an integer range and the integer overflows, it /// implementation; if you use an integer range and the integer overflows, it
@ -2141,7 +2141,7 @@ impl<Idx: PartialOrd<Idx>> RangeFrom<Idx> {
/// A range which is only bounded above: { x | x < end }. /// A range which is only bounded above: { x | x < end }.
/// Use `..end` (two dots) for its shorthand. /// Use `..end` (two dots) for its shorthand.
/// ///
/// See the [`contains()`](#method.contains) method for its characterization. /// See the [`contains`](#method.contains) method for its characterization.
/// ///
/// It cannot serve as an iterator because it doesn't have a starting point. /// It cannot serve as an iterator because it doesn't have a starting point.
/// ///
@ -2207,7 +2207,7 @@ impl<Idx: PartialOrd<Idx>> RangeTo<Idx> {
/// An inclusive range which is bounded at both ends: { x | start <= x <= end }. /// An inclusive range which is bounded at both ends: { x | start <= x <= end }.
/// Use `start...end` (three dots) for its shorthand. /// Use `start...end` (three dots) for its shorthand.
/// ///
/// See the [`contains()`](#method.contains) method for its characterization. /// See the [`contains`](#method.contains) method for its characterization.
/// ///
/// # Examples /// # Examples
/// ///
@ -2293,7 +2293,7 @@ impl<Idx: PartialOrd<Idx>> RangeInclusive<Idx> {
/// An inclusive range which is only bounded above: { x | x <= end }. /// An inclusive range which is only bounded above: { x | x <= end }.
/// Use `...end` (three dots) for its shorthand. /// Use `...end` (three dots) for its shorthand.
/// ///
/// See the [`contains()`](#method.contains) method for its characterization. /// See the [`contains`](#method.contains) method for its characterization.
/// ///
/// It cannot serve as an iterator because it doesn't have a starting point. /// It cannot serve as an iterator because it doesn't have a starting point.
/// ///

View file

@ -191,9 +191,8 @@ pub unsafe fn read_unaligned<T>(src: *const T) -> T {
/// allocations or resources, so care must be taken not to overwrite an object /// allocations or resources, so care must be taken not to overwrite an object
/// that should be dropped. /// that should be dropped.
/// ///
/// It does not immediately drop the contents of `src` either; it is rather /// Additionally, it does not drop `src`. Semantically, `src` is moved into the
/// *moved* into the memory location `dst` and will be dropped whenever that /// location pointed to by `dst`.
/// location goes out of scope.
/// ///
/// This is appropriate for initializing uninitialized memory, or overwriting /// This is appropriate for initializing uninitialized memory, or overwriting
/// memory that has previously been `read` from. /// memory that has previously been `read` from.
@ -233,6 +232,9 @@ pub unsafe fn write<T>(dst: *mut T, src: T) {
/// allocations or resources, so care must be taken not to overwrite an object /// allocations or resources, so care must be taken not to overwrite an object
/// that should be dropped. /// that should be dropped.
/// ///
/// Additionally, it does not drop `src`. Semantically, `src` is moved into the
/// location pointed to by `dst`.
///
/// This is appropriate for initializing uninitialized memory, or overwriting /// This is appropriate for initializing uninitialized memory, or overwriting
/// memory that has previously been `read` from. /// memory that has previously been `read` from.
/// ///

View file

@ -10,7 +10,9 @@
//! Slice management and manipulation //! Slice management and manipulation
//! //!
//! For more details `std::slice`. //! For more details see [`std::slice`].
//!
//! [`std::slice`]: ../../std/slice/index.html
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]

View file

@ -28,12 +28,12 @@ pub mod pattern;
/// A trait to abstract the idea of creating a new instance of a type from a /// A trait to abstract the idea of creating a new instance of a type from a
/// string. /// string.
/// ///
/// `FromStr`'s [`from_str()`] method is often used implicitly, through /// `FromStr`'s [`from_str`] method is often used implicitly, through
/// [`str`]'s [`parse()`] method. See [`parse()`]'s documentation for examples. /// [`str`]'s [`parse`] method. See [`parse`]'s documentation for examples.
/// ///
/// [`from_str()`]: #tymethod.from_str /// [`from_str`]: #tymethod.from_str
/// [`str`]: ../../std/primitive.str.html /// [`str`]: ../../std/primitive.str.html
/// [`parse()`]: ../../std/primitive.str.html#method.parse /// [`parse`]: ../../std/primitive.str.html#method.parse
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait FromStr: Sized { pub trait FromStr: Sized {
/// The associated error which can be returned from parsing. /// The associated error which can be returned from parsing.
@ -182,13 +182,13 @@ impl Utf8Error {
/// ///
/// If you are sure that the byte slice is valid UTF-8, and you don't want to /// If you are sure that the byte slice is valid UTF-8, and you don't want to
/// incur the overhead of the validity check, there is an unsafe version of /// incur the overhead of the validity check, there is an unsafe version of
/// this function, [`from_utf8_unchecked()`][fromutf8u], which has the same /// this function, [`from_utf8_unchecked`][fromutf8u], which has the same
/// behavior but skips the check. /// behavior but skips the check.
/// ///
/// [fromutf8u]: fn.from_utf8_unchecked.html /// [fromutf8u]: fn.from_utf8_unchecked.html
/// ///
/// If you need a `String` instead of a `&str`, consider /// If you need a `String` instead of a `&str`, consider
/// [`String::from_utf8()`][string]. /// [`String::from_utf8`][string].
/// ///
/// [string]: ../../std/string/struct.String.html#method.from_utf8 /// [string]: ../../std/string/struct.String.html#method.from_utf8
/// ///
@ -283,7 +283,7 @@ unsafe fn from_raw_parts_mut<'a>(p: *mut u8, len: usize) -> &'a mut str {
/// Converts a slice of bytes to a string slice without checking /// Converts a slice of bytes to a string slice without checking
/// that the string contains valid UTF-8. /// that the string contains valid UTF-8.
/// ///
/// See the safe version, [`from_utf8()`][fromutf8], for more information. /// See the safe version, [`from_utf8`][fromutf8], for more information.
/// ///
/// [fromutf8]: fn.from_utf8.html /// [fromutf8]: fn.from_utf8.html
/// ///
@ -333,9 +333,9 @@ Section: Iterators
/// Iterator for the char (representing *Unicode Scalar Values*) of a string /// Iterator for the char (representing *Unicode Scalar Values*) of a string
/// ///
/// Created with the method [`chars()`]. /// Created with the method [`chars`].
/// ///
/// [`chars()`]: ../../std/primitive.str.html#method.chars /// [`chars`]: ../../std/primitive.str.html#method.chars
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Chars<'a> { pub struct Chars<'a> {
@ -590,9 +590,9 @@ impl<'a> CharIndices<'a> {
/// External iterator for a string's bytes. /// External iterator for a string's bytes.
/// Use with the `std::iter` module. /// Use with the `std::iter` module.
/// ///
/// Created with the method [`bytes()`]. /// Created with the method [`bytes`].
/// ///
/// [`bytes()`]: ../../std/primitive.str.html#method.bytes /// [`bytes`]: ../../std/primitive.str.html#method.bytes
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct Bytes<'a>(Cloned<slice::Iter<'a, u8>>); pub struct Bytes<'a>(Cloned<slice::Iter<'a, u8>>);
@ -925,14 +925,14 @@ impl<'a, P: Pattern<'a>> SplitInternal<'a, P> {
generate_pattern_iterators! { generate_pattern_iterators! {
forward: forward:
/// Created with the method [`split()`]. /// Created with the method [`split`].
/// ///
/// [`split()`]: ../../std/primitive.str.html#method.split /// [`split`]: ../../std/primitive.str.html#method.split
struct Split; struct Split;
reverse: reverse:
/// Created with the method [`rsplit()`]. /// Created with the method [`rsplit`].
/// ///
/// [`rsplit()`]: ../../std/primitive.str.html#method.rsplit /// [`rsplit`]: ../../std/primitive.str.html#method.rsplit
struct RSplit; struct RSplit;
stability: stability:
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@ -943,14 +943,14 @@ generate_pattern_iterators! {
generate_pattern_iterators! { generate_pattern_iterators! {
forward: forward:
/// Created with the method [`split_terminator()`]. /// Created with the method [`split_terminator`].
/// ///
/// [`split_terminator()`]: ../../std/primitive.str.html#method.split_terminator /// [`split_terminator`]: ../../std/primitive.str.html#method.split_terminator
struct SplitTerminator; struct SplitTerminator;
reverse: reverse:
/// Created with the method [`rsplit_terminator()`]. /// Created with the method [`rsplit_terminator`].
/// ///
/// [`rsplit_terminator()`]: ../../std/primitive.str.html#method.rsplit_terminator /// [`rsplit_terminator`]: ../../std/primitive.str.html#method.rsplit_terminator
struct RSplitTerminator; struct RSplitTerminator;
stability: stability:
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@ -1003,14 +1003,14 @@ impl<'a, P: Pattern<'a>> SplitNInternal<'a, P> {
generate_pattern_iterators! { generate_pattern_iterators! {
forward: forward:
/// Created with the method [`splitn()`]. /// Created with the method [`splitn`].
/// ///
/// [`splitn()`]: ../../std/primitive.str.html#method.splitn /// [`splitn`]: ../../std/primitive.str.html#method.splitn
struct SplitN; struct SplitN;
reverse: reverse:
/// Created with the method [`rsplitn()`]. /// Created with the method [`rsplitn`].
/// ///
/// [`rsplitn()`]: ../../std/primitive.str.html#method.rsplitn /// [`rsplitn`]: ../../std/primitive.str.html#method.rsplitn
struct RSplitN; struct RSplitN;
stability: stability:
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@ -1054,14 +1054,14 @@ impl<'a, P: Pattern<'a>> MatchIndicesInternal<'a, P> {
generate_pattern_iterators! { generate_pattern_iterators! {
forward: forward:
/// Created with the method [`match_indices()`]. /// Created with the method [`match_indices`].
/// ///
/// [`match_indices()`]: ../../std/primitive.str.html#method.match_indices /// [`match_indices`]: ../../std/primitive.str.html#method.match_indices
struct MatchIndices; struct MatchIndices;
reverse: reverse:
/// Created with the method [`rmatch_indices()`]. /// Created with the method [`rmatch_indices`].
/// ///
/// [`rmatch_indices()`]: ../../std/primitive.str.html#method.rmatch_indices /// [`rmatch_indices`]: ../../std/primitive.str.html#method.rmatch_indices
struct RMatchIndices; struct RMatchIndices;
stability: stability:
#[stable(feature = "str_match_indices", since = "1.5.0")] #[stable(feature = "str_match_indices", since = "1.5.0")]
@ -1107,14 +1107,14 @@ impl<'a, P: Pattern<'a>> MatchesInternal<'a, P> {
generate_pattern_iterators! { generate_pattern_iterators! {
forward: forward:
/// Created with the method [`matches()`]. /// Created with the method [`matches`].
/// ///
/// [`matches()`]: ../../std/primitive.str.html#method.matches /// [`matches`]: ../../std/primitive.str.html#method.matches
struct Matches; struct Matches;
reverse: reverse:
/// Created with the method [`rmatches()`]. /// Created with the method [`rmatches`].
/// ///
/// [`rmatches()`]: ../../std/primitive.str.html#method.rmatches /// [`rmatches`]: ../../std/primitive.str.html#method.rmatches
struct RMatches; struct RMatches;
stability: stability:
#[stable(feature = "str_matches", since = "1.2.0")] #[stable(feature = "str_matches", since = "1.2.0")]
@ -1123,9 +1123,9 @@ generate_pattern_iterators! {
delegate double ended; delegate double ended;
} }
/// Created with the method [`lines()`]. /// Created with the method [`lines`].
/// ///
/// [`lines()`]: ../../std/primitive.str.html#method.lines /// [`lines`]: ../../std/primitive.str.html#method.lines
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct Lines<'a>(Map<SplitTerminator<'a, char>, LinesAnyMap>); pub struct Lines<'a>(Map<SplitTerminator<'a, char>, LinesAnyMap>);
@ -1156,9 +1156,9 @@ impl<'a> DoubleEndedIterator for Lines<'a> {
#[unstable(feature = "fused", issue = "35602")] #[unstable(feature = "fused", issue = "35602")]
impl<'a> FusedIterator for Lines<'a> {} impl<'a> FusedIterator for Lines<'a> {}
/// Created with the method [`lines_any()`]. /// Created with the method [`lines_any`].
/// ///
/// [`lines_any()`]: ../../std/primitive.str.html#method.lines_any /// [`lines_any`]: ../../std/primitive.str.html#method.lines_any
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[rustc_deprecated(since = "1.4.0", reason = "use lines()/Lines instead now")] #[rustc_deprecated(since = "1.4.0", reason = "use lines()/Lines instead now")]
#[derive(Clone, Debug)] #[derive(Clone, Debug)]

View file

@ -52,14 +52,16 @@ pub fn construct<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
tables: tables, tables: tables,
graph: graph, graph: graph,
fn_exit: fn_exit, fn_exit: fn_exit,
loop_scopes: Vec::new() loop_scopes: Vec::new(),
}; };
body_exit = cfg_builder.expr(&body.value, entry); body_exit = cfg_builder.expr(&body.value, entry);
cfg_builder.add_contained_edge(body_exit, fn_exit); cfg_builder.add_contained_edge(body_exit, fn_exit);
let CFGBuilder {graph, ..} = cfg_builder; let CFGBuilder { graph, .. } = cfg_builder;
CFG {graph: graph, CFG {
entry: entry, graph: graph,
exit: fn_exit} entry: entry,
exit: fn_exit,
}
} }
impl<'a, 'tcx> CFGBuilder<'a, 'tcx> { impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
@ -81,7 +83,8 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
self.add_ast_node(id, &[exit]) self.add_ast_node(id, &[exit])
} }
hir::StmtExpr(ref expr, id) | hir::StmtSemi(ref expr, id) => { hir::StmtExpr(ref expr, id) |
hir::StmtSemi(ref expr, id) => {
let exit = self.expr(&expr, pred); let exit = self.expr(&expr, pred);
self.add_ast_node(id, &[exit]) self.add_ast_node(id, &[exit])
} }
@ -95,9 +98,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
self.pat(&local.pat, init_exit) self.pat(&local.pat, init_exit)
} }
hir::DeclItem(_) => { hir::DeclItem(_) => pred,
pred
}
} }
} }
@ -107,9 +108,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
PatKind::Path(_) | PatKind::Path(_) |
PatKind::Lit(..) | PatKind::Lit(..) |
PatKind::Range(..) | PatKind::Range(..) |
PatKind::Wild => { PatKind::Wild => self.add_ast_node(pat.id, &[pred]),
self.add_ast_node(pat.id, &[pred])
}
PatKind::Box(ref subpat) | PatKind::Box(ref subpat) |
PatKind::Ref(ref subpat, _) | PatKind::Ref(ref subpat, _) |
@ -125,8 +124,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
} }
PatKind::Struct(_, ref subpats, _) => { PatKind::Struct(_, ref subpats, _) => {
let pats_exit = let pats_exit = self.pats_all(subpats.iter().map(|f| &f.node.pat), pred);
self.pats_all(subpats.iter().map(|f| &f.node.pat), pred);
self.add_ast_node(pat.id, &[pats_exit]) self.add_ast_node(pat.id, &[pats_exit])
} }
@ -385,7 +383,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
let method_call = ty::MethodCall::expr(call_expr.id); let method_call = ty::MethodCall::expr(call_expr.id);
let fn_ty = match self.tables.method_map.get(&method_call) { let fn_ty = match self.tables.method_map.get(&method_call) {
Some(method) => method.ty, Some(method) => method.ty,
None => self.tables.expr_ty_adjusted(func_or_rcvr) None => self.tables.expr_ty_adjusted(func_or_rcvr),
}; };
let func_or_rcvr_exit = self.expr(func_or_rcvr, pred); let func_or_rcvr_exit = self.expr(func_or_rcvr, pred);
@ -556,7 +554,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
from_index: CFGIndex, from_index: CFGIndex,
to_loop: LoopScope, to_loop: LoopScope,
to_index: CFGIndex) { to_index: CFGIndex) {
let mut data = CFGEdgeData {exiting_scopes: vec![] }; let mut data = CFGEdgeData { exiting_scopes: vec![] };
let mut scope = self.tcx.region_maps.node_extent(from_expr.id); let mut scope = self.tcx.region_maps.node_extent(from_expr.id);
let target_scope = self.tcx.region_maps.node_extent(to_loop.loop_id); let target_scope = self.tcx.region_maps.node_extent(to_loop.loop_id);
while scope != target_scope { while scope != target_scope {
@ -591,7 +589,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
} }
span_bug!(expr.span, "no loop scope for id {}", loop_id); span_bug!(expr.span, "no loop scope for id {}", loop_id);
} }
Err(err) => span_bug!(expr.span, "loop scope error: {}", err) Err(err) => span_bug!(expr.span, "loop scope error: {}", err),
} }
} }
} }

View file

@ -39,7 +39,7 @@ impl<M: DepTrackingMapConfig> DepTrackingMap<M> {
DepTrackingMap { DepTrackingMap {
phantom: PhantomData, phantom: PhantomData,
graph: graph, graph: graph,
map: FxHashMap() map: FxHashMap(),
} }
} }

View file

@ -29,7 +29,7 @@ pub fn visit_all_item_likes_in_krate<'a, 'tcx, V, F>(tcx: TyCtxt<'a, 'tcx, 'tcx>
struct TrackingVisitor<'visit, 'tcx: 'visit, F: 'visit, V: 'visit> { struct TrackingVisitor<'visit, 'tcx: 'visit, F: 'visit, V: 'visit> {
tcx: TyCtxt<'visit, 'tcx, 'tcx>, tcx: TyCtxt<'visit, 'tcx, 'tcx>,
dep_node_fn: &'visit mut F, dep_node_fn: &'visit mut F,
visitor: &'visit mut V visitor: &'visit mut V,
} }
impl<'visit, 'tcx, F, V> ItemLikeVisitor<'tcx> for TrackingVisitor<'visit, 'tcx, F, V> impl<'visit, 'tcx, F, V> ItemLikeVisitor<'tcx> for TrackingVisitor<'visit, 'tcx, F, V>
@ -70,13 +70,16 @@ pub fn visit_all_item_likes_in_krate<'a, 'tcx, V, F>(tcx: TyCtxt<'a, 'tcx, 'tcx>
let mut tracking_visitor = TrackingVisitor { let mut tracking_visitor = TrackingVisitor {
tcx: tcx, tcx: tcx,
dep_node_fn: &mut dep_node_fn, dep_node_fn: &mut dep_node_fn,
visitor: visitor visitor: visitor,
}; };
krate.visit_all_item_likes(&mut tracking_visitor) krate.visit_all_item_likes(&mut tracking_visitor)
} }
pub fn visit_all_bodies_in_krate<'a, 'tcx, C>(tcx: TyCtxt<'a, 'tcx, 'tcx>, callback: C) pub fn visit_all_bodies_in_krate<'a, 'tcx, C>(tcx: TyCtxt<'a, 'tcx, 'tcx>, callback: C)
where C: Fn(/* body_owner */ DefId, /* body id */ hir::BodyId), where C: Fn(/* body_owner */
DefId,
/* body id */
hir::BodyId)
{ {
let krate = tcx.hir.krate(); let krate = tcx.hir.krate();
for &body_id in &krate.body_ids { for &body_id in &krate.body_ids {

View file

@ -113,13 +113,19 @@ impl<'a, S: Into<MultiSpan>> IntoEarlyLint for (S, &'a str) {
let (span, msg) = self; let (span, msg) = self;
let mut diagnostic = Diagnostic::new(errors::Level::Warning, msg); let mut diagnostic = Diagnostic::new(errors::Level::Warning, msg);
diagnostic.set_span(span); diagnostic.set_span(span);
EarlyLint { id: id, diagnostic: diagnostic } EarlyLint {
id: id,
diagnostic: diagnostic,
}
} }
} }
impl IntoEarlyLint for Diagnostic { impl IntoEarlyLint for Diagnostic {
fn into_early_lint(self, id: LintId) -> EarlyLint { fn into_early_lint(self, id: LintId) -> EarlyLint {
EarlyLint { id: id, diagnostic: self } EarlyLint {
id: id,
diagnostic: self,
}
} }
} }
@ -146,7 +152,7 @@ enum TargetLint {
enum FindLintError { enum FindLintError {
NotFound, NotFound,
Removed Removed,
} }
impl LintStore { impl LintStore {
@ -1127,7 +1133,7 @@ enum CheckLintNameResult {
NoLint, NoLint,
// The lint is either renamed or removed. This is the warning // The lint is either renamed or removed. This is the warning
// message. // message.
Warning(String) Warning(String),
} }
/// Checks the name of a lint for its existence, and whether it was /// Checks the name of a lint for its existence, and whether it was

View file

@ -123,7 +123,7 @@ pub enum LinkagePreference {
pub enum NativeLibraryKind { pub enum NativeLibraryKind {
NativeStatic, // native static library (.a archive) NativeStatic, // native static library (.a archive)
NativeStaticNobundle, // native static library, which doesn't get bundled into .rlibs NativeStaticNobundle, // native static library, which doesn't get bundled into .rlibs
NativeFramework, // OSX-specific NativeFramework, // macOS-specific
NativeUnknown, // default way to specify a dynamic library NativeUnknown, // default way to specify a dynamic library
} }

View file

@ -25,7 +25,10 @@ pub struct VariantInfo {
} }
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
pub enum SizeKind { Exact, Min } pub enum SizeKind {
Exact,
Min,
}
#[derive(Clone, PartialEq, Eq, Hash, Debug)] #[derive(Clone, PartialEq, Eq, Hash, Debug)]
pub struct FieldInfo { pub struct FieldInfo {

View file

@ -971,7 +971,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
always_encode_mir: bool = (false, parse_bool, [TRACKED], always_encode_mir: bool = (false, parse_bool, [TRACKED],
"encode MIR of all functions into the crate metadata"), "encode MIR of all functions into the crate metadata"),
osx_rpath_install_name: bool = (false, parse_bool, [TRACKED], osx_rpath_install_name: bool = (false, parse_bool, [TRACKED],
"pass `-install_name @rpath/...` to the OSX linker"), "pass `-install_name @rpath/...` to the macOS linker"),
sanitizer: Option<Sanitizer> = (None, parse_sanitizer, [TRACKED], sanitizer: Option<Sanitizer> = (None, parse_sanitizer, [TRACKED],
"Use a sanitizer"), "Use a sanitizer"),
} }

View file

@ -37,7 +37,7 @@ pub mod specialization_graph;
pub struct OverlapError { pub struct OverlapError {
pub with_impl: DefId, pub with_impl: DefId,
pub trait_desc: String, pub trait_desc: String,
pub self_desc: Option<String> pub self_desc: Option<String>,
} }
/// Given a subst for the requested impl, translate it to a subst /// Given a subst for the requested impl, translate it to a subst
@ -274,7 +274,7 @@ fn fulfill_implication<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>,
} }
pub struct SpecializesCache { pub struct SpecializesCache {
map: FxHashMap<(DefId, DefId), bool> map: FxHashMap<(DefId, DefId), bool>,
} }
impl SpecializesCache { impl SpecializesCache {

View file

@ -23,7 +23,7 @@ use hir;
#[derive(Clone, Copy, Debug)] #[derive(Clone, Copy, Debug)]
pub struct ExpectedFound<T> { pub struct ExpectedFound<T> {
pub expected: T, pub expected: T,
pub found: T pub found: T,
} }
// Data structures used in type unification // Data structures used in type unification

View file

@ -374,14 +374,13 @@ impl LocalPathBuffer {
fn new(root_mode: RootMode) -> LocalPathBuffer { fn new(root_mode: RootMode) -> LocalPathBuffer {
LocalPathBuffer { LocalPathBuffer {
root_mode: root_mode, root_mode: root_mode,
str: String::new() str: String::new(),
} }
} }
fn into_string(self) -> String { fn into_string(self) -> String {
self.str self.str
} }
} }
impl ItemPathBuffer for LocalPathBuffer { impl ItemPathBuffer for LocalPathBuffer {

View file

@ -85,7 +85,7 @@ impl<'tcx> Value<'tcx> for Ty<'tcx> {
pub struct CycleError<'a> { pub struct CycleError<'a> {
span: Span, span: Span,
cycle: RefMut<'a, [(Span, Query)]> cycle: RefMut<'a, [(Span, Query)]>,
} }
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {

View file

@ -45,7 +45,7 @@ pub struct TypeAndMut<'tcx> {
/// at least as big as the scope `fr.scope`". /// at least as big as the scope `fr.scope`".
pub struct FreeRegion { pub struct FreeRegion {
pub scope: region::CodeExtent, pub scope: region::CodeExtent,
pub bound_region: BoundRegion pub bound_region: BoundRegion,
} }
#[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, #[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash,
@ -65,7 +65,7 @@ pub enum BoundRegion {
// Anonymous region for the implicit env pointer parameter // Anonymous region for the implicit env pointer parameter
// to a closure // to a closure
BrEnv BrEnv,
} }
/// When a region changed from late-bound to early-bound when #32330 /// When a region changed from late-bound to early-bound when #32330
@ -320,7 +320,7 @@ impl<'tcx> Slice<ExistentialPredicate<'tcx>> {
pub fn principal(&self) -> Option<ExistentialTraitRef<'tcx>> { pub fn principal(&self) -> Option<ExistentialTraitRef<'tcx>> {
match self.get(0) { match self.get(0) {
Some(&ExistentialPredicate::Trait(tr)) => Some(tr), Some(&ExistentialPredicate::Trait(tr)) => Some(tr),
_ => None _ => None,
} }
} }
@ -520,13 +520,13 @@ impl<T> Binder<T> {
ty::Binder(&self.0) ty::Binder(&self.0)
} }
pub fn map_bound_ref<F,U>(&self, f: F) -> Binder<U> pub fn map_bound_ref<F, U>(&self, f: F) -> Binder<U>
where F: FnOnce(&T) -> U where F: FnOnce(&T) -> U
{ {
self.as_ref().map_bound(f) self.as_ref().map_bound(f)
} }
pub fn map_bound<F,U>(self, f: F) -> Binder<U> pub fn map_bound<F, U>(self, f: F) -> Binder<U>
where F: FnOnce(T) -> U where F: FnOnce(T) -> U
{ {
ty::Binder(f(self.0)) ty::Binder(f(self.0))
@ -790,22 +790,22 @@ pub struct TyVid {
#[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] #[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
pub struct IntVid { pub struct IntVid {
pub index: u32 pub index: u32,
} }
#[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] #[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
pub struct FloatVid { pub struct FloatVid {
pub index: u32 pub index: u32,
} }
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)] #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)]
pub struct RegionVid { pub struct RegionVid {
pub index: u32 pub index: u32,
} }
#[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] #[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
pub struct SkolemizedRegionVid { pub struct SkolemizedRegionVid {
pub index: u32 pub index: u32,
} }
#[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] #[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
@ -819,7 +819,7 @@ pub enum InferTy {
/// `infer::freshen` for more details. /// `infer::freshen` for more details.
FreshTy(u32), FreshTy(u32),
FreshIntTy(u32), FreshIntTy(u32),
FreshFloatTy(u32) FreshFloatTy(u32),
} }
/// A `ProjectionPredicate` for an `ExistentialTraitRef`. /// A `ProjectionPredicate` for an `ExistentialTraitRef`.
@ -827,7 +827,7 @@ pub enum InferTy {
pub struct ExistentialProjection<'tcx> { pub struct ExistentialProjection<'tcx> {
pub trait_ref: ExistentialTraitRef<'tcx>, pub trait_ref: ExistentialTraitRef<'tcx>,
pub item_name: Name, pub item_name: Name,
pub ty: Ty<'tcx> pub ty: Ty<'tcx>,
} }
pub type PolyExistentialProjection<'tcx> = Binder<ExistentialProjection<'tcx>>; pub type PolyExistentialProjection<'tcx> = Binder<ExistentialProjection<'tcx>>;
@ -860,9 +860,9 @@ impl<'a, 'tcx, 'gcx> ExistentialProjection<'tcx> {
ty::ProjectionPredicate { ty::ProjectionPredicate {
projection_ty: ty::ProjectionTy { projection_ty: ty::ProjectionTy {
trait_ref: self.trait_ref.with_self_ty(tcx, self_ty), trait_ref: self.trait_ref.with_self_ty(tcx, self_ty),
item_name: self.item_name item_name: self.item_name,
}, },
ty: self.ty ty: self.ty,
} }
} }
} }
@ -899,7 +899,7 @@ impl Region {
match *self { match *self {
ty::ReEarlyBound(..) => true, ty::ReEarlyBound(..) => true,
ty::ReLateBound(..) => true, ty::ReLateBound(..) => true,
_ => false _ => false,
} }
} }
@ -969,7 +969,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
pub fn is_nil(&self) -> bool { pub fn is_nil(&self) -> bool {
match self.sty { match self.sty {
TyTuple(ref tys, _) => tys.is_empty(), TyTuple(ref tys, _) => tys.is_empty(),
_ => false _ => false,
} }
} }
@ -1047,7 +1047,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
pub fn is_ty_var(&self) -> bool { pub fn is_ty_var(&self) -> bool {
match self.sty { match self.sty {
TyInfer(TyVar(_)) => true, TyInfer(TyVar(_)) => true,
_ => false _ => false,
} }
} }
@ -1071,7 +1071,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
pub fn is_self(&self) -> bool { pub fn is_self(&self) -> bool {
match self.sty { match self.sty {
TyParam(ref p) => p.is_self(), TyParam(ref p) => p.is_self(),
_ => false _ => false,
} }
} }
@ -1088,7 +1088,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
pub fn is_structural(&self) -> bool { pub fn is_structural(&self) -> bool {
match self.sty { match self.sty {
TyAdt(..) | TyTuple(..) | TyArray(..) | TyClosure(..) => true, TyAdt(..) | TyTuple(..) | TyArray(..) | TyClosure(..) => true,
_ => self.is_slice() | self.is_trait() _ => self.is_slice() | self.is_trait(),
} }
} }
@ -1096,7 +1096,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
pub fn is_simd(&self) -> bool { pub fn is_simd(&self) -> bool {
match self.sty { match self.sty {
TyAdt(def, _) => def.repr.simd, TyAdt(def, _) => def.repr.simd,
_ => false _ => false,
} }
} }
@ -1127,7 +1127,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
pub fn is_region_ptr(&self) -> bool { pub fn is_region_ptr(&self) -> bool {
match self.sty { match self.sty {
TyRef(..) => true, TyRef(..) => true,
_ => false _ => false,
} }
} }
@ -1145,7 +1145,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
pub fn is_unsafe_ptr(&self) -> bool { pub fn is_unsafe_ptr(&self) -> bool {
match self.sty { match self.sty {
TyRawPtr(_) => return true, TyRawPtr(_) => return true,
_ => return false _ => return false,
} }
} }
@ -1189,7 +1189,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
pub fn is_trait(&self) -> bool { pub fn is_trait(&self) -> bool {
match self.sty { match self.sty {
TyDynamic(..) => true, TyDynamic(..) => true,
_ => false _ => false,
} }
} }
@ -1205,7 +1205,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
TyInfer(FreshTy(_)) => true, TyInfer(FreshTy(_)) => true,
TyInfer(FreshIntTy(_)) => true, TyInfer(FreshIntTy(_)) => true,
TyInfer(FreshFloatTy(_)) => true, TyInfer(FreshFloatTy(_)) => true,
_ => false _ => false,
} }
} }
@ -1219,7 +1219,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
pub fn is_char(&self) -> bool { pub fn is_char(&self) -> bool {
match self.sty { match self.sty {
TyChar => true, TyChar => true,
_ => false _ => false,
} }
} }
@ -1237,7 +1237,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
pub fn is_signed(&self) -> bool { pub fn is_signed(&self) -> bool {
match self.sty { match self.sty {
TyInt(_) => true, TyInt(_) => true,
_ => false _ => false,
} }
} }
@ -1245,7 +1245,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
match self.sty { match self.sty {
TyInt(ast::IntTy::Is) | TyUint(ast::UintTy::Us) => false, TyInt(ast::IntTy::Is) | TyUint(ast::UintTy::Us) => false,
TyInt(..) | TyUint(..) | TyFloat(..) => true, TyInt(..) | TyUint(..) | TyFloat(..) => true,
_ => false _ => false,
} }
} }
@ -1276,7 +1276,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
}, },
TyRef(_, mt) => Some(mt), TyRef(_, mt) => Some(mt),
TyRawPtr(mt) if explicit => Some(mt), TyRawPtr(mt) if explicit => Some(mt),
_ => None _ => None,
} }
} }
@ -1284,7 +1284,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
pub fn builtin_index(&self) -> Option<Ty<'tcx>> { pub fn builtin_index(&self) -> Option<Ty<'tcx>> {
match self.sty { match self.sty {
TyArray(ty, _) | TySlice(ty) => Some(ty), TyArray(ty, _) | TySlice(ty) => Some(ty),
_ => None _ => None,
} }
} }
@ -1307,7 +1307,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
pub fn is_fn(&self) -> bool { pub fn is_fn(&self) -> bool {
match self.sty { match self.sty {
TyFnDef(..) | TyFnPtr(_) => true, TyFnDef(..) | TyFnPtr(_) => true,
_ => false _ => false,
} }
} }
@ -1316,14 +1316,14 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
TyDynamic(ref tt, ..) => tt.principal().map(|p| p.def_id()), TyDynamic(ref tt, ..) => tt.principal().map(|p| p.def_id()),
TyAdt(def, _) => Some(def.did), TyAdt(def, _) => Some(def.did),
TyClosure(id, _) => Some(id), TyClosure(id, _) => Some(id),
_ => None _ => None,
} }
} }
pub fn ty_adt_def(&self) -> Option<&'tcx AdtDef> { pub fn ty_adt_def(&self) -> Option<&'tcx AdtDef> {
match self.sty { match self.sty {
TyAdt(adt, _) => Some(adt), TyAdt(adt, _) => Some(adt),
_ => None _ => None,
} }
} }

View file

@ -16,7 +16,7 @@ use infer::InferCtxt;
use hir::map as hir_map; use hir::map as hir_map;
use traits::{self, Reveal}; use traits::{self, Reveal};
use ty::{self, Ty, TyCtxt, TypeAndMut, TypeFlags, TypeFoldable}; use ty::{self, Ty, TyCtxt, TypeAndMut, TypeFlags, TypeFoldable};
use ty::{ParameterEnvironment}; use ty::ParameterEnvironment;
use ty::fold::TypeVisitor; use ty::fold::TypeVisitor;
use ty::layout::{Layout, LayoutError}; use ty::layout::{Layout, LayoutError};
use ty::TypeVariants::*; use ty::TypeVariants::*;
@ -39,13 +39,13 @@ use hir;
type Disr = ConstInt; type Disr = ConstInt;
pub trait IntTypeExt { pub trait IntTypeExt {
fn to_ty<'a, 'gcx, 'tcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx>; fn to_ty<'a, 'gcx, 'tcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx>;
fn disr_incr<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, val: Option<Disr>) fn disr_incr<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, val: Option<Disr>)
-> Option<Disr>; -> Option<Disr>;
fn assert_ty_matches(&self, val: Disr); fn assert_ty_matches(&self, val: Disr);
fn initial_discriminant<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Disr; fn initial_discriminant<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Disr;
} }
macro_rules! typed_literal { macro_rules! typed_literal {
@ -133,7 +133,7 @@ impl IntTypeExt for attr::IntType {
pub enum CopyImplementationError<'tcx> { pub enum CopyImplementationError<'tcx> {
InfrigingField(&'tcx ty::FieldDef), InfrigingField(&'tcx ty::FieldDef),
NotAnAdt, NotAnAdt,
HasDestructor HasDestructor,
} }
/// Describes whether a type is representable. For types that are not /// Describes whether a type is representable. For types that are not
@ -159,14 +159,14 @@ impl<'tcx> ParameterEnvironment<'tcx> {
tcx.infer_ctxt(self.clone(), Reveal::UserFacing).enter(|infcx| { tcx.infer_ctxt(self.clone(), Reveal::UserFacing).enter(|infcx| {
let (adt, substs) = match self_type.sty { let (adt, substs) = match self_type.sty {
ty::TyAdt(adt, substs) => (adt, substs), ty::TyAdt(adt, substs) => (adt, substs),
_ => return Err(CopyImplementationError::NotAnAdt) _ => return Err(CopyImplementationError::NotAnAdt),
}; };
let field_implements_copy = |field: &ty::FieldDef| { let field_implements_copy = |field: &ty::FieldDef| {
let cause = traits::ObligationCause::dummy(); let cause = traits::ObligationCause::dummy();
match traits::fully_normalize(&infcx, cause, &field.ty(tcx, substs)) { match traits::fully_normalize(&infcx, cause, &field.ty(tcx, substs)) {
Ok(ty) => !infcx.type_moves_by_default(ty, span), Ok(ty) => !infcx.type_moves_by_default(ty, span),
Err(..) => false Err(..) => false,
} }
}; };
@ -198,7 +198,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
} }
} }
} }
_ => () _ => (),
} }
false false
} }
@ -218,7 +218,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
adt.variants[0].fields.get(i).map(|f| f.ty(self, substs)) adt.variants[0].fields.get(i).map(|f| f.ty(self, substs))
} }
(&TyTuple(ref v, _), None) => v.get(i).cloned(), (&TyTuple(ref v, _), None) => v.get(i).cloned(),
_ => None _ => None,
} }
} }
@ -245,11 +245,11 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
pub fn struct_tail(self, mut ty: Ty<'tcx>) -> Ty<'tcx> { pub fn struct_tail(self, mut ty: Ty<'tcx>) -> Ty<'tcx> {
while let TyAdt(def, substs) = ty.sty { while let TyAdt(def, substs) = ty.sty {
if !def.is_struct() { if !def.is_struct() {
break break;
} }
match def.struct_variant().fields.last() { match def.struct_variant().fields.last() {
Some(f) => ty = f.ty(self, substs), Some(f) => ty = f.ty(self, substs),
None => break None => break,
} }
} }
ty ty
@ -267,14 +267,14 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
let (mut a, mut b) = (source, target); let (mut a, mut b) = (source, target);
while let (&TyAdt(a_def, a_substs), &TyAdt(b_def, b_substs)) = (&a.sty, &b.sty) { while let (&TyAdt(a_def, a_substs), &TyAdt(b_def, b_substs)) = (&a.sty, &b.sty) {
if a_def != b_def || !a_def.is_struct() { if a_def != b_def || !a_def.is_struct() {
break break;
} }
match a_def.struct_variant().fields.last() { match a_def.struct_variant().fields.last() {
Some(f) => { Some(f) => {
a = f.ty(self, a_substs); a = f.ty(self, a_substs);
b = f.ty(self, b_substs); b = f.ty(self, b_substs);
} }
_ => break _ => break,
} }
} }
(a, b) (a, b)
@ -373,7 +373,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
let dtor_did = match dtor_did { let dtor_did = match dtor_did {
Some(dtor) => dtor, Some(dtor) => dtor,
None => return None None => return None,
}; };
// RFC 1238: if the destructor method is tagged with the // RFC 1238: if the destructor method is tagged with the
@ -725,9 +725,7 @@ impl<'a, 'tcx> ty::TyS<'tcx> {
substs_a.types().zip(substs_b.types()).all(|(a, b)| same_type(a, b)) substs_a.types().zip(substs_b.types()).all(|(a, b)| same_type(a, b))
} }
_ => { _ => a == b,
a == b
}
} }
} }

View file

@ -94,7 +94,7 @@ pub fn to_readable_str(mut val: usize) -> String {
if val == 0 { if val == 0 {
groups.push(format!("{}", group)); groups.push(format!("{}", group));
break break;
} else { } else {
groups.push(format!("{:03}", group)); groups.push(format!("{:03}", group));
} }
@ -142,7 +142,8 @@ fn get_resident() -> Option<usize> {
type HANDLE = *mut u8; type HANDLE = *mut u8;
use libc::size_t; use libc::size_t;
use std::mem; use std::mem;
#[repr(C)] #[allow(non_snake_case)] #[repr(C)]
#[allow(non_snake_case)]
struct PROCESS_MEMORY_COUNTERS { struct PROCESS_MEMORY_COUNTERS {
cb: DWORD, cb: DWORD,
PageFaultCount: DWORD, PageFaultCount: DWORD,
@ -184,7 +185,7 @@ pub fn indent<R, F>(op: F) -> R where
} }
pub struct Indenter { pub struct Indenter {
_cannot_construct_outside_of_this_module: () _cannot_construct_outside_of_this_module: (),
} }
impl Drop for Indenter { impl Drop for Indenter {

View file

@ -116,7 +116,7 @@ pub fn create_dir_racy(path: &Path) -> io::Result<()> {
match fs::create_dir(path) { match fs::create_dir(path) {
Ok(()) => return Ok(()), Ok(()) => return Ok(()),
Err(ref e) if e.kind() == io::ErrorKind::AlreadyExists => return Ok(()), Err(ref e) if e.kind() == io::ErrorKind::AlreadyExists => return Ok(()),
Err(ref e) if e.kind() == io::ErrorKind::NotFound => {} Err(ref e) if e.kind() == io::ErrorKind::NotFound => (),
Err(e) => return Err(e), Err(e) => return Err(e),
} }
match path.parent() { match path.parent() {

View file

@ -13,12 +13,12 @@ use std::env;
use target::TargetOptions; use target::TargetOptions;
pub fn opts() -> TargetOptions { pub fn opts() -> TargetOptions {
// ELF TLS is only available in OSX 10.7+. If you try to compile for 10.6 // ELF TLS is only available in macOS 10.7+. If you try to compile for 10.6
// either the linker will complain if it is used or the binary will end up // either the linker will complain if it is used or the binary will end up
// segfaulting at runtime when run on 10.6. Rust by default supports OSX // segfaulting at runtime when run on 10.6. Rust by default supports macOS
// 10.7+, but there is a standard environment variable, // 10.7+, but there is a standard environment variable,
// MACOSX_DEPLOYMENT_TARGET, which is used to signal targeting older // MACOSX_DEPLOYMENT_TARGET, which is used to signal targeting older
// versions of OSX. For example compiling on 10.10 with // versions of macOS. For example compiling on 10.10 with
// MACOSX_DEPLOYMENT_TARGET set to 10.6 will cause the linker to generate // MACOSX_DEPLOYMENT_TARGET set to 10.6 will cause the linker to generate
// warnings about the usage of ELF TLS. // warnings about the usage of ELF TLS.
// //
@ -33,7 +33,7 @@ pub fn opts() -> TargetOptions {
}).unwrap_or((10, 7)); }).unwrap_or((10, 7));
TargetOptions { TargetOptions {
// OSX has -dead_strip, which doesn't rely on function_sections // macOS has -dead_strip, which doesn't rely on function_sections
function_sections: false, function_sections: false,
dynamic_linking: true, dynamic_linking: true,
executables: true, executables: true,

View file

@ -318,8 +318,8 @@ pub struct TargetOptions {
/// Whether the target toolchain is like OpenBSD's. /// Whether the target toolchain is like OpenBSD's.
/// Only useful for compiling against OpenBSD, for configuring abi when returning a struct. /// Only useful for compiling against OpenBSD, for configuring abi when returning a struct.
pub is_like_openbsd: bool, pub is_like_openbsd: bool,
/// Whether the target toolchain is like OSX's. Only useful for compiling against iOS/OS X, in /// Whether the target toolchain is like macOS's. Only useful for compiling against iOS/macOS,
/// particular running dsymutil and some other stuff like `-dead_strip`. Defaults to false. /// in particular running dsymutil and some other stuff like `-dead_strip`. Defaults to false.
pub is_like_osx: bool, pub is_like_osx: bool,
/// Whether the target toolchain is like Solaris's. /// Whether the target toolchain is like Solaris's.
/// Only useful for compiling against Illumos/Solaris, /// Only useful for compiling against Illumos/Solaris,

View file

@ -99,7 +99,7 @@ fn register_native_lib(sess: &Session,
} }
let is_osx = sess.target.target.options.is_like_osx; let is_osx = sess.target.target.options.is_like_osx;
if lib.kind == cstore::NativeFramework && !is_osx { if lib.kind == cstore::NativeFramework && !is_osx {
let msg = "native frameworks are only available on OSX targets"; let msg = "native frameworks are only available on macOS targets";
match span { match span {
Some(span) => span_err!(sess, span, E0455, "{}", msg), Some(span) => span_err!(sess, span, E0455, "{}", msg),
None => sess.err(msg), None => sess.err(msg),

View file

@ -27,7 +27,7 @@ name. Example:
"##, "##,
E0455: r##" E0455: r##"
Linking with `kind=framework` is only supported when targeting OS X, Linking with `kind=framework` is only supported when targeting macOS,
as frameworks are specific to that operating system. as frameworks are specific to that operating system.
Erroneous code example: Erroneous code example:

View file

@ -1404,7 +1404,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
// //
// And here we run into yet another obscure archive bug: in which metadata // And here we run into yet another obscure archive bug: in which metadata
// loaded from archives may have trailing garbage bytes. Awhile back one of // loaded from archives may have trailing garbage bytes. Awhile back one of
// our tests was failing sporadically on the OSX 64-bit builders (both nopt // our tests was failing sporadically on the macOS 64-bit builders (both nopt
// and opt) by having ebml generate an out-of-bounds panic when looking at // and opt) by having ebml generate an out-of-bounds panic when looking at
// metadata. // metadata.
// //

View file

@ -583,7 +583,7 @@ fn link_rlib<'a>(sess: &'a Session,
} }
// After adding all files to the archive, we need to update the // After adding all files to the archive, we need to update the
// symbol table of the archive. This currently dies on OSX (see // symbol table of the archive. This currently dies on macOS (see
// #11162), and isn't necessary there anyway // #11162), and isn't necessary there anyway
if !sess.target.target.options.is_like_osx { if !sess.target.target.options.is_like_osx {
ab.update_symbols(); ab.update_symbols();
@ -764,7 +764,7 @@ fn link_natively(sess: &Session,
// pain to land PRs when they spuriously fail due to a segfault. // pain to land PRs when they spuriously fail due to a segfault.
// //
// The issue #38878 has some more debugging information on it as well, but // The issue #38878 has some more debugging information on it as well, but
// this unfortunately looks like it's just a race condition in OSX's linker // this unfortunately looks like it's just a race condition in macOS's linker
// with some thread pool working in the background. It seems that no one // with some thread pool working in the background. It seems that no one
// currently knows a fix for this so in the meantime we're left with this... // currently knows a fix for this so in the meantime we're left with this...
info!("{:?}", &cmd); info!("{:?}", &cmd);
@ -841,7 +841,7 @@ fn link_natively(sess: &Session,
} }
// On OSX, debuggers need this utility to get run to do some munging of // On macOS, debuggers need this utility to get run to do some munging of
// the symbols // the symbols
if sess.target.target.options.is_like_osx && sess.opts.debuginfo != NoDebugInfo { if sess.target.target.options.is_like_osx && sess.opts.debuginfo != NoDebugInfo {
match Command::new("dsymutil").arg(out_filename).output() { match Command::new("dsymutil").arg(out_filename).output() {

View file

@ -139,7 +139,7 @@ impl<'a> Linker for GnuLinker<'a> {
.arg("-l").arg(lib) .arg("-l").arg(lib)
.arg("-Wl,--no-whole-archive"); .arg("-Wl,--no-whole-archive");
} else { } else {
// -force_load is the OSX equivalent of --whole-archive, but it // -force_load is the macOS equivalent of --whole-archive, but it
// involves passing the full path to the library to link. // involves passing the full path to the library to link.
let mut v = OsString::from("-Wl,-force_load,"); let mut v = OsString::from("-Wl,-force_load,");
v.push(&archive::find_library(lib, search_path, &self.sess)); v.push(&archive::find_library(lib, search_path, &self.sess));

View file

@ -351,7 +351,7 @@ fn mangle<PI: Iterator<Item=InternedString>>(path: PI, hash: &str) -> String {
// Follow C++ namespace-mangling style, see // Follow C++ namespace-mangling style, see
// http://en.wikipedia.org/wiki/Name_mangling for more info. // http://en.wikipedia.org/wiki/Name_mangling for more info.
// //
// It turns out that on OSX you can actually have arbitrary symbols in // It turns out that on macOS you can actually have arbitrary symbols in
// function names (at least when given to LLVM), but this is not possible // function names (at least when given to LLVM), but this is not possible
// when using unix's linker. Perhaps one day when we just use a linker from LLVM // when using unix's linker. Perhaps one day when we just use a linker from LLVM
// we won't need to do this name mangling. The problem with name mangling is // we won't need to do this name mangling. The problem with name mangling is

View file

@ -164,9 +164,9 @@ pub fn finalize(cx: &CrateContext) {
llvm::LLVMRustDIBuilderFinalize(DIB(cx)); llvm::LLVMRustDIBuilderFinalize(DIB(cx));
llvm::LLVMRustDIBuilderDispose(DIB(cx)); llvm::LLVMRustDIBuilderDispose(DIB(cx));
// Debuginfo generation in LLVM by default uses a higher // Debuginfo generation in LLVM by default uses a higher
// version of dwarf than OS X currently understands. We can // version of dwarf than macOS currently understands. We can
// instruct LLVM to emit an older version of dwarf, however, // instruct LLVM to emit an older version of dwarf, however,
// for OS X to understand. For more info see #11352 // for macOS to understand. For more info see #11352
// This can be overridden using --llvm-opts -dwarf-version,N. // This can be overridden using --llvm-opts -dwarf-version,N.
// Android has the same issue (#22398) // Android has the same issue (#22398)
if cx.sess().target.target.options.is_like_osx || if cx.sess().target.target.options.is_like_osx ||

View file

@ -167,7 +167,7 @@ nav.sub {
position: absolute; position: absolute;
left: 0; left: 0;
top: 0; top: 0;
min-height: 100vh; min-height: 100%;
} }
.sidebar .current { .sidebar .current {

View file

@ -42,7 +42,7 @@ impl PluginManager {
/// Load a plugin with the given name. /// Load a plugin with the given name.
/// ///
/// Turns `name` into the proper dynamic library filename for the given /// Turns `name` into the proper dynamic library filename for the given
/// platform. On windows, it turns into name.dll, on OS X, name.dylib, and /// platform. On windows, it turns into name.dll, on macOS, name.dylib, and
/// elsewhere, libname.so. /// elsewhere, libname.so.
pub fn load_plugin(&mut self, name: String) { pub fn load_plugin(&mut self, name: String) {
let x = self.prefix.join(libname(name)); let x = self.prefix.join(libname(name));

View file

@ -188,6 +188,16 @@ impl OsString {
/// in the given `OsString`. /// in the given `OsString`.
/// ///
/// The collection may reserve more space to avoid frequent reallocations. /// The collection may reserve more space to avoid frequent reallocations.
///
/// # Examples
///
/// ```
/// use std::ffi::OsString;
///
/// let mut s = OsString::new();
/// s.reserve(10);
/// assert!(s.capacity() >= 10);
/// ```
#[stable(feature = "osstring_simple_functions", since = "1.9.0")] #[stable(feature = "osstring_simple_functions", since = "1.9.0")]
pub fn reserve(&mut self, additional: usize) { pub fn reserve(&mut self, additional: usize) {
self.inner.reserve(additional) self.inner.reserve(additional)
@ -200,18 +210,56 @@ impl OsString {
/// Note that the allocator may give the collection more space than it /// Note that the allocator may give the collection more space than it
/// requests. Therefore capacity can not be relied upon to be precisely /// requests. Therefore capacity can not be relied upon to be precisely
/// minimal. Prefer reserve if future insertions are expected. /// minimal. Prefer reserve if future insertions are expected.
///
/// # Examples
///
/// ```
/// use std::ffi::OsString;
///
/// let mut s = OsString::new();
/// s.reserve_exact(10);
/// assert!(s.capacity() >= 10);
/// ```
#[stable(feature = "osstring_simple_functions", since = "1.9.0")] #[stable(feature = "osstring_simple_functions", since = "1.9.0")]
pub fn reserve_exact(&mut self, additional: usize) { pub fn reserve_exact(&mut self, additional: usize) {
self.inner.reserve_exact(additional) self.inner.reserve_exact(additional)
} }
/// Shrinks the capacity of the `OsString` to match its length. /// Shrinks the capacity of the `OsString` to match its length.
///
/// # Examples
///
/// ```
/// #![feature(osstring_shrink_to_fit)]
///
/// use std::ffi::OsString;
///
/// let mut s = OsString::from("foo");
///
/// s.reserve(100);
/// assert!(s.capacity() >= 100);
///
/// s.shrink_to_fit();
/// assert_eq!(3, s.capacity());
/// ```
#[unstable(feature = "osstring_shrink_to_fit", issue = "40421")] #[unstable(feature = "osstring_shrink_to_fit", issue = "40421")]
pub fn shrink_to_fit(&mut self) { pub fn shrink_to_fit(&mut self) {
self.inner.shrink_to_fit() self.inner.shrink_to_fit()
} }
/// Converts this `OsString` into a boxed `OsStr`. /// Converts this `OsString` into a boxed `OsStr`.
///
/// # Examples
///
/// ```
/// #![feature(into_boxed_os_str)]
///
/// use std::ffi::{OsString, OsStr};
///
/// let s = OsString::from("hello");
///
/// let b: Box<OsStr> = s.into_boxed_os_str();
/// ```
#[unstable(feature = "into_boxed_os_str", issue = "40380")] #[unstable(feature = "into_boxed_os_str", issue = "40380")]
pub fn into_boxed_os_str(self) -> Box<OsStr> { pub fn into_boxed_os_str(self) -> Box<OsStr> {
unsafe { mem::transmute(self.inner.into_box()) } unsafe { mem::transmute(self.inner.into_box()) }
@ -398,6 +446,16 @@ impl OsStr {
/// Copies the slice into an owned [`OsString`]. /// Copies the slice into an owned [`OsString`].
/// ///
/// [`OsString`]: struct.OsString.html /// [`OsString`]: struct.OsString.html
///
/// # Examples
///
/// ```
/// use std::ffi::{OsStr, OsString};
///
/// let os_str = OsStr::new("foo");
/// let os_string = os_str.to_os_string();
/// assert_eq!(os_string, OsString::from("foo"));
/// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn to_os_string(&self) -> OsString { pub fn to_os_string(&self) -> OsString {
OsString { inner: self.inner.to_owned() } OsString { inner: self.inner.to_owned() }

View file

@ -142,14 +142,14 @@ pub struct DirEntry(fs_imp::DirEntry);
/// [`File::open`]: struct.File.html#method.open /// [`File::open`]: struct.File.html#method.open
/// [`File::create`]: struct.File.html#method.create /// [`File::create`]: struct.File.html#method.create
/// ///
/// Generally speaking, when using `OpenOptions`, you'll first call [`new()`], /// Generally speaking, when using `OpenOptions`, you'll first call [`new`],
/// then chain calls to methods to set each option, then call [`open()`], /// then chain calls to methods to set each option, then call [`open`],
/// passing the path of the file you're trying to open. This will give you a /// passing the path of the file you're trying to open. This will give you a
/// [`io::Result`][result] with a [`File`][file] inside that you can further /// [`io::Result`][result] with a [`File`][file] inside that you can further
/// operate on. /// operate on.
/// ///
/// [`new()`]: struct.OpenOptions.html#method.new /// [`new`]: struct.OpenOptions.html#method.new
/// [`open()`]: struct.OpenOptions.html#method.open /// [`open`]: struct.OpenOptions.html#method.open
/// [result]: ../io/type.Result.html /// [result]: ../io/type.Result.html
/// [file]: struct.File.html /// [file]: struct.File.html
/// ///

View file

@ -140,13 +140,13 @@ pub enum ErrorKind {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
TimedOut, TimedOut,
/// An error returned when an operation could not be completed because a /// An error returned when an operation could not be completed because a
/// call to [`write()`] returned [`Ok(0)`]. /// call to [`write`] returned [`Ok(0)`].
/// ///
/// This typically means that an operation could only succeed if it wrote a /// This typically means that an operation could only succeed if it wrote a
/// particular number of bytes but only a smaller number of bytes could be /// particular number of bytes but only a smaller number of bytes could be
/// written. /// written.
/// ///
/// [`write()`]: ../../std/io/trait.Write.html#tymethod.write /// [`write`]: ../../std/io/trait.Write.html#tymethod.write
/// [`Ok(0)`]: ../../std/io/type.Result.html /// [`Ok(0)`]: ../../std/io/type.Result.html
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
WriteZero, WriteZero,

View file

@ -21,7 +21,7 @@
//! of other types, and you can implement them for your types too. As such, //! 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 //! you'll see a few different types of I/O throughout the documentation in
//! this module: [`File`]s, [`TcpStream`]s, and sometimes even [`Vec<T>`]s. For //! this module: [`File`]s, [`TcpStream`]s, and sometimes even [`Vec<T>`]s. For
//! example, [`Read`] adds a [`read()`] method, which we can use on `File`s: //! example, [`Read`] adds a [`read`] method, which we can use on `File`s:
//! //!
//! ``` //! ```
//! use std::io; //! use std::io;
@ -106,7 +106,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()`]: //! to [`write`]:
//! //!
//! ``` //! ```
//! use std::io; //! use std::io;
@ -157,7 +157,7 @@
//! # } //! # }
//! ``` //! ```
//! //!
//! Of course, using [`io::stdout()`] directly is less common than something like //! Of course, using [`io::stdout`] directly is less common than something like
//! [`println!`]. //! [`println!`].
//! //!
//! ## Iterator types //! ## Iterator types
@ -245,13 +245,13 @@
//! [`Vec<T>`]: ../vec/struct.Vec.html //! [`Vec<T>`]: ../vec/struct.Vec.html
//! [`BufReader`]: struct.BufReader.html //! [`BufReader`]: struct.BufReader.html
//! [`BufWriter`]: struct.BufWriter.html //! [`BufWriter`]: struct.BufWriter.html
//! [`write()`]: trait.Write.html#tymethod.write //! [`write`]: trait.Write.html#tymethod.write
//! [`io::stdout()`]: fn.stdout.html //! [`io::stdout`]: fn.stdout.html
//! [`println!`]: ../macro.println.html //! [`println!`]: ../macro.println.html
//! [`Lines`]: struct.Lines.html //! [`Lines`]: struct.Lines.html
//! [`io::Result`]: type.Result.html //! [`io::Result`]: type.Result.html
//! [`?` operator]: ../../book/syntax-index.html //! [`?` operator]: ../../book/syntax-index.html
//! [`read()`]: trait.Read.html#tymethod.read //! [`read`]: trait.Read.html#tymethod.read
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
@ -530,7 +530,7 @@ pub trait Read {
/// If the data in this stream is *not* valid UTF-8 then an error is /// If the data in this stream is *not* valid UTF-8 then an error is
/// returned and `buf` is unchanged. /// returned and `buf` is unchanged.
/// ///
/// See [`read_to_end()`][readtoend] for other error semantics. /// See [`read_to_end`][readtoend] for other error semantics.
/// ///
/// [readtoend]: #method.read_to_end /// [readtoend]: #method.read_to_end
/// ///
@ -815,12 +815,12 @@ pub trait Read {
/// ///
/// Implementors of the `Write` trait are sometimes called 'writers'. /// Implementors of the `Write` trait are sometimes called 'writers'.
/// ///
/// Writers are defined by two required methods, [`write()`] and [`flush()`]: /// Writers are defined by two required methods, [`write`] and [`flush`]:
/// ///
/// * The [`write()`] method will attempt to write some data into the object, /// * The [`write`] method will attempt to write some data into the object,
/// returning how many bytes were successfully written. /// returning how many bytes were successfully written.
/// ///
/// * The [`flush()`] method is useful for adaptors and explicit buffers /// * The [`flush`] method is useful for adaptors and explicit buffers
/// themselves for ensuring that all buffered data has been pushed out to the /// themselves for ensuring that all buffered data has been pushed out to the
/// 'true sink'. /// 'true sink'.
/// ///
@ -828,8 +828,8 @@ pub trait Read {
/// throughout [`std::io`] take and provide types which implement the `Write` /// throughout [`std::io`] take and provide types which implement the `Write`
/// trait. /// trait.
/// ///
/// [`write()`]: #tymethod.write /// [`write`]: #tymethod.write
/// [`flush()`]: #tymethod.flush /// [`flush`]: #tymethod.flush
/// [`std::io`]: index.html /// [`std::io`]: index.html
/// ///
/// # Examples /// # Examples
@ -1159,7 +1159,7 @@ fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>)
/// ///
/// For example, reading line-by-line is inefficient without using a buffer, so /// For example, reading line-by-line is inefficient without using a buffer, so
/// if you want to read by line, you'll need `BufRead`, which includes a /// if you want to read by line, you'll need `BufRead`, which includes a
/// [`read_line()`] method as well as a [`lines()`] iterator. /// [`read_line`] method as well as a [`lines`] iterator.
/// ///
/// # Examples /// # Examples
/// ///
@ -1183,8 +1183,8 @@ fn read_until<R: BufRead + ?Sized>(r: &mut R, delim: u8, buf: &mut Vec<u8>)
/// ///
/// [`BufReader`]: struct.BufReader.html /// [`BufReader`]: struct.BufReader.html
/// [`File`]: ../fs/struct.File.html /// [`File`]: ../fs/struct.File.html
/// [`read_line()`]: #method.read_line /// [`read_line`]: #method.read_line
/// [`lines()`]: #method.lines /// [`lines`]: #method.lines
/// [`Read`]: trait.Read.html /// [`Read`]: trait.Read.html
/// ///
/// ``` /// ```
@ -1209,13 +1209,13 @@ pub trait BufRead: Read {
/// Fills the internal buffer of this object, returning the buffer contents. /// Fills the internal buffer of this object, returning the buffer contents.
/// ///
/// This function is a lower-level call. It needs to be paired with the /// This function is a lower-level call. It needs to be paired with the
/// [`consume()`] method to function properly. When calling this /// [`consume`] method to function properly. When calling this
/// method, none of the contents will be "read" in the sense that later /// method, none of the contents will be "read" in the sense that later
/// calling `read` may return the same contents. As such, [`consume()`] must /// calling `read` may return the same contents. As such, [`consume`] must
/// be called with the number of bytes that are consumed from this buffer to /// be called with the number of bytes that are consumed from this buffer to
/// ensure that the bytes are never returned twice. /// ensure that the bytes are never returned twice.
/// ///
/// [`consume()`]: #tymethod.consume /// [`consume`]: #tymethod.consume
/// ///
/// An empty buffer returned indicates that the stream has reached EOF. /// An empty buffer returned indicates that the stream has reached EOF.
/// ///
@ -1256,21 +1256,21 @@ pub trait BufRead: Read {
/// so they should no longer be returned in calls to `read`. /// so they should no longer be returned in calls to `read`.
/// ///
/// This function is a lower-level call. It needs to be paired with the /// This function is a lower-level call. It needs to be paired with the
/// [`fill_buf()`] method to function properly. This function does /// [`fill_buf`] method to function properly. This function does
/// not perform any I/O, it simply informs this object that some amount of /// not perform any I/O, it simply informs this object that some amount of
/// its buffer, returned from [`fill_buf()`], has been consumed and should /// its buffer, returned from [`fill_buf`], has been consumed and should
/// no longer be returned. As such, this function may do odd things if /// no longer be returned. As such, this function may do odd things if
/// [`fill_buf()`] isn't called before calling it. /// [`fill_buf`] isn't called before calling it.
/// ///
/// The `amt` must be `<=` the number of bytes in the buffer returned by /// The `amt` must be `<=` the number of bytes in the buffer returned by
/// [`fill_buf()`]. /// [`fill_buf`].
/// ///
/// # Examples /// # Examples
/// ///
/// Since `consume()` is meant to be used with [`fill_buf()`], /// Since `consume()` is meant to be used with [`fill_buf`],
/// that method's example includes an example of `consume()`. /// that method's example includes an example of `consume()`.
/// ///
/// [`fill_buf()`]: #tymethod.fill_buf /// [`fill_buf`]: #tymethod.fill_buf
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn consume(&mut self, amt: usize); fn consume(&mut self, amt: usize);
@ -1285,7 +1285,7 @@ pub trait BufRead: Read {
/// # Errors /// # Errors
/// ///
/// This function will ignore all instances of [`ErrorKind::Interrupted`] and /// This function will ignore all instances of [`ErrorKind::Interrupted`] and
/// will otherwise return any errors returned by [`fill_buf()`]. /// will otherwise return any errors returned by [`fill_buf`].
/// ///
/// If an I/O error is encountered then all bytes read so far will be /// If an I/O error is encountered then all bytes read so far will be
/// present in `buf` and its length will have been adjusted appropriately. /// present in `buf` and its length will have been adjusted appropriately.
@ -1295,7 +1295,7 @@ pub trait BufRead: Read {
/// A locked standard input implements `BufRead`. In this example, we'll /// A locked standard input implements `BufRead`. In this example, we'll
/// read from standard input until we see an `a` byte. /// read from standard input until we see an `a` byte.
/// ///
/// [`fill_buf()`]: #tymethod.fill_buf /// [`fill_buf`]: #tymethod.fill_buf
/// [`ErrorKind::Interrupted`]: enum.ErrorKind.html#variant.Interrupted /// [`ErrorKind::Interrupted`]: enum.ErrorKind.html#variant.Interrupted
/// ///
/// ``` /// ```
@ -1330,7 +1330,7 @@ pub trait BufRead: Read {
/// ///
/// # Errors /// # Errors
/// ///
/// This function has the same error semantics as [`read_until()`] and will /// This function has the same error semantics as [`read_until`] and will
/// also return an error if the read bytes are not valid UTF-8. If an I/O /// also return an error if the read bytes are not valid UTF-8. If an I/O
/// error is encountered then `buf` may contain some bytes already read in /// error is encountered then `buf` may contain some bytes already read in
/// the event that all data read so far was valid UTF-8. /// the event that all data read so far was valid UTF-8.
@ -1339,11 +1339,11 @@ pub trait BufRead: Read {
/// ///
/// A locked standard input implements `BufRead`. In this example, we'll /// A locked standard input implements `BufRead`. In this example, we'll
/// read all of the lines from standard input. If we were to do this in /// read all of the lines from standard input. If we were to do this in
/// an actual project, the [`lines()`] method would be easier, of /// an actual project, the [`lines`] method would be easier, of
/// course. /// course.
/// ///
/// [`lines()`]: #method.lines /// [`lines`]: #method.lines
/// [`read_until()`]: #method.read_until /// [`read_until`]: #method.read_until
/// ///
/// ``` /// ```
/// use std::io; /// use std::io;
@ -1375,7 +1375,7 @@ pub trait BufRead: Read {
/// [`io::Result`]`<`[`Vec<u8>`]`>`. Each vector returned will *not* have /// [`io::Result`]`<`[`Vec<u8>`]`>`. Each vector returned will *not* have
/// the delimiter byte at the end. /// the delimiter byte at the end.
/// ///
/// This function will yield errors whenever [`read_until()`] would have /// This function will yield errors whenever [`read_until`] would have
/// also yielded an error. /// also yielded an error.
/// ///
/// # Examples /// # Examples
@ -1385,7 +1385,7 @@ pub trait BufRead: Read {
/// ///
/// [`io::Result`]: type.Result.html /// [`io::Result`]: type.Result.html
/// [`Vec<u8>`]: ../vec/struct.Vec.html /// [`Vec<u8>`]: ../vec/struct.Vec.html
/// [`read_until()`]: #method.read_until /// [`read_until`]: #method.read_until
/// ///
/// ``` /// ```
/// use std::io; /// use std::io;
@ -1428,9 +1428,9 @@ pub trait BufRead: Read {
/// ///
/// # Errors /// # Errors
/// ///
/// Each line of the iterator has the same error semantics as [`BufRead::read_line()`]. /// Each line of the iterator has the same error semantics as [`BufRead::read_line`].
/// ///
/// [`BufRead::read_line()`]: trait.BufRead.html#method.read_line /// [`BufRead::read_line`]: trait.BufRead.html#method.read_line
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn lines(self) -> Lines<Self> where Self: Sized { fn lines(self) -> Lines<Self> where Self: Sized {
Lines { buf: self } Lines { buf: self }
@ -1439,10 +1439,10 @@ pub trait BufRead: Read {
/// Adaptor to chain together two readers. /// Adaptor to chain together two readers.
/// ///
/// This struct is generally created by calling [`chain()`] on a reader. /// This struct is generally created by calling [`chain`] on a reader.
/// Please see the documentation of [`chain()`] for more details. /// Please see the documentation of [`chain`] for more details.
/// ///
/// [`chain()`]: trait.Read.html#method.chain /// [`chain`]: trait.Read.html#method.chain
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Chain<T, U> { pub struct Chain<T, U> {
first: T, first: T,
@ -1496,10 +1496,10 @@ impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> {
/// Reader adaptor which limits the bytes read from an underlying reader. /// Reader adaptor which limits the bytes read from an underlying reader.
/// ///
/// This struct is generally created by calling [`take()`] on a reader. /// This struct is generally created by calling [`take`] on a reader.
/// Please see the documentation of [`take()`] for more details. /// Please see the documentation of [`take`] for more details.
/// ///
/// [`take()`]: trait.Read.html#method.take /// [`take`]: trait.Read.html#method.take
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[derive(Debug)] #[derive(Debug)]
pub struct Take<T> { pub struct Take<T> {
@ -1614,10 +1614,10 @@ fn read_one_byte(reader: &mut Read) -> Option<Result<u8>> {
/// An iterator over `u8` values of a reader. /// An iterator over `u8` values of a reader.
/// ///
/// This struct is generally created by calling [`bytes()`] on a reader. /// This struct is generally created by calling [`bytes`] on a reader.
/// Please see the documentation of [`bytes()`] for more details. /// Please see the documentation of [`bytes`] for more details.
/// ///
/// [`bytes()`]: trait.Read.html#method.bytes /// [`bytes`]: trait.Read.html#method.bytes
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[derive(Debug)] #[derive(Debug)]
pub struct Bytes<R> { pub struct Bytes<R> {
@ -1635,7 +1635,7 @@ impl<R: Read> Iterator for Bytes<R> {
/// An iterator over the `char`s of a reader. /// An iterator over the `char`s of a reader.
/// ///
/// This struct is generally created by calling [`chars()`][chars] on a reader. /// This struct is generally created by calling [`chars`][chars] on a reader.
/// Please see the documentation of `chars()` for more details. /// Please see the documentation of `chars()` for more details.
/// ///
/// [chars]: trait.Read.html#method.chars /// [chars]: trait.Read.html#method.chars
@ -1726,7 +1726,7 @@ impl fmt::Display for CharsError {
/// An iterator over the contents of an instance of `BufRead` split on a /// An iterator over the contents of an instance of `BufRead` split on a
/// particular byte. /// particular byte.
/// ///
/// This struct is generally created by calling [`split()`][split] on a /// This struct is generally created by calling [`split`][split] on a
/// `BufRead`. Please see the documentation of `split()` for more details. /// `BufRead`. Please see the documentation of `split()` for more details.
/// ///
/// [split]: trait.BufRead.html#method.split /// [split]: trait.BufRead.html#method.split
@ -1758,7 +1758,7 @@ impl<B: BufRead> Iterator for Split<B> {
/// An iterator over the lines of an instance of `BufRead`. /// An iterator over the lines of an instance of `BufRead`.
/// ///
/// This struct is generally created by calling [`lines()`][lines] on a /// This struct is generally created by calling [`lines`][lines] on a
/// `BufRead`. Please see the documentation of `lines()` for more details. /// `BufRead`. Please see the documentation of `lines()` for more details.
/// ///
/// [lines]: trait.BufRead.html#method.lines /// [lines]: trait.BufRead.html#method.lines

View file

@ -332,11 +332,11 @@ impl<'a> fmt::Debug for StdinLock<'a> {
/// ///
/// Each handle shares a global buffer of data to be written to the standard /// Each handle shares a global buffer of data to be written to the standard
/// output stream. Access is also synchronized via a lock and explicit control /// output stream. Access is also synchronized via a lock and explicit control
/// over locking is available via the [`lock()`] method. /// over locking is available via the [`lock`] method.
/// ///
/// Created by the [`io::stdout`] method. /// Created by the [`io::stdout`] method.
/// ///
/// [`lock()`]: #method.lock /// [`lock`]: #method.lock
/// [`io::stdout`]: fn.stdout.html /// [`io::stdout`]: fn.stdout.html
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Stdout { pub struct Stdout {

View file

@ -63,7 +63,7 @@ pub fn copy<R: ?Sized, W: ?Sized>(reader: &mut R, writer: &mut W) -> io::Result<
/// A reader which is always at EOF. /// A reader which is always at EOF.
/// ///
/// This struct is generally created by calling [`empty()`][empty]. Please see /// This struct is generally created by calling [`empty`][empty]. Please see
/// the documentation of `empty()` for more details. /// the documentation of `empty()` for more details.
/// ///
/// [empty]: fn.empty.html /// [empty]: fn.empty.html
@ -107,7 +107,7 @@ impl fmt::Debug for Empty {
/// A reader which yields one byte over and over and over and over and over and... /// A reader which yields one byte over and over and over and over and over and...
/// ///
/// This struct is generally created by calling [`repeat()`][repeat]. Please /// This struct is generally created by calling [`repeat`][repeat]. Please
/// see the documentation of `repeat()` for more details. /// see the documentation of `repeat()` for more details.
/// ///
/// [repeat]: fn.repeat.html /// [repeat]: fn.repeat.html
@ -150,7 +150,7 @@ impl fmt::Debug for Repeat {
/// A writer which will move data into the void. /// A writer which will move data into the void.
/// ///
/// This struct is generally created by calling [`sink()`][sink]. Please /// This struct is generally created by calling [`sink`][sink]. Please
/// see the documentation of `sink()` for more details. /// see the documentation of `sink()` for more details.
/// ///
/// [sink]: fn.sink.html /// [sink]: fn.sink.html

View file

@ -21,7 +21,7 @@
//! contained an `extern crate std;` import at the [crate root]. Therefore the //! contained an `extern crate std;` import at the [crate root]. Therefore the
//! standard library can be accessed in [`use`] statements through the path //! standard library can be accessed in [`use`] statements through the path
//! `std`, as in [`use std::env`], or in expressions through the absolute path //! `std`, as in [`use std::env`], or in expressions through the absolute path
//! `::std`, as in [`::std::env::args()`]. //! `::std`, as in [`::std::env::args`].
//! //!
//! # How to read this documentation //! # How to read this documentation
//! //!
@ -156,7 +156,7 @@
//! [TCP]: net/struct.TcpStream.html //! [TCP]: net/struct.TcpStream.html
//! [The Rust Prelude]: prelude/index.html //! [The Rust Prelude]: prelude/index.html
//! [UDP]: net/struct.UdpSocket.html //! [UDP]: net/struct.UdpSocket.html
//! [`::std::env::args()`]: env/fn.args.html //! [`::std::env::args`]: env/fn.args.html
//! [`Arc`]: sync/struct.Arc.html //! [`Arc`]: sync/struct.Arc.html
//! [owned slice]: boxed/index.html //! [owned slice]: boxed/index.html
//! [`Cell`]: cell/struct.Cell.html //! [`Cell`]: cell/struct.Cell.html

View file

@ -183,7 +183,7 @@ impl TcpStream {
/// Sets the read timeout to the timeout specified. /// Sets the read timeout to the timeout specified.
/// ///
/// If the value specified is [`None`], then [`read()`] calls will block /// If the value specified is [`None`], then [`read`] calls will block
/// indefinitely. It is an error to pass the zero `Duration` to this /// indefinitely. It is an error to pass the zero `Duration` to this
/// method. /// method.
/// ///
@ -194,7 +194,7 @@ impl TcpStream {
/// error of the kind [`WouldBlock`], but Windows may return [`TimedOut`]. /// error of the kind [`WouldBlock`], but Windows may return [`TimedOut`].
/// ///
/// [`None`]: ../../std/option/enum.Option.html#variant.None /// [`None`]: ../../std/option/enum.Option.html#variant.None
/// [`read()`]: ../../std/io/trait.Read.html#tymethod.read /// [`read`]: ../../std/io/trait.Read.html#tymethod.read
/// [`WouldBlock`]: ../../std/io/enum.ErrorKind.html#variant.WouldBlock /// [`WouldBlock`]: ../../std/io/enum.ErrorKind.html#variant.WouldBlock
/// [`TimedOut`]: ../../std/io/enum.ErrorKind.html#variant.TimedOut /// [`TimedOut`]: ../../std/io/enum.ErrorKind.html#variant.TimedOut
/// ///
@ -214,7 +214,7 @@ impl TcpStream {
/// Sets the write timeout to the timeout specified. /// Sets the write timeout to the timeout specified.
/// ///
/// If the value specified is [`None`], then [`write()`] calls will block /// If the value specified is [`None`], then [`write`] calls will block
/// indefinitely. It is an error to pass the zero [`Duration`] to this /// indefinitely. It is an error to pass the zero [`Duration`] to this
/// method. /// method.
/// ///
@ -225,7 +225,7 @@ impl TcpStream {
/// an error of the kind [`WouldBlock`], but Windows may return [`TimedOut`]. /// an error of the kind [`WouldBlock`], but Windows may return [`TimedOut`].
/// ///
/// [`None`]: ../../std/option/enum.Option.html#variant.None /// [`None`]: ../../std/option/enum.Option.html#variant.None
/// [`write()`]: ../../std/io/trait.Write.html#tymethod.write /// [`write`]: ../../std/io/trait.Write.html#tymethod.write
/// [`Duration`]: ../../std/time/struct.Duration.html /// [`Duration`]: ../../std/time/struct.Duration.html
/// [`WouldBlock`]: ../../std/io/enum.ErrorKind.html#variant.WouldBlock /// [`WouldBlock`]: ../../std/io/enum.ErrorKind.html#variant.WouldBlock
/// [`TimedOut`]: ../../std/io/enum.ErrorKind.html#variant.TimedOut /// [`TimedOut`]: ../../std/io/enum.ErrorKind.html#variant.TimedOut
@ -246,14 +246,14 @@ impl TcpStream {
/// Returns the read timeout of this socket. /// Returns the read timeout of this socket.
/// ///
/// If the timeout is [`None`], then [`read()`] calls will block indefinitely. /// If the timeout is [`None`], then [`read`] calls will block indefinitely.
/// ///
/// # Note /// # Note
/// ///
/// Some platforms do not provide access to the current timeout. /// Some platforms do not provide access to the current timeout.
/// ///
/// [`None`]: ../../std/option/enum.Option.html#variant.None /// [`None`]: ../../std/option/enum.Option.html#variant.None
/// [`read()`]: ../../std/io/trait.Read.html#tymethod.read /// [`read`]: ../../std/io/trait.Read.html#tymethod.read
/// ///
/// # Examples /// # Examples
/// ///
@ -272,14 +272,14 @@ impl TcpStream {
/// Returns the write timeout of this socket. /// Returns the write timeout of this socket.
/// ///
/// If the timeout is [`None`], then [`write()`] calls will block indefinitely. /// If the timeout is [`None`], then [`write`] calls will block indefinitely.
/// ///
/// # Note /// # Note
/// ///
/// Some platforms do not provide access to the current timeout. /// Some platforms do not provide access to the current timeout.
/// ///
/// [`None`]: ../../std/option/enum.Option.html#variant.None /// [`None`]: ../../std/option/enum.Option.html#variant.None
/// [`write()`]: ../../std/io/trait.Write.html#tymethod.write /// [`write`]: ../../std/io/trait.Write.html#tymethod.write
/// ///
/// # Examples /// # Examples
/// ///
@ -618,7 +618,7 @@ impl TcpListener {
/// Gets the value of the `IP_TTL` option for this socket. /// Gets the value of the `IP_TTL` option for this socket.
/// ///
/// For more information about this option, see [`set_ttl()`][link]. /// For more information about this option, see [`set_ttl`][link].
/// ///
/// [link]: #method.set_ttl /// [link]: #method.set_ttl
/// ///

View file

@ -175,7 +175,7 @@ impl UdpSocket {
/// Sets the read timeout to the timeout specified. /// Sets the read timeout to the timeout specified.
/// ///
/// If the value specified is [`None`], then [`read()`] calls will block /// If the value specified is [`None`], then [`read`] calls will block
/// indefinitely. It is an error to pass the zero [`Duration`] to this /// indefinitely. It is an error to pass the zero [`Duration`] to this
/// method. /// method.
/// ///
@ -186,7 +186,7 @@ impl UdpSocket {
/// error of the kind [`WouldBlock`], but Windows may return [`TimedOut`]. /// error of the kind [`WouldBlock`], but Windows may return [`TimedOut`].
/// ///
/// [`None`]: ../../std/option/enum.Option.html#variant.None /// [`None`]: ../../std/option/enum.Option.html#variant.None
/// [`read()`]: ../../std/io/trait.Read.html#tymethod.read /// [`read`]: ../../std/io/trait.Read.html#tymethod.read
/// [`Duration`]: ../../std/time/struct.Duration.html /// [`Duration`]: ../../std/time/struct.Duration.html
/// [`WouldBlock`]: ../../std/io/enum.ErrorKind.html#variant.WouldBlock /// [`WouldBlock`]: ../../std/io/enum.ErrorKind.html#variant.WouldBlock
/// [`TimedOut`]: ../../std/io/enum.ErrorKind.html#variant.TimedOut /// [`TimedOut`]: ../../std/io/enum.ErrorKind.html#variant.TimedOut
@ -206,7 +206,7 @@ impl UdpSocket {
/// Sets the write timeout to the timeout specified. /// Sets the write timeout to the timeout specified.
/// ///
/// If the value specified is [`None`], then [`write()`] calls will block /// If the value specified is [`None`], then [`write`] calls will block
/// indefinitely. It is an error to pass the zero [`Duration`] to this /// indefinitely. It is an error to pass the zero [`Duration`] to this
/// method. /// method.
/// ///
@ -217,7 +217,7 @@ impl UdpSocket {
/// an error of the kind [`WouldBlock`], but Windows may return [`TimedOut`]. /// an error of the kind [`WouldBlock`], but Windows may return [`TimedOut`].
/// ///
/// [`None`]: ../../std/option/enum.Option.html#variant.None /// [`None`]: ../../std/option/enum.Option.html#variant.None
/// [`write()`]: ../../std/io/trait.Write.html#tymethod.write /// [`write`]: ../../std/io/trait.Write.html#tymethod.write
/// [`Duration`]: ../../std/time/struct.Duration.html /// [`Duration`]: ../../std/time/struct.Duration.html
/// [`WouldBlock`]: ../../std/io/enum.ErrorKind.html#variant.WouldBlock /// [`WouldBlock`]: ../../std/io/enum.ErrorKind.html#variant.WouldBlock
/// [`TimedOut`]: ../../std/io/enum.ErrorKind.html#variant.TimedOut /// [`TimedOut`]: ../../std/io/enum.ErrorKind.html#variant.TimedOut
@ -237,10 +237,10 @@ impl UdpSocket {
/// Returns the read timeout of this socket. /// Returns the read timeout of this socket.
/// ///
/// If the timeout is [`None`], then [`read()`] calls will block indefinitely. /// If the timeout is [`None`], then [`read`] calls will block indefinitely.
/// ///
/// [`None`]: ../../std/option/enum.Option.html#variant.None /// [`None`]: ../../std/option/enum.Option.html#variant.None
/// [`read()`]: ../../std/io/trait.Read.html#tymethod.read /// [`read`]: ../../std/io/trait.Read.html#tymethod.read
/// ///
/// # Examples /// # Examples
/// ///
@ -258,10 +258,10 @@ impl UdpSocket {
/// Returns the write timeout of this socket. /// Returns the write timeout of this socket.
/// ///
/// If the timeout is [`None`], then [`write()`] calls will block indefinitely. /// If the timeout is [`None`], then [`write`] calls will block indefinitely.
/// ///
/// [`None`]: ../../std/option/enum.Option.html#variant.None /// [`None`]: ../../std/option/enum.Option.html#variant.None
/// [`write()`]: ../../std/io/trait.Write.html#tymethod.write /// [`write`]: ../../std/io/trait.Write.html#tymethod.write
/// ///
/// # Examples /// # Examples
/// ///
@ -560,10 +560,10 @@ impl UdpSocket {
/// Sends data on the socket to the remote address to which it is connected. /// Sends data on the socket to the remote address to which it is connected.
/// ///
/// The [`connect()`] method will connect this socket to a remote address. This /// The [`connect`] method will connect this socket to a remote address. This
/// method will fail if the socket is not connected. /// method will fail if the socket is not connected.
/// ///
/// [`connect()`]: #method.connect /// [`connect`]: #method.connect
/// ///
/// # Examples /// # Examples
/// ///

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
//! MacOS-specific definitions //! macOS-specific definitions
#![stable(feature = "raw_ext", since = "1.1.0")] #![stable(feature = "raw_ext", since = "1.1.0")]

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
//! MacOS-specific raw type definitions //! macOS-specific raw type definitions
#![stable(feature = "raw_ext", since = "1.1.0")] #![stable(feature = "raw_ext", since = "1.1.0")]
#![rustc_deprecated(since = "1.8.0", #![rustc_deprecated(since = "1.8.0",

View file

@ -160,10 +160,10 @@ pub fn take_hook() -> Box<Fn(&PanicInfo) + 'static + Sync + Send> {
/// A struct providing information about a panic. /// A struct providing information about a panic.
/// ///
/// `PanicInfo` structure is passed to a panic hook set by the [`set_hook()`] /// `PanicInfo` structure is passed to a panic hook set by the [`set_hook`]
/// function. /// function.
/// ///
/// [`set_hook()`]: ../../std/panic/fn.set_hook.html /// [`set_hook`]: ../../std/panic/fn.set_hook.html
/// ///
/// # Examples /// # Examples
/// ///
@ -237,9 +237,9 @@ impl<'a> PanicInfo<'a> {
/// A struct containing information about the location of a panic. /// A struct containing information about the location of a panic.
/// ///
/// This structure is created by the [`location()`] method of [`PanicInfo`]. /// This structure is created by the [`location`] method of [`PanicInfo`].
/// ///
/// [`location()`]: ../../std/panic/struct.PanicInfo.html#method.location /// [`location`]: ../../std/panic/struct.PanicInfo.html#method.location
/// [`PanicInfo`]: ../../std/panic/struct.PanicInfo.html /// [`PanicInfo`]: ../../std/panic/struct.PanicInfo.html
/// ///
/// # Examples /// # Examples

View file

@ -1065,13 +1065,13 @@ impl PathBuf {
self.inner.push(path); self.inner.push(path);
} }
/// Truncate `self` to [`self.parent()`]. /// Truncate `self` to [`self.parent`].
/// ///
/// Returns false and does nothing if [`self.file_name()`] is `None`. /// Returns false and does nothing if [`self.file_name`] is `None`.
/// Otherwise, returns `true`. /// Otherwise, returns `true`.
/// ///
/// [`self.parent()`]: struct.PathBuf.html#method.parent /// [`self.parent`]: struct.PathBuf.html#method.parent
/// [`self.file_name()`]: struct.PathBuf.html#method.file_name /// [`self.file_name`]: struct.PathBuf.html#method.file_name
/// ///
/// # Examples /// # Examples
/// ///
@ -1096,12 +1096,12 @@ impl PathBuf {
} }
} }
/// Updates [`self.file_name()`] to `file_name`. /// Updates [`self.file_name`] to `file_name`.
/// ///
/// If [`self.file_name()`] was [`None`], this is equivalent to pushing /// If [`self.file_name`] was [`None`], this is equivalent to pushing
/// `file_name`. /// `file_name`.
/// ///
/// [`self.file_name()`]: struct.PathBuf.html#method.file_name /// [`self.file_name`]: struct.PathBuf.html#method.file_name
/// [`None`]: ../../std/option/enum.Option.html#variant.None /// [`None`]: ../../std/option/enum.Option.html#variant.None
/// ///
/// # Examples /// # Examples
@ -1130,15 +1130,15 @@ impl PathBuf {
self.push(file_name); self.push(file_name);
} }
/// Updates [`self.extension()`] to `extension`. /// Updates [`self.extension`] to `extension`.
/// ///
/// If [`self.file_name()`] is `None`, does nothing and returns `false`. /// If [`self.file_name`] is `None`, does nothing and returns `false`.
/// ///
/// Otherwise, returns `true`; if [`self.extension()`] is [`None`], the /// Otherwise, returns `true`; if [`self.extension`] is [`None`], the
/// extension is added; otherwise it is replaced. /// extension is added; otherwise it is replaced.
/// ///
/// [`self.file_name()`]: struct.PathBuf.html#method.file_name /// [`self.file_name`]: struct.PathBuf.html#method.file_name
/// [`self.extension()`]: struct.PathBuf.html#method.extension /// [`self.extension`]: struct.PathBuf.html#method.extension
/// [`None`]: ../../std/option/enum.Option.html#variant.None /// [`None`]: ../../std/option/enum.Option.html#variant.None
/// ///
/// # Examples /// # Examples
@ -1739,9 +1739,9 @@ impl Path {
iter_after(self.components().rev(), child.components().rev()).is_some() iter_after(self.components().rev(), child.components().rev()).is_some()
} }
/// Extracts the stem (non-extension) portion of [`self.file_name()`]. /// Extracts the stem (non-extension) portion of [`self.file_name`].
/// ///
/// [`self.file_name()`]: struct.Path.html#method.file_name /// [`self.file_name`]: struct.Path.html#method.file_name
/// ///
/// The stem is: /// The stem is:
/// ///
@ -1766,7 +1766,7 @@ impl Path {
self.file_name().map(split_file_at_dot).and_then(|(before, after)| before.or(after)) self.file_name().map(split_file_at_dot).and_then(|(before, after)| before.or(after))
} }
/// Extracts the extension of [`self.file_name()`], if possible. /// Extracts the extension of [`self.file_name`], if possible.
/// ///
/// The extension is: /// The extension is:
/// ///
@ -1775,7 +1775,7 @@ impl Path {
/// * [`None`], if the file name begins with `.` and has no other `.`s within; /// * [`None`], if the file name begins with `.` and has no other `.`s within;
/// * Otherwise, the portion of the file name after the final `.` /// * Otherwise, the portion of the file name after the final `.`
/// ///
/// [`self.file_name()`]: struct.Path.html#method.file_name /// [`self.file_name`]: struct.Path.html#method.file_name
/// [`None`]: ../../std/option/enum.Option.html#variant.None /// [`None`]: ../../std/option/enum.Option.html#variant.None
/// ///
/// # Examples /// # Examples

View file

@ -60,9 +60,9 @@
//! value. //! value.
//! * [`std::boxed`]::[`Box`], a way to allocate values on the heap. //! * [`std::boxed`]::[`Box`], a way to allocate values on the heap.
//! * [`std::borrow`]::[`ToOwned`], The conversion trait that defines //! * [`std::borrow`]::[`ToOwned`], The conversion trait that defines
//! [`to_owned()`], the generic method for creating an owned type from a //! [`to_owned`], the generic method for creating an owned type from a
//! borrowed type. //! borrowed type.
//! * [`std::clone`]::[`Clone`], the ubiquitous trait that defines [`clone()`], //! * [`std::clone`]::[`Clone`], the ubiquitous trait that defines [`clone`],
//! the method for producing a copy of a value. //! the method for producing a copy of a value.
//! * [`std::cmp`]::{[`PartialEq`], [`PartialOrd`], [`Eq`], [`Ord`] }. The //! * [`std::cmp`]::{[`PartialEq`], [`PartialOrd`], [`Eq`], [`Ord`] }. The
//! comparison traits, which implement the comparison operators and are often //! comparison traits, which implement the comparison operators and are often
@ -117,7 +117,7 @@
//! [`ToOwned`]: ../borrow/trait.ToOwned.html //! [`ToOwned`]: ../borrow/trait.ToOwned.html
//! [`ToString`]: ../string/trait.ToString.html //! [`ToString`]: ../string/trait.ToString.html
//! [`Vec`]: ../vec/struct.Vec.html //! [`Vec`]: ../vec/struct.Vec.html
//! [`clone()`]: ../clone/trait.Clone.html#tymethod.clone //! [`clone`]: ../clone/trait.Clone.html#tymethod.clone
//! [`drop`]: ../mem/fn.drop.html //! [`drop`]: ../mem/fn.drop.html
//! [`std::borrow`]: ../borrow/index.html //! [`std::borrow`]: ../borrow/index.html
//! [`std::boxed`]: ../boxed/index.html //! [`std::boxed`]: ../boxed/index.html
@ -135,7 +135,7 @@
//! [`std::slice`]: ../slice/index.html //! [`std::slice`]: ../slice/index.html
//! [`std::string`]: ../string/index.html //! [`std::string`]: ../string/index.html
//! [`std::vec`]: ../vec/index.html //! [`std::vec`]: ../vec/index.html
//! [`to_owned()`]: ../borrow/trait.ToOwned.html#tymethod.to_owned //! [`to_owned`]: ../borrow/trait.ToOwned.html#tymethod.to_owned
//! [book-closures]: ../../book/closures.html //! [book-closures]: ../../book/closures.html
//! [book-dtor]: ../../book/drop.html //! [book-dtor]: ../../book/drop.html
//! [book-enums]: ../../book/enums.html //! [book-enums]: ../../book/enums.html

View file

@ -420,7 +420,7 @@ mod prim_slice { }
/// # Representation /// # Representation
/// ///
/// A `&str` is made up of two components: a pointer to some bytes, and a /// A `&str` is made up of two components: a pointer to some bytes, and a
/// length. You can look at these with the [`.as_ptr()`] and [`len()`] methods: /// length. You can look at these with the [`.as_ptr`] and [`len`] methods:
/// ///
/// ``` /// ```
/// use std::slice; /// use std::slice;
@ -447,8 +447,8 @@ mod prim_slice { }
/// assert_eq!(s, Ok(story)); /// assert_eq!(s, Ok(story));
/// ``` /// ```
/// ///
/// [`.as_ptr()`]: #method.as_ptr /// [`.as_ptr`]: #method.as_ptr
/// [`len()`]: #method.len /// [`len`]: #method.len
/// ///
/// Note: This example shows the internals of `&str`. `unsafe` should not be /// Note: This example shows the internals of `&str`. `unsafe` should not be
/// used to get a string slice under normal circumstances. Use `.as_slice()` /// used to get a string slice under normal circumstances. Use `.as_slice()`

View file

@ -52,7 +52,7 @@
//! If an application does not have `getrandom` and likely to be run soon after first booting, //! If an application does not have `getrandom` and likely to be run soon after first booting,
//! or on a system with very few entropy sources, one should consider using `/dev/random` via //! or on a system with very few entropy sources, one should consider using `/dev/random` via
//! `ReaderRng`. //! `ReaderRng`.
//! - On some systems (e.g. FreeBSD, OpenBSD and Mac OS X) there is no difference //! - On some systems (e.g. FreeBSD, OpenBSD and macOS) there is no difference
//! between the two sources. (Also note that, on some systems e.g. FreeBSD, both `/dev/random` //! between the two sources. (Also note that, on some systems e.g. FreeBSD, both `/dev/random`
//! and `/dev/urandom` may block once if the CSPRNG has not seeded yet.) //! and `/dev/urandom` may block once if the CSPRNG has not seeded yet.)
@ -195,7 +195,7 @@ impl Rng for ThreadRng {
/// A random number generator that retrieves randomness straight from /// A random number generator that retrieves randomness straight from
/// the operating system. Platform sources: /// the operating system. Platform sources:
/// ///
/// - Unix-like systems (Linux, Android, Mac OSX): read directly from /// - Unix-like systems (Linux, Android, macOS): read directly from
/// `/dev/urandom`, or from `getrandom(2)` system call if available. /// `/dev/urandom`, or from `getrandom(2)` system call if available.
/// - Windows: calls `CryptGenRandom`, using the default cryptographic /// - Windows: calls `CryptGenRandom`, using the default cryptographic
/// service provider with the `PROV_RSA_FULL` type. /// service provider with the `PROV_RSA_FULL` type.

View file

@ -34,7 +34,7 @@ fn lang_start(main: *const u8, argc: isize, argv: *const *const u8) -> isize {
use panic; use panic;
use sys; use sys;
use sys_common; use sys_common;
use sys_common::thread_info::{self, NewThread}; use sys_common::thread_info;
use thread::Thread; use thread::Thread;
sys::init(); sys::init();
@ -47,7 +47,7 @@ fn lang_start(main: *const u8, argc: isize, argv: *const *const u8) -> isize {
// created. Note that this isn't necessary in general for new threads, // created. Note that this isn't necessary in general for new threads,
// but we just do this to name the main thread and to give it correct // but we just do this to name the main thread and to give it correct
// info about the stack bounds. // info about the stack bounds.
let thread: Thread = NewThread::new(Some("main".to_owned())); let thread = Thread::new(Some("main".to_owned()));
thread_info::set(main_guard, thread); thread_info::set(main_guard, thread);
// Store our args if necessary in a squirreled away location // Store our args if necessary in a squirreled away location

View file

@ -52,10 +52,10 @@ struct BarrierState {
/// A result returned from wait. /// A result returned from wait.
/// ///
/// Currently this opaque structure only has one method, [`.is_leader()`]. Only /// Currently this opaque structure only has one method, [`.is_leader`]. Only
/// one thread will receive a result that will return `true` from this function. /// one thread will receive a result that will return `true` from this function.
/// ///
/// [`.is_leader()`]: #method.is_leader /// [`.is_leader`]: #method.is_leader
/// ///
/// # Examples /// # Examples
/// ///

View file

@ -150,7 +150,7 @@ impl Condvar {
/// ///
/// This function will atomically unlock the mutex specified (represented by /// This function will atomically unlock the mutex specified (represented by
/// `guard`) and block the current thread. This means that any calls /// `guard`) and block the current thread. This means that any calls
/// to [`notify_one()`] or [`notify_all()`] which happen logically after the /// to [`notify_one`] or [`notify_all`] which happen logically after the
/// mutex is unlocked are candidates to wake this thread up. When this /// mutex is unlocked are candidates to wake this thread up. When this
/// function call returns, the lock specified will have been re-acquired. /// function call returns, the lock specified will have been re-acquired.
/// ///
@ -167,16 +167,16 @@ impl Condvar {
/// ///
/// # Panics /// # Panics
/// ///
/// This function will [`panic!()`] if it is used with more than one mutex /// This function will [`panic!`] if it is used with more than one mutex
/// over time. Each condition variable is dynamically bound to exactly one /// over time. Each condition variable is dynamically bound to exactly one
/// mutex to ensure defined behavior across platforms. If this functionality /// mutex to ensure defined behavior across platforms. If this functionality
/// is not desired, then unsafe primitives in `sys` are provided. /// is not desired, then unsafe primitives in `sys` are provided.
/// ///
/// [`notify_one()`]: #method.notify_one /// [`notify_one`]: #method.notify_one
/// [`notify_all()`]: #method.notify_all /// [`notify_all`]: #method.notify_all
/// [poisoning]: ../sync/struct.Mutex.html#poisoning /// [poisoning]: ../sync/struct.Mutex.html#poisoning
/// [`Mutex`]: ../sync/struct.Mutex.html /// [`Mutex`]: ../sync/struct.Mutex.html
/// [`panic!()`]: ../../std/macro.panic.html /// [`panic!`]: ../../std/macro.panic.html
/// ///
/// # Examples /// # Examples
/// ///
@ -359,11 +359,11 @@ impl Condvar {
/// be woken up from its call to [`wait`] or [`wait_timeout`]. Calls to /// be woken up from its call to [`wait`] or [`wait_timeout`]. Calls to
/// `notify_one` are not buffered in any way. /// `notify_one` are not buffered in any way.
/// ///
/// To wake up all threads, see [`notify_all()`]. /// To wake up all threads, see [`notify_all`].
/// ///
/// [`wait`]: #method.wait /// [`wait`]: #method.wait
/// [`wait_timeout`]: #method.wait_timeout /// [`wait_timeout`]: #method.wait_timeout
/// [`notify_all()`]: #method.notify_all /// [`notify_all`]: #method.notify_all
/// ///
/// # Examples /// # Examples
/// ///
@ -401,9 +401,9 @@ impl Condvar {
/// variable are awoken. Calls to `notify_all()` are not buffered in any /// variable are awoken. Calls to `notify_all()` are not buffered in any
/// way. /// way.
/// ///
/// To wake up only one thread, see [`notify_one()`]. /// To wake up only one thread, see [`notify_one`].
/// ///
/// [`notify_one()`]: #method.notify_one /// [`notify_one`]: #method.notify_one
/// ///
/// # Examples /// # Examples
/// ///

View file

@ -460,10 +460,10 @@ impl<T> UnsafeFlavor<T> for Receiver<T> {
/// All data sent on the sender will become available on the receiver, and no /// All data sent on the sender will become available on the receiver, and no
/// send will block the calling thread (this channel has an "infinite buffer"). /// send will block the calling thread (this channel has an "infinite buffer").
/// ///
/// If the [`Receiver`] is disconnected while trying to [`send()`] with the /// If the [`Receiver`] is disconnected while trying to [`send`] with the
/// [`Sender`], the [`send()`] method will return an error. /// [`Sender`], the [`send`] method will return an error.
/// ///
/// [`send()`]: ../../../std/sync/mpsc/struct.Sender.html#method.send /// [`send`]: ../../../std/sync/mpsc/struct.Sender.html#method.send
/// [`Sender`]: ../../../std/sync/mpsc/struct.Sender.html /// [`Sender`]: ../../../std/sync/mpsc/struct.Sender.html
/// [`Receiver`]: ../../../std/sync/mpsc/struct.Receiver.html /// [`Receiver`]: ../../../std/sync/mpsc/struct.Receiver.html
/// ///
@ -504,13 +504,13 @@ pub fn channel<T>() -> (Sender<T>, Receiver<T>) {
/// `bound` specifies the buffer size. When the internal buffer becomes full, /// `bound` specifies the buffer size. When the internal buffer becomes full,
/// future sends will *block* waiting for the buffer to open up. Note that a /// future sends will *block* waiting for the buffer to open up. Note that a
/// buffer size of 0 is valid, in which case this becomes "rendezvous channel" /// buffer size of 0 is valid, in which case this becomes "rendezvous channel"
/// where each [`send()`] will not return until a recv is paired with it. /// where each [`send`] will not return until a recv is paired with it.
/// ///
/// Like asynchronous channels, if the [`Receiver`] is disconnected while /// Like asynchronous channels, if the [`Receiver`] is disconnected while
/// trying to [`send()`] with the [`SyncSender`], the [`send()`] method will /// trying to [`send`] with the [`SyncSender`], the [`send`] method will
/// return an error. /// return an error.
/// ///
/// [`send()`]: ../../../std/sync/mpsc/struct.SyncSender.html#method.send /// [`send`]: ../../../std/sync/mpsc/struct.SyncSender.html#method.send
/// [`SyncSender`]: ../../../std/sync/mpsc/struct.SyncSender.html /// [`SyncSender`]: ../../../std/sync/mpsc/struct.SyncSender.html
/// [`Receiver`]: ../../../std/sync/mpsc/struct.Receiver.html /// [`Receiver`]: ../../../std/sync/mpsc/struct.Receiver.html
/// ///

View file

@ -135,13 +135,13 @@ unsafe impl<T: ?Sized + Send> Sync for Mutex<T> { }
/// The data protected by the mutex can be access through this guard via its /// The data protected by the mutex can be access through this guard via its
/// [`Deref`] and [`DerefMut`] implementations. /// [`Deref`] and [`DerefMut`] implementations.
/// ///
/// This structure is created by the [`lock()`] and [`try_lock()`] methods on /// This structure is created by the [`lock`] and [`try_lock`] methods on
/// [`Mutex`]. /// [`Mutex`].
/// ///
/// [`Deref`]: ../../std/ops/trait.Deref.html /// [`Deref`]: ../../std/ops/trait.Deref.html
/// [`DerefMut`]: ../../std/ops/trait.DerefMut.html /// [`DerefMut`]: ../../std/ops/trait.DerefMut.html
/// [`lock()`]: struct.Mutex.html#method.lock /// [`lock`]: struct.Mutex.html#method.lock
/// [`try_lock()`]: struct.Mutex.html#method.try_lock /// [`try_lock`]: struct.Mutex.html#method.try_lock
/// [`Mutex`]: struct.Mutex.html /// [`Mutex`]: struct.Mutex.html
#[must_use] #[must_use]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]

View file

@ -78,11 +78,11 @@ unsafe impl<T: ?Sized + Send + Sync> Sync for RwLock<T> {}
/// RAII structure used to release the shared read access of a lock when /// RAII structure used to release the shared read access of a lock when
/// dropped. /// dropped.
/// ///
/// This structure is created by the [`read()`] and [`try_read()`] methods on /// This structure is created by the [`read`] and [`try_read`] methods on
/// [`RwLock`]. /// [`RwLock`].
/// ///
/// [`read()`]: struct.RwLock.html#method.read /// [`read`]: struct.RwLock.html#method.read
/// [`try_read()`]: struct.RwLock.html#method.try_read /// [`try_read`]: struct.RwLock.html#method.try_read
/// [`RwLock`]: struct.RwLock.html /// [`RwLock`]: struct.RwLock.html
#[must_use] #[must_use]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@ -96,11 +96,11 @@ impl<'a, T: ?Sized> !marker::Send for RwLockReadGuard<'a, T> {}
/// RAII structure used to release the exclusive write access of a lock when /// RAII structure used to release the exclusive write access of a lock when
/// dropped. /// dropped.
/// ///
/// This structure is created by the [`write()`] and [`try_write()`] methods /// This structure is created by the [`write`] and [`try_write`] methods
/// on [`RwLock`]. /// on [`RwLock`].
/// ///
/// [`write()`]: struct.RwLock.html#method.write /// [`write`]: struct.RwLock.html#method.write
/// [`try_write()`]: struct.RwLock.html#method.try_write /// [`try_write`]: struct.RwLock.html#method.try_write
/// [`RwLock`]: struct.RwLock.html /// [`RwLock`]: struct.RwLock.html
#[must_use] #[must_use]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]

View file

@ -96,17 +96,17 @@ pub unsafe extern fn destroy_value<T>(ptr: *mut u8) {
// `None`. // `None`.
(*ptr).dtor_running.set(true); (*ptr).dtor_running.set(true);
// The OSX implementation of TLS apparently had an odd aspect to it // The macOS implementation of TLS apparently had an odd aspect to it
// where the pointer we have may be overwritten while this destructor // where the pointer we have may be overwritten while this destructor
// is running. Specifically if a TLS destructor re-accesses TLS it may // is running. Specifically if a TLS destructor re-accesses TLS it may
// trigger a re-initialization of all TLS variables, paving over at // trigger a re-initialization of all TLS variables, paving over at
// least some destroyed ones with initial values. // least some destroyed ones with initial values.
// //
// This means that if we drop a TLS value in place on OSX that we could // This means that if we drop a TLS value in place on macOS that we could
// revert the value to its original state halfway through the // revert the value to its original state halfway through the
// destructor, which would be bad! // destructor, which would be bad!
// //
// Hence, we use `ptr::read` on OSX (to move to a "safe" location) // Hence, we use `ptr::read` on macOS (to move to a "safe" location)
// instead of drop_in_place. // instead of drop_in_place.
if cfg!(target_os = "macos") { if cfg!(target_os = "macos") {
ptr::read((*ptr).inner.get()); ptr::read((*ptr).inner.get());

View file

@ -249,7 +249,7 @@ impl Command {
// mutex, and then after the fork they unlock it. // mutex, and then after the fork they unlock it.
// //
// Despite this information, libnative's spawn has been witnessed to // Despite this information, libnative's spawn has been witnessed to
// deadlock on both OSX and FreeBSD. I'm not entirely sure why, but // deadlock on both macOS and FreeBSD. I'm not entirely sure why, but
// all collected backtraces point at malloc/free traffic in the // all collected backtraces point at malloc/free traffic in the
// child spawned process. // child spawned process.
// //

View file

@ -13,7 +13,7 @@
/// Some methods of getting a backtrace: /// Some methods of getting a backtrace:
/// ///
/// * The backtrace() functions on unix. It turns out this doesn't work very /// * The backtrace() functions on unix. It turns out this doesn't work very
/// well for green threads on OSX, and the address to symbol portion of it /// well for green threads on macOS, and the address to symbol portion of it
/// suffers problems that are described below. /// suffers problems that are described below.
/// ///
/// * Using libunwind. This is more difficult than it sounds because libunwind /// * Using libunwind. This is more difficult than it sounds because libunwind
@ -51,9 +51,9 @@
/// ///
/// * Use dladdr(). The original backtrace()-based idea actually uses dladdr() /// * Use dladdr(). The original backtrace()-based idea actually uses dladdr()
/// behind the scenes to translate, and this is why backtrace() was not used. /// behind the scenes to translate, and this is why backtrace() was not used.
/// Conveniently, this method works fantastically on OSX. It appears dladdr() /// Conveniently, this method works fantastically on macOS. It appears dladdr()
/// uses magic to consult the local symbol table, or we're putting everything /// uses magic to consult the local symbol table, or we're putting everything
/// in the dynamic symbol table anyway. Regardless, for OSX, this is the /// in the dynamic symbol table anyway. Regardless, for macOS, this is the
/// method used for translation. It's provided by the system and easy to do.o /// method used for translation. It's provided by the system and easy to do.o
/// ///
/// Sadly, all other systems have a dladdr() implementation that does not /// Sadly, all other systems have a dladdr() implementation that does not
@ -75,7 +75,7 @@
/// * Use `libbacktrace`. It turns out that this is a small library bundled in /// * Use `libbacktrace`. It turns out that this is a small library bundled in
/// the gcc repository which provides backtrace and symbol translation /// the gcc repository which provides backtrace and symbol translation
/// functionality. All we really need from it is the backtrace functionality, /// functionality. All we really need from it is the backtrace functionality,
/// and we only really need this on everything that's not OSX, so this is the /// and we only really need this on everything that's not macOS, so this is the
/// chosen route for now. /// chosen route for now.
/// ///
/// In summary, the current situation uses libgcc_s to get a trace of stack /// In summary, the current situation uses libgcc_s to get a trace of stack

View file

@ -204,7 +204,7 @@ impl SocketAddr {
let len = self.len as usize - sun_path_offset(); let len = self.len as usize - sun_path_offset();
let path = unsafe { mem::transmute::<&[libc::c_char], &[u8]>(&self.addr.sun_path) }; let path = unsafe { mem::transmute::<&[libc::c_char], &[u8]>(&self.addr.sun_path) };
// OSX seems to return a len of 16 and a zeroed sun_path for unnamed addresses // macOS seems to return a len of 16 and a zeroed sun_path for unnamed addresses
if len == 0 || (cfg!(not(target_os = "linux")) && self.addr.sun_path[0] == 0) { if len == 0 || (cfg!(not(target_os = "linux")) && self.addr.sun_path[0] == 0) {
AddressKind::Unnamed AddressKind::Unnamed
} else if self.addr.sun_path[0] == 0 { } else if self.addr.sun_path[0] == 0 {
@ -375,12 +375,12 @@ impl UnixStream {
/// Sets the read timeout for the socket. /// Sets the read timeout for the socket.
/// ///
/// If the provided value is [`None`], then [`read()`] calls will block /// If the provided value is [`None`], then [`read`] calls will block
/// indefinitely. It is an error to pass the zero [`Duration`] to this /// indefinitely. It is an error to pass the zero [`Duration`] to this
/// method. /// method.
/// ///
/// [`None`]: ../../../../std/option/enum.Option.html#variant.None /// [`None`]: ../../../../std/option/enum.Option.html#variant.None
/// [`read()`]: ../../../../std/io/trait.Read.html#tymethod.read /// [`read`]: ../../../../std/io/trait.Read.html#tymethod.read
/// [`Duration`]: ../../../../std/time/struct.Duration.html /// [`Duration`]: ../../../../std/time/struct.Duration.html
/// ///
/// # Examples /// # Examples
@ -399,12 +399,12 @@ impl UnixStream {
/// Sets the write timeout for the socket. /// Sets the write timeout for the socket.
/// ///
/// If the provided value is [`None`], then [`write()`] calls will block /// If the provided value is [`None`], then [`write`] calls will block
/// indefinitely. It is an error to pass the zero [`Duration`] to this /// indefinitely. It is an error to pass the zero [`Duration`] to this
/// method. /// method.
/// ///
/// [`None`]: ../../../../std/option/enum.Option.html#variant.None /// [`None`]: ../../../../std/option/enum.Option.html#variant.None
/// [`read()`]: ../../../../std/io/trait.Write.html#tymethod.write /// [`read`]: ../../../../std/io/trait.Write.html#tymethod.write
/// [`Duration`]: ../../../../std/time/struct.Duration.html /// [`Duration`]: ../../../../std/time/struct.Duration.html
/// ///
/// # Examples /// # Examples
@ -974,12 +974,12 @@ impl UnixDatagram {
/// Connects the socket to the specified address. /// Connects the socket to the specified address.
/// ///
/// The [`send()`] method may be used to send data to the specified address. /// The [`send`] method may be used to send data to the specified address.
/// [`recv()`] and [`recv_from()`] will only receive data from that address. /// [`recv`] and [`recv_from`] will only receive data from that address.
/// ///
/// [`send()`]: #method.send /// [`send`]: #method.send
/// [`recv()`]: #method.recv /// [`recv`]: #method.recv
/// [`recv_from()`]: #method.recv_from /// [`recv_from`]: #method.recv_from
/// ///
/// # Examples /// # Examples
/// ///
@ -1047,9 +1047,9 @@ impl UnixDatagram {
/// Returns the address of this socket's peer. /// Returns the address of this socket's peer.
/// ///
/// The [`connect()`] method will connect the socket to a peer. /// The [`connect`] method will connect the socket to a peer.
/// ///
/// [`connect()`]: #method.connect /// [`connect`]: #method.connect
/// ///
/// # Examples /// # Examples
/// ///
@ -1178,13 +1178,13 @@ impl UnixDatagram {
/// Sets the read timeout for the socket. /// Sets the read timeout for the socket.
/// ///
/// If the provided value is [`None`], then [`recv()`] and [`recv_from()`] calls will /// If the provided value is [`None`], then [`recv`] and [`recv_from`] calls will
/// block indefinitely. It is an error to pass the zero [`Duration`] to this /// block indefinitely. It is an error to pass the zero [`Duration`] to this
/// method. /// method.
/// ///
/// [`None`]: ../../../../std/option/enum.Option.html#variant.None /// [`None`]: ../../../../std/option/enum.Option.html#variant.None
/// [`recv()`]: #method.recv /// [`recv`]: #method.recv
/// [`recv_from()`]: #method.recv_from /// [`recv_from`]: #method.recv_from
/// [`Duration`]: ../../../../std/time/struct.Duration.html /// [`Duration`]: ../../../../std/time/struct.Duration.html
/// ///
/// # Examples /// # Examples
@ -1203,13 +1203,13 @@ impl UnixDatagram {
/// Sets the write timeout for the socket. /// Sets the write timeout for the socket.
/// ///
/// If the provided value is [`None`], then [`send()`] and [`send_to()`] calls will /// If the provided value is [`None`], then [`send`] and [`send_to`] calls will
/// block indefinitely. It is an error to pass the zero [`Duration`] to this /// block indefinitely. It is an error to pass the zero [`Duration`] to this
/// method. /// method.
/// ///
/// [`None`]: ../../../../std/option/enum.Option.html#variant.None /// [`None`]: ../../../../std/option/enum.Option.html#variant.None
/// [`send()`]: #method.send /// [`send`]: #method.send
/// [`send_to()`]: #method.send_to /// [`send_to`]: #method.send_to
/// [`Duration`]: ../../../../std/time/struct.Duration.html /// [`Duration`]: ../../../../std/time/struct.Duration.html
/// ///
/// # Examples /// # Examples

Some files were not shown because too many files have changed in this diff Show more