From 8b6d2d1a22b96512b88958915ff656c48f318f1f Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Wed, 19 May 2021 12:02:05 -0700 Subject: [PATCH] Fix some links. --- .github/workflows/main.yml | 2 +- book.toml | 172 +++++++++++++++++----------------- src/rust-2018/new-keywords.md | 6 +- src/rust-2018/path-changes.md | 36 +++++-- 4 files changed, 119 insertions(+), 97 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2fe67600..27a9336a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,7 +17,7 @@ jobs: - name: Install mdbook run: | mkdir bin - curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.3.5/mdbook-v0.3.5-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin + curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.7/mdbook-v0.4.7-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin echo "$(pwd)/bin" >> $GITHUB_PATH - name: Report versions run: | diff --git a/book.toml b/book.toml index 2c48ed04..8d8b2632 100644 --- a/book.toml +++ b/book.toml @@ -8,89 +8,89 @@ title = "The Edition Guide" git-repository-url = "https://github.com/rust-lang/edition-guide" [output.html.redirect] -"/rust-2018/edition-changes.html" = "/rust-2018/index.html" -"/rust-2018/module-system/index.html" = "/rust-2018/path-changes.html" -"/rust-2018/module-system/raw-identifiers.html" = "/rust-2018/path-changes.html" -"/rust-2018/module-system/path-clarity.html" = "/rust-2018/path-changes.html" -"/rust-2018/module-system/more-visibility-modifiers.html" = "/rust-2018/path-changes.html" -"/rust-2018/module-system/nested-imports-with-use.html" = "/rust-2018/path-changes.html" -"/rust-2018/error-handling-and-panics/index.html" = "/rust-2018/index.html" -"/rust-2018/error-handling-and-panics/the-question-mark-operator-for-easier-error-handling.html" = "/rust-2018/index.html" -"/rust-2018/error-handling-and-panics/question-mark-in-main-and-tests.html" = "/rust-2018/index.html" -"/rust-2018/error-handling-and-panics/controlling-panics-with-std-panic.html" = "/rust-2018/index.html" -"/rust-2018/error-handling-and-panics/aborting-on-panic.html" = "/rust-2018/index.html" -"/rust-2018/control-flow/index.html" = "/rust-2018/index.html" -"/rust-2018/control-flow/loops-can-break-with-a-value.html" = "/rust-2018/index.html" -"/rust-2018/control-flow/async-await-for-easier-concurrency.html" = "/rust-2018/index.html" -"/rust-2018/trait-system/index.html" = "/rust-2018/index.html" -"/rust-2018/trait-system/impl-trait-for-returning-complex-types-with-ease.html" = "/rust-2018/index.html" -"/rust-2018/trait-system/dyn-trait-for-trait-objects.html" = "/rust-2018/index.html" -"/rust-2018/trait-system/more-container-types-support-trait-objects.html" = "/rust-2018/index.html" -"/rust-2018/trait-system/associated-constants.html" = "/rust-2018/index.html" -"/rust-2018/trait-system/no-anon-params.html" = "/rust-2018/index.html" -"/rust-2018/slice-patterns.html" = "/rust-2018/index.html" -"/rust-2018/ownership-and-lifetimes/index.html" = "/rust-2018/index.html" -"/rust-2018/ownership-and-lifetimes/non-lexical-lifetimes.html" = "/rust-2018/index.html" -"/rust-2018/ownership-and-lifetimes/default-match-bindings.html" = "/rust-2018/index.html" -"/rust-2018/ownership-and-lifetimes/the-anonymous-lifetime.html" = "/rust-2018/index.html" -"/rust-2018/ownership-and-lifetimes/lifetime-elision-in-impl.html" = "/rust-2018/index.html" -"/rust-2018/ownership-and-lifetimes/inference-in-structs.html" = "/rust-2018/index.html" -"/rust-2018/ownership-and-lifetimes/simpler-lifetimes-in-static-and-const.html" = "/rust-2018/index.html" -"/rust-2018/data-types/index.html" = "/rust-2018/index.html" -"/rust-2018/data-types/field-init-shorthand.html" = "/rust-2018/index.html" -"/rust-2018/data-types/inclusive-ranges.html" = "/rust-2018/index.html" -"/rust-2018/data-types/128-bit-integers.html" = "/rust-2018/index.html" -"/rust-2018/data-types/operator-equals-are-now-implementable.html" = "/rust-2018/index.html" -"/rust-2018/data-types/union-for-an-unsafe-form-of-enum.html" = "/rust-2018/index.html" -"/rust-2018/data-types/choosing-alignment-with-the-repr-attribute.html" = "/rust-2018/index.html" -"/rust-2018/simd-for-faster-computing.html" = "/rust-2018/index.html" -"/rust-2018/macros/index.html" = "/rust-2018/index.html" -"/rust-2018/macros/custom-derive.html" = "/rust-2018/index.html" -"/rust-2018/macros/macro-changes.html" = "/rust-2018/index.html" -"/rust-2018/macros/at-most-once.html" = "/rust-2018/index.html" -"/rust-2018/the-compiler/index.html" = "/rust-2018/index.html" -"/rust-2018/the-compiler/improved-error-messages.html" = "/rust-2018/index.html" -"/rust-2018/the-compiler/incremental-compilation-for-faster-compiles.html" = "/rust-2018/index.html" -"/rust-2018/the-compiler/an-attribute-for-deprecation.html" = "/rust-2018/index.html" -"/rust-2018/rustup-for-managing-rust-versions.html" = "/rust-2018/index.html" -"/rust-2018/cargo-and-crates-io/index.html" = "/rust-2018/cargo.html" -"/rust-2018/cargo-and-crates-io/cargo-check-for-faster-checking.html" = "/rust-2018/cargo.html" -"/rust-2018/cargo-and-crates-io/cargo-install-for-easy-installation-of-tools.html" = "/rust-2018/cargo.html" -"/rust-2018/cargo-and-crates-io/cargo-new-defaults-to-a-binary-project.html" = "/rust-2018/cargo.html" -"/rust-2018/cargo-and-crates-io/cargo-rustc-for-passing-arbitrary-flags-to-rustc.html" = "/rust-2018/cargo.html" -"/rust-2018/cargo-and-crates-io/cargo-workspaces-for-multi-package-projects.html" = "/rust-2018/cargo.html" -"/rust-2018/cargo-and-crates-io/multi-file-examples.html" = "/rust-2018/cargo.html" -"/rust-2018/cargo-and-crates-io/replacing-dependencies-with-patch.html" = "/rust-2018/cargo.html" -"/rust-2018/cargo-and-crates-io/cargo-can-use-a-local-registry-replacement.html" = "/rust-2018/cargo.html" -"/rust-2018/cargo-and-crates-io/crates-io-disallows-wildcard-dependencies.html" = "/rust-2018/cargo.html" -"/rust-2018/documentation/index.html" = "/rust-2018/index.html" -"/rust-2018/documentation/new-editions-of-the-book.html" = "/rust-2018/index.html" -"/rust-2018/documentation/the-rust-bookshelf.html" = "/rust-2018/index.html" -"/rust-2018/documentation/the-rustonomicon.html" = "/rust-2018/index.html" -"/rust-2018/documentation/std-os-has-documentation-for-all-platforms.html" = "/rust-2018/index.html" -"/rust-2018/rustdoc/index.html" = "/rust-2018/index.html" -"/rust-2018/rustdoc/documentation-tests-can-now-compile-fail.html" = "/rust-2018/index.html" -"/rust-2018/rustdoc/rustdoc-uses-commonmark.html" = "/rust-2018/index.html" -"/rust-2018/platform-and-target-support/index.html" = "/rust-2018/index.html" -"/rust-2018/platform-and-target-support/libcore-for-low-level-rust.html" = "/rust-2018/index.html" -"/rust-2018/platform-and-target-support/webassembly-support.html" = "/rust-2018/index.html" -"/rust-2018/platform-and-target-support/global-allocators.html" = "/rust-2018/index.html" -"/rust-2018/platform-and-target-support/msvc-toolchain-support.html" = "/rust-2018/index.html" -"/rust-2018/platform-and-target-support/musl-support-for-fully-static-binaries.html" = "/rust-2018/index.html" -"/rust-2018/platform-and-target-support/cdylib-crates-for-c-interoperability.html" = "/rust-2018/index.html" -"/rust-next/index.html" = "/rust-2021/index.html" -"/rust-next/edition-changes.html" = "/rust-2021/index.html" -"/rust-next/dbg-macro.html" = "/rust-2021/index.html" -"/rust-next/no-jemalloc.html" = "/rust-2021/index.html" -"/rust-next/uniform-paths.html" = "/rust-2021/index.html" -"/rust-next/literal-macro-matcher.html" = "/rust-2021/index.html" -"/rust-next/qustion-mark-operator-in-macros.html" = "/rust-2021/index.html" -"/rust-next/const-fn.html" = "/rust-2021/index.html" -"/rust-next/pin.html" = "/rust-2021/index.html" -"/rust-next/no-more-fnbox.html" = "/rust-2021/index.html" -"/rust-next/alternative-cargo-registries.html" = "/rust-2021/index.html" -"/rust-next/tryfrom-and-tryinto.html" = "/rust-2021/index.html" -"/rust-next/future.html" = "/rust-2021/index.html" -"/rust-next/alloc.html" = "/rust-2021/index.html" -"/rust-next/maybe-uninit.html" = "/rust-2021/index.html" -"/rust-next/cargo-vendor.html" = "/rust-2021/index.html" +"/rust-2018/edition-changes.html" = "index.html" +"/rust-2018/module-system/index.html" = "../path-changes.html" +"/rust-2018/module-system/raw-identifiers.html" = "../../../rust-by-example/compatibility/raw_identifiers.html" +"/rust-2018/module-system/path-clarity.html" = "../path-changes.html" +"/rust-2018/module-system/more-visibility-modifiers.html" = "../../../reference/visibility-and-privacy.html" +"/rust-2018/module-system/nested-imports-with-use.html" = "../../../rust-by-example/mod/use.html" +"/rust-2018/error-handling-and-panics/index.html" = "../../../book/ch09-00-error-handling.html" +"/rust-2018/error-handling-and-panics/the-question-mark-operator-for-easier-error-handling.html" = "../../../book/ch09-02-recoverable-errors-with-result.html" +"/rust-2018/error-handling-and-panics/question-mark-in-main-and-tests.html" = "../../../rust-by-example/error/result.html#using-result-in-main" +"/rust-2018/error-handling-and-panics/controlling-panics-with-std-panic.html" = "https://blog.rust-lang.org/2016/05/26/Rust-1.9.html#controlled-unwinding" +"/rust-2018/error-handling-and-panics/aborting-on-panic.html" = "../../../book/ch09-01-unrecoverable-errors-with-panic.html" +"/rust-2018/control-flow/index.html" = "../../../rust-by-example/flow_control.html" +"/rust-2018/control-flow/loops-can-break-with-a-value.html" = "../../../rust-by-example/flow_control/loop/return.html" +"/rust-2018/control-flow/async-await-for-easier-concurrency.html" = "https://rust-lang.github.io/async-book/" +"/rust-2018/trait-system/index.html" = "../index.html" +"/rust-2018/trait-system/impl-trait-for-returning-complex-types-with-ease.html" = "https://blog.rust-lang.org/2018/05/10/Rust-1.26.html#impl-trait" +"/rust-2018/trait-system/dyn-trait-for-trait-objects.html" = "https://blog.rust-lang.org/2018/06/21/Rust-1.27.html#dyn-trait" +"/rust-2018/trait-system/more-container-types-support-trait-objects.html" = "https://github.com/rust-lang/rfcs/blob/master/text/0982-dst-coercion.md" +"/rust-2018/trait-system/associated-constants.html" = "../../../reference/items/associated-items.html#associated-constants" +"/rust-2018/trait-system/no-anon-params.html" = "../trait-fn-parameters.html" +"/rust-2018/slice-patterns.html" = "https://blog.rust-lang.org/2018/05/10/Rust-1.26.html#basic-slice-patterns" +"/rust-2018/ownership-and-lifetimes/index.html" = "../../../book/ch04-00-understanding-ownership.html" +"/rust-2018/ownership-and-lifetimes/non-lexical-lifetimes.html" = "https://blog.rust-lang.org/2018/12/06/Rust-1.31-and-rust-2018.html#non-lexical-lifetimes" +"/rust-2018/ownership-and-lifetimes/default-match-bindings.html" = "https://blog.rust-lang.org/2018/05/10/Rust-1.26.html#nicer-match-bindings" +"/rust-2018/ownership-and-lifetimes/the-anonymous-lifetime.html" = "https://blog.rust-lang.org/2018/12/06/Rust-1.31-and-rust-2018.html#more-lifetime-elision-rules" +"/rust-2018/ownership-and-lifetimes/lifetime-elision-in-impl.html" = "https://blog.rust-lang.org/2018/12/06/Rust-1.31-and-rust-2018.html#more-lifetime-elision-rules" +"/rust-2018/ownership-and-lifetimes/inference-in-structs.html" = "https://github.com/rust-lang/rfcs/blob/master/text/2093-infer-outlives.md" +"/rust-2018/ownership-and-lifetimes/simpler-lifetimes-in-static-and-const.html" = "../../../reference/lifetime-elision.html#static-lifetime-elision" +"/rust-2018/data-types/index.html" = "../index.html" +"/rust-2018/data-types/field-init-shorthand.html" = "../../../reference/expressions/struct-expr.html#struct-field-init-shorthand" +"/rust-2018/data-types/inclusive-ranges.html" = "https://blog.rust-lang.org/2018/05/10/Rust-1.26.html#inclusive-ranges-with-" +"/rust-2018/data-types/128-bit-integers.html" = "https://blog.rust-lang.org/2018/05/10/Rust-1.26.html#128-bit-integers" +"/rust-2018/data-types/operator-equals-are-now-implementable.html" = "../../../std/ops/index.html" +"/rust-2018/data-types/union-for-an-unsafe-form-of-enum.html" = "../../../reference/items/unions.html" +"/rust-2018/data-types/choosing-alignment-with-the-repr-attribute.html" = "../../../reference/type-layout.html#representations" +"/rust-2018/simd-for-faster-computing.html" = "https://blog.rust-lang.org/2018/06/21/Rust-1.27.html#simd" +"/rust-2018/macros/index.html" = "../../../book/ch19-06-macros.html" +"/rust-2018/macros/custom-derive.html" = "../../../book/ch19-06-macros.html#how-to-write-a-custom-derive-macro" +"/rust-2018/macros/macro-changes.html" = "../../../book/ch19-06-macros.html" +"/rust-2018/macros/at-most-once.html" = "../../../reference/macros-by-example.html#repetitions" +"/rust-2018/the-compiler/index.html" = "../index.html" +"/rust-2018/the-compiler/improved-error-messages.html" = "https://blog.rust-lang.org/2016/09/29/Rust-1.12.html#overhauled-error-messages" +"/rust-2018/the-compiler/incremental-compilation-for-faster-compiles.html" = "https://blog.rust-lang.org/2018/02/15/Rust-1.24.html#incremental-compilation" +"/rust-2018/the-compiler/an-attribute-for-deprecation.html" = "../../../reference/attributes/diagnostics.html#the-deprecated-attribute" +"/rust-2018/rustup-for-managing-rust-versions.html" = "https://rust-lang.github.io/rustup/" +"/rust-2018/cargo-and-crates-io/index.html" = "../../../cargo/index.html" +"/rust-2018/cargo-and-crates-io/cargo-check-for-faster-checking.html" = "../../../cargo/commands/cargo-check.html" +"/rust-2018/cargo-and-crates-io/cargo-install-for-easy-installation-of-tools.html" = "../../../cargo/commands/cargo-install.html" +"/rust-2018/cargo-and-crates-io/cargo-new-defaults-to-a-binary-project.html" = "https://blog.rust-lang.org/2018/03/29/Rust-1.25.html#cargo-features" +"/rust-2018/cargo-and-crates-io/cargo-rustc-for-passing-arbitrary-flags-to-rustc.html" = "../../../cargo/commands/cargo-rustc.html" +"/rust-2018/cargo-and-crates-io/cargo-workspaces-for-multi-package-projects.html" = "../../../cargo/reference/workspaces.html" +"/rust-2018/cargo-and-crates-io/multi-file-examples.html" = "../../../cargo/guide/project-layout.html" +"/rust-2018/cargo-and-crates-io/replacing-dependencies-with-patch.html" = "../../../cargo/reference/overriding-dependencies.html#the-patch-section" +"/rust-2018/cargo-and-crates-io/cargo-can-use-a-local-registry-replacement.html" = "../../../cargo/reference/source-replacement.html" +"/rust-2018/cargo-and-crates-io/crates-io-disallows-wildcard-dependencies.html" = "https://blog.rust-lang.org/2016/01/21/Rust-1.6.html#cratesio-disallows-wildcards" +"/rust-2018/documentation/index.html" = "../../../index.html" +"/rust-2018/documentation/new-editions-of-the-book.html" = "../../../book/index.html" +"/rust-2018/documentation/the-rust-bookshelf.html" = "../../../index.html" +"/rust-2018/documentation/the-rustonomicon.html" = "../../../nomicon/index.html" +"/rust-2018/documentation/std-os-has-documentation-for-all-platforms.html" = "../../../std/os/index.html" +"/rust-2018/rustdoc/index.html" = "../../../rustdoc/index.html" +"/rust-2018/rustdoc/documentation-tests-can-now-compile-fail.html" = "../../../rustdoc/documentation-tests.html#attributes" +"/rust-2018/rustdoc/rustdoc-uses-commonmark.html" = "../../../rustdoc/how-to-write-documentation.html#markdown" +"/rust-2018/platform-and-target-support/index.html" = "../../../rustc/targets/index.html" +"/rust-2018/platform-and-target-support/libcore-for-low-level-rust.html" = "../../../core/index.html" +"/rust-2018/platform-and-target-support/webassembly-support.html" = "https://rustwasm.github.io/docs/book/" +"/rust-2018/platform-and-target-support/global-allocators.html" = "https://blog.rust-lang.org/2018/08/02/Rust-1.28.html#global-allocators" +"/rust-2018/platform-and-target-support/msvc-toolchain-support.html" = "../../../rustc/platform-support.html" +"/rust-2018/platform-and-target-support/musl-support-for-fully-static-binaries.html" = "../../../rustc/platform-support.html" +"/rust-2018/platform-and-target-support/cdylib-crates-for-c-interoperability.html" = "https://github.com/rust-lang/rfcs/blob/master/text/1510-cdylib.md" +"/rust-next/index.html" = "../rust-2021/index.html" +"/rust-next/edition-changes.html" = "../rust-2021/index.html" +"/rust-next/dbg-macro.html" = "../../std/macro.dbg.html" +"/rust-next/no-jemalloc.html" = "https://blog.rust-lang.org/2019/01/17/Rust-1.32.0.html#jemalloc-is-removed-by-default" +"/rust-next/uniform-paths.html" = "https://blog.rust-lang.org/2019/01/17/Rust-1.32.0.html#final-module-improvements" +"/rust-next/literal-macro-matcher.html" = "https://blog.rust-lang.org/2019/01/17/Rust-1.32.0.html#macro-improvements" +"/rust-next/qustion-mark-operator-in-macros.html" = "https://blog.rust-lang.org/2019/01/17/Rust-1.32.0.html#macro-improvements" +"/rust-next/const-fn.html" = "../../reference/const_eval.html" +"/rust-next/pin.html" = "../../std/pin/index.html" +"/rust-next/no-more-fnbox.html" = "https://blog.rust-lang.org/2019/05/23/Rust-1.35.0.html#fn-closure-traits-implemented-for-boxdyn-fn" +"/rust-next/alternative-cargo-registries.html" = "https://blog.rust-lang.org/2019/04/11/Rust-1.34.0.html#alternative-cargo-registries" +"/rust-next/tryfrom-and-tryinto.html" = "https://blog.rust-lang.org/2019/04/11/Rust-1.34.0.html#tryfrom-and-tryinto" +"/rust-next/future.html" = "../../std/future/trait.Future.html" +"/rust-next/alloc.html" = "https://blog.rust-lang.org/2019/07/04/Rust-1.36.0.html#the-alloc-crate-is-stable" +"/rust-next/maybe-uninit.html" = "https://blog.rust-lang.org/2019/07/04/Rust-1.36.0.html#maybeuninitt-instead-of-memuninitialized" +"/rust-next/cargo-vendor.html" = "../../cargo/commands/cargo-vendor.html" diff --git a/src/rust-2018/new-keywords.md b/src/rust-2018/new-keywords.md index 2fe564dc..92ee8770 100644 --- a/src/rust-2018/new-keywords.md +++ b/src/rust-2018/new-keywords.md @@ -4,7 +4,7 @@ ## Summary -- [`dyn`] is a [strict keyword][strict], in 2015 it is a [weak keyword]. +- `dyn` is a [strict keyword][strict], in 2015 it is a [weak keyword]. - `async` and `await` are [strict keywords][strict]. - `try` is a [reserved keyword]. @@ -50,11 +50,13 @@ is sometimes slower, and often cannot be used at all when its alternatives can. Furthermore, with `impl Trait` arriving, "`impl Trait` vs `dyn Trait`" is much more symmetric, and therefore a bit nicer, than "`impl Trait` vs `Trait`". -`impl Trait` is explained [here](impl-trait-for-returning-complex-types-with-ease.md). +`impl Trait` is explained [here][impl-trait]. In the new edition, you should therefore prefer `dyn Trait` to just `Trait` where you need a trait object. +[impl-trait]: ../../rust-by-example/trait/impl_trait.html + ### `async` and `await` These keywords are reserved to implement the async-await feature of Rust, which was ultimately [released to stable in 1.39.0](https://blog.rust-lang.org/2019/11/07/Async-await-stable.html). diff --git a/src/rust-2018/path-changes.md b/src/rust-2018/path-changes.md index f4e5ceea..fc16d472 100644 --- a/src/rust-2018/path-changes.md +++ b/src/rust-2018/path-changes.md @@ -99,19 +99,39 @@ Some examples of needing to explicitly import sysroot crates are: * [`test`]: This is only available on the [nightly channel], and is usually only used for the unstable benchmark support. -[`alloc`]: ../../../alloc/index.html -[`core`]: ../../../core/index.html -[`proc_macro`]: ../../../proc_macro/index.html -[`std`]: ../../../std/index.html -[`test`]: ../../../test/index.html -[nightly channel]: ../../../book/appendix-07-nightly-rust.html +[`alloc`]: ../../alloc/index.html +[`core`]: ../../core/index.html +[`proc_macro`]: ../../proc_macro/index.html +[`std`]: ../../std/index.html +[`test`]: ../../test/index.html +[nightly channel]: ../../book/appendix-07-nightly-rust.html [no_core]: https://github.com/rust-lang/rust/issues/29639 -[no_std]: ../../../reference/names/preludes.html#the-no_std-attribute +[no_std]: ../../reference/names/preludes.html#the-no_std-attribute #### Macros One other use for `extern crate` was to import macros; that's no longer needed. -Check [the macro section](../macros/macro-changes.md) for more. +Macros may be imported with `use` like any other item. For example, the +following use of `extern crate`: + +```rust,ignore +#[macro_use] +extern crate bar; + +fn main() { + baz!(); +} +``` + +Can be changed to something like the following: + +```rust,ignore +use bar::baz; + +fn main() { + baz!(); +} +``` #### Renaming crates