diff options
| author | bors <bors@rust-lang.org> | 2015-08-18 20:13:44 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-08-18 20:13:44 +0000 |
| commit | 1d72d314480d3437345129ddf8b299c36e048f18 (patch) | |
| tree | eb7d5260676adafcd3e0b32be0da49b7e37d9993 | |
| parent | 6c11e4a48ec3ac385f32da1879384bc6921bdf75 (diff) | |
| parent | 101ebe0bb05cc93939a3b57cbfd91f2a765dc9c4 (diff) | |
| download | rust-1d72d314480d3437345129ddf8b299c36e048f18.tar.gz rust-1d72d314480d3437345129ddf8b299c36e048f18.zip | |
Auto merge of #27891 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #27881, #27882, #27883, #27884, #27888 - Failed merges:
| -rw-r--r-- | README.md | 22 | ||||
| -rw-r--r-- | man/rustc.1 | 5 | ||||
| -rw-r--r-- | src/doc/reference.md | 5 | ||||
| -rw-r--r-- | src/doc/trpl/functions.md | 58 | ||||
| -rw-r--r-- | src/libcollections/binary_heap.rs | 2 |
5 files changed, 85 insertions, 7 deletions
diff --git a/README.md b/README.md index 0ae93380e59..391ada0efef 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,28 @@ Read ["Installing Rust"] from [The Book]. $ make && make install ``` +## Building Documentation + +If you’d like to build the documentation, it’s almost the same: + +```sh +./configure +$ make docs +``` + +Building the documentation requires building the compiler, so the above +details will apply. Once you have the compiler built, you can + +```sh +$ make docs NO_REBUILD=1 +``` + +To make sure you don’t re-build the compiler because you made a change +to some documentation. + +The generated documentation will appear in a top-level `doc` directory, +created by the `make` rule. + ## Notes Since the Rust compiler is written in Rust, it must be built by a diff --git a/man/rustc.1 b/man/rustc.1 index 0cb1c5dc32b..3ac79ecae64 100644 --- a/man/rustc.1 +++ b/man/rustc.1 @@ -41,7 +41,7 @@ look for anything here (the default) .RE .TP \fB\-l\fR [\fIKIND\fR=]\fINAME\fR -Link the generated crate(s) to the specified native library \fINAME\fR. +Link the generated crate(s) to the specified library \fINAME\fR. The optional \fIKIND\fR can be one of \fIstatic\fR, \fIdylib\fR, or \fIframework\fR. If omitted, \fIdylib\fR is assumed. @@ -113,7 +113,8 @@ Print version info and exit. Use verbose output. .TP \fB\-\-extern\fR \fINAME\fR=\fIPATH\fR -Specify where an external rust library is located. +Specify where an external rust library is located. These should match +\fIextern\fR declarations in the crate's source code. .TP \fB\-\-sysroot\fR \fIPATH\fR Override the system root. diff --git a/src/doc/reference.md b/src/doc/reference.md index 4d5564d9faf..b4dec8f1fef 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -2059,6 +2059,11 @@ The following configurations must be defined by the implementation: `"mips"`, `"powerpc"`, `"arm"`, or `"aarch64"`. * `target_endian = "..."`. Endianness of the target CPU, either `"little"` or `"big"`. +* `target_env = ".."` - an option provided by the compiler by default + describing the runtime environment of the target platform. Some examples of + this are `musl` for builds targeting the MUSL libc implementation, `msvc` for + Windows builds targeting MSVC, and `gnu` frequently the rest of the time. This + option may also be blank on some platforms. * `target_family = "..."`. Operating system family of the target, e. g. `"unix"` or `"windows"`. The value of this configuration option is defined as a configuration itself, like `unix` or `windows`. diff --git a/src/doc/trpl/functions.md b/src/doc/trpl/functions.md index 5b29965efc6..84cea5dabc3 100644 --- a/src/doc/trpl/functions.md +++ b/src/doc/trpl/functions.md @@ -214,11 +214,61 @@ fn diverges() -> ! { `panic!` is a macro, similar to `println!()` that we’ve already seen. Unlike `println!()`, `panic!()` causes the current thread of execution to crash with -the given message. +the given message. Because this function will cause a crash, it will never +return, and so it has the type ‘`!`’, which is read ‘diverges’. -Because this function will cause a crash, it will never return, and so it has -the type ‘`!`’, which is read ‘diverges’. A diverging function can be used -as any type: +If you add a main function that calls `diverges()` and run it, you’ll get +some output that looks like this: + +```text +thread ‘<main>’ panicked at ‘This function never returns!’, hello.rs:2 +``` + +If you want more information, you can get a backtrace by setting the +`RUST_BACKTRACE` environment variable: + +```text +$ RUST_BACKTRACE=1 ./diverges +thread '<main>' panicked at 'This function never returns!', hello.rs:2 +stack backtrace: + 1: 0x7f402773a829 - sys::backtrace::write::h0942de78b6c02817K8r + 2: 0x7f402773d7fc - panicking::on_panic::h3f23f9d0b5f4c91bu9w + 3: 0x7f402773960e - rt::unwind::begin_unwind_inner::h2844b8c5e81e79558Bw + 4: 0x7f4027738893 - rt::unwind::begin_unwind::h4375279447423903650 + 5: 0x7f4027738809 - diverges::h2266b4c4b850236beaa + 6: 0x7f40277389e5 - main::h19bb1149c2f00ecfBaa + 7: 0x7f402773f514 - rt::unwind::try::try_fn::h13186883479104382231 + 8: 0x7f402773d1d8 - __rust_try + 9: 0x7f402773f201 - rt::lang_start::ha172a3ce74bb453aK5w + 10: 0x7f4027738a19 - main + 11: 0x7f402694ab44 - __libc_start_main + 12: 0x7f40277386c8 - <unknown> + 13: 0x0 - <unknown> +``` + +`RUST_BACKTRACE` also works with Cargo’s `run` command: + +```text +$ RUST_BACKTRACE=1 cargo run + Running `target/debug/diverges` +thread '<main>' panicked at 'This function never returns!', hello.rs:2 +stack backtrace: + 1: 0x7f402773a829 - sys::backtrace::write::h0942de78b6c02817K8r + 2: 0x7f402773d7fc - panicking::on_panic::h3f23f9d0b5f4c91bu9w + 3: 0x7f402773960e - rt::unwind::begin_unwind_inner::h2844b8c5e81e79558Bw + 4: 0x7f4027738893 - rt::unwind::begin_unwind::h4375279447423903650 + 5: 0x7f4027738809 - diverges::h2266b4c4b850236beaa + 6: 0x7f40277389e5 - main::h19bb1149c2f00ecfBaa + 7: 0x7f402773f514 - rt::unwind::try::try_fn::h13186883479104382231 + 8: 0x7f402773d1d8 - __rust_try + 9: 0x7f402773f201 - rt::lang_start::ha172a3ce74bb453aK5w + 10: 0x7f4027738a19 - main + 11: 0x7f402694ab44 - __libc_start_main + 12: 0x7f40277386c8 - <unknown> + 13: 0x0 - <unknown> +``` + +A diverging function can be used as any type: ```should_panic # fn diverges() -> ! { diff --git a/src/libcollections/binary_heap.rs b/src/libcollections/binary_heap.rs index b817ed6a6d0..bedeab67420 100644 --- a/src/libcollections/binary_heap.rs +++ b/src/libcollections/binary_heap.rs @@ -112,7 +112,7 @@ //! // 7 //! // +-----------------+ //! // | | -//! // v 1 2 | +//! // v 1 2 | 2 //! // 0 -----> 1 -----> 3 ---> 4 //! // | ^ ^ ^ //! // | | 1 | | |
