]>
Commit | Line | Data |
---|---|---|
47372d83 XL |
1 | Description: Fix links to cargo-doc |
2 | We package cargo docs in a slightly different location; also tweak linkchecker | |
3 | to not fail these links. | |
4 | ||
5 | --- a/src/tools/linkchecker/main.rs | |
6 | +++ b/src/tools/linkchecker/main.rs | |
7 | @@ -19,6 +19,7 @@ | |
8 | use std::collections::hash_map::Entry; | |
9 | use std::collections::{HashMap, HashSet}; | |
10 | use std::env; | |
11 | +use std::ffi::OsStr; | |
12 | use std::fs; | |
13 | use std::path::{Component, Path, PathBuf}; | |
14 | use std::rc::Rc; | |
15 | @@ -331,7 +332,15 @@ | |
16 | print!("{}:{}: broken link - ", path.display(), i + 1); | |
17 | println!("{}", path.display()); | |
18 | } else { | |
19 | - let pretty_path = path.strip_prefix(root).unwrap_or(&path); | |
20 | + let pretty_path = match path.strip_prefix(root) { | |
21 | + Ok(suf) => suf, | |
22 | + Err(_) => if path.components().any(|x| x == Component::Normal(OsStr::new("cargo-doc"))) { | |
23 | + // link to cargo-doc, ok for our Debian build | |
24 | + return; | |
25 | + } else { | |
26 | + &path | |
27 | + } | |
28 | + }; | |
29 | if !is_exception(file, pretty_path.to_str().unwrap()) { | |
30 | *errors = true; | |
31 | print!("{}:{}: broken link - ", pretty_file.display(), i + 1); | |
32 | --- a/src/doc/index.md | |
33 | +++ b/src/doc/index.md | |
34 | @@ -87,7 +87,7 @@ | |
35 | ||
36 | ## The Cargo Book | |
37 | ||
38 | -[The Cargo Book](cargo/index.html) is a guide to Cargo, Rust's build tool and dependency manager. | |
39 | +[The Cargo Book](../../cargo-doc/doc/index.html) is a guide to Cargo, Rust's build tool and dependency manager. | |
40 | ||
41 | ## The Rustdoc Book | |
42 | ||
43 | --- a/src/doc/reference/src/conditional-compilation.md | |
44 | +++ b/src/doc/reference/src/conditional-compilation.md | |
45 | @@ -332,6 +332,6 @@ | |
46 | [`target_feature` attribute]: attributes/codegen.md#the-target_feature-attribute | |
47 | [attribute]: attributes.md | |
48 | [attributes]: attributes.md | |
49 | -[cargo-feature]: ../cargo/reference/features.html | |
50 | +[cargo-feature]: ../../cargo-doc/doc/reference/features.html | |
51 | [crate type]: linkage.md | |
52 | [static C runtime]: linkage.md#static-and-dynamic-c-runtimes | |
53 | --- a/src/doc/reference/src/introduction.md | |
54 | +++ b/src/doc/reference/src/introduction.md | |
55 | @@ -133,8 +133,8 @@ | |
56 | [the Rust Reference repository]: https://github.com/rust-lang/reference/ | |
57 | [Unstable Book]: https://doc.rust-lang.org/nightly/unstable-book/ | |
58 | [_Expression_]: expressions.md | |
59 | -[cargo book]: ../cargo/index.html | |
60 | -[cargo reference]: ../cargo/reference/index.html | |
61 | +[cargo book]: ../../cargo-doc/doc/index.html | |
62 | +[cargo reference]: ../../cargo-doc/doc/reference/index.html | |
63 | [expressions chapter]: expressions.html | |
64 | [file an issue]: https://github.com/rust-lang/reference/issues | |
65 | [lifetime of temporaries]: expressions.html#temporaries | |
66 | --- a/src/doc/reference/src/linkage.md | |
67 | +++ b/src/doc/reference/src/linkage.md | |
68 | @@ -200,7 +200,7 @@ | |
69 | } | |
70 | ``` | |
71 | ||
72 | -[cargo]: ../cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-build-scripts | |
73 | +[cargo]: ../../cargo-doc/doc/reference/environment-variables.html#environment-variables-cargo-sets-for-build-scripts | |
74 | ||
75 | To use this feature locally, you typically will use the `RUSTFLAGS` environment | |
76 | variable to specify flags to the compiler through Cargo. For example to compile | |
77 | --- a/src/doc/reference/src/procedural-macros.md | |
78 | +++ b/src/doc/reference/src/procedural-macros.md | |
79 | @@ -272,7 +272,7 @@ | |
80 | ``` | |
81 | ||
82 | [Attribute macros]: #attribute-macros | |
83 | -[Cargo's build scripts]: ../cargo/reference/build-scripts.html | |
84 | +[Cargo's build scripts]: ../../cargo-doc/doc/reference/build-scripts.html | |
85 | [Derive macros]: #derive-macros | |
86 | [Function-like macros]: #function-like-procedural-macros | |
87 | [`TokenStream`]: ../proc_macro/struct.TokenStream.html | |
88 | --- a/src/doc/rustc/src/tests/index.md | |
89 | +++ b/src/doc/rustc/src/tests/index.md | |
90 | @@ -266,7 +266,7 @@ | |
91 | [`--test` option]: ../command-line-arguments.md#option-test | |
92 | [`-Z panic-abort-tests`]: https://github.com/rust-lang/rust/issues/67650 | |
93 | [`available_concurrency`]: ../../std/thread/fn.available_concurrency.html | |
94 | -[`cargo test`]: ../../cargo/commands/cargo-test.html | |
95 | +[`cargo test`]: ../../../cargo-doc/doc/commands/cargo-test.html | |
96 | [`libtest`]: ../../test/index.html | |
97 | [`main` function]: ../../reference/crates-and-source-files.html#main-functions | |
98 | [`Result`]: ../../std/result/index.html | |
99 | @@ -275,7 +275,7 @@ | |
100 | [attribute-should_panic]: ../../reference/attributes/testing.html#the-should_panic-attribute | |
101 | [attribute-test]: ../../reference/attributes/testing.html#the-test-attribute | |
102 | [bench-docs]: ../../unstable-book/library-features/test.html | |
103 | -[Cargo]: ../../cargo/index.html | |
104 | +[Cargo]: ../../../cargo-doc/doc/index.html | |
105 | [crate type]: ../../reference/linkage.html | |
106 | [custom_test_frameworks documentation]: ../../unstable-book/language-features/custom-test-frameworks.html | |
107 | [nightly channel]: ../../book/appendix-07-nightly-rust.html | |
108 | --- a/src/doc/rustc/src/what-is-rustc.md | |
109 | +++ b/src/doc/rustc/src/what-is-rustc.md | |
110 | @@ -5,7 +5,7 @@ | |
111 | produce binary code, either as a library or executable. | |
112 | ||
113 | Most Rust programmers don't invoke `rustc` directly, but instead do it through | |
114 | -[Cargo](../cargo/index.html). It's all in service of `rustc` though! If you | |
115 | +[Cargo](../../cargo-doc/doc/index.html). It's all in service of `rustc` though! If you | |
116 | want to see how Cargo calls `rustc`, you can | |
117 | ||
118 | ```bash |