Skip to content

Commit f614734

Browse files
committed
doc: Fix a number of broken links
cc #14515
1 parent 212b787 commit f614734

File tree

9 files changed

+52
-35
lines changed

9 files changed

+52
-35
lines changed

src/doc/complement-cheatsheet.md

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
**Int to string**
66

7-
Use [`ToStr`](../std/to_str/trait.ToStr.html).
7+
Use [`ToStr`](std/to_str/trait.ToStr.html).
88

99
~~~
1010
let x: int = 42;
@@ -13,8 +13,8 @@ let y: String = x.to_str().to_string();
1313

1414
**String to int**
1515

16-
Use [`FromStr`](../std/from_str/trait.FromStr.html), and its helper function,
17-
[`from_str`](../std/from_str/fn.from_str.html).
16+
Use [`FromStr`](std/from_str/trait.FromStr.html), and its helper function,
17+
[`from_str`](std/from_str/fn.from_str.html).
1818

1919
~~~
2020
let x: Option<int> = from_str("42");
@@ -35,8 +35,8 @@ let y: String = format!("{:X}", x); // uppercase hexadecimal
3535

3636
**String to int, in non-base-10**
3737

38-
Use [`FromStrRadix`](../std/num/trait.FromStrRadix.html), and its helper
39-
function, [`from_str_radix`](../std/num/fn.from_str_radix.html).
38+
Use [`FromStrRadix`](std/num/trait.FromStrRadix.html), and its helper
39+
function, [`from_str_radix`](std/num/fn.from_str_radix.html).
4040

4141
~~~
4242
use std::num;
@@ -48,7 +48,7 @@ let y: i64 = x.unwrap();
4848
**Vector of Bytes to String**
4949

5050
To return a Borrowed String Slice (&str) use the str helper function
51-
[`from_utf8`](../std/str/fn.from_utf8.html).
51+
[`from_utf8`](std/str/fn.from_utf8.html).
5252

5353
~~~
5454
use std::str;
@@ -59,7 +59,7 @@ let y: &str = x.unwrap();
5959
~~~
6060

6161
To return an Owned String use the str helper function
62-
[`from_utf8_owned`](../std/str/fn.from_utf8_owned.html).
62+
[`from_utf8_owned`](std/str/fn.from_utf8_owned.html).
6363

6464
~~~
6565
use std::str;
@@ -69,8 +69,8 @@ let x: Option<String> =
6969
let y: String = x.unwrap();
7070
~~~
7171

72-
To return a [`MaybeOwned`](../std/str/enum.MaybeOwned.html) use the str helper
73-
function [`from_utf8_lossy`](../std/str/fn.from_utf8_owned.html).
72+
To return a [`MaybeOwned`](std/str/type.MaybeOwned.html) use the str helper
73+
function [`from_utf8_lossy`](std/str/fn.from_utf8_owned.html).
7474
This function also replaces non-valid utf-8 sequences with U+FFFD replacement
7575
character.
7676

@@ -86,11 +86,11 @@ let y = str::from_utf8_lossy(x);
8686
## How do I read from a file?
8787

8888
Use
89-
[`File::open`](../std/io/fs/struct.File.html#method.open)
89+
[`File::open`](std/io/fs/struct.File.html#method.open)
9090
to create a
91-
[`File`](../std/io/fs/struct.File.html)
91+
[`File`](std/io/fs/struct.File.html)
9292
struct, which implements the
93-
[`Reader`](../std/io/trait.Reader.html)
93+
[`Reader`](std/io/trait.Reader.html)
9494
trait.
9595

9696
~~~ {.ignore}
@@ -104,7 +104,8 @@ let reader : File = File::open(&path).unwrap_or_else(on_error);
104104

105105
## How do I iterate over the lines in a file?
106106

107-
Use the [`lines`](../std/io/trait.Buffer.html#method.lines) method on a [`BufferedReader`](../std/io/buffered/struct.BufferedReader.html).
107+
Use the [`lines`](std/io/trait.Buffer.html#method.lines) method on a
108+
[`BufferedReader`](std/io/struct.BufferedReader.html).
108109

109110
~~~
110111
use std::io::BufferedReader;
@@ -122,7 +123,7 @@ for line in reader.lines() {
122123

123124
## How do I search for a substring?
124125

125-
Use the [`find_str`](../std/str/trait.StrSlice.html#tymethod.find_str) method.
126+
Use the [`find_str`](std/str/trait.StrSlice.html#tymethod.find_str) method.
126127

127128
~~~
128129
let str = "Hello, this is some random string";
@@ -133,7 +134,7 @@ let index: Option<uint> = str.find_str("rand");
133134

134135
## How do I get the length of a vector?
135136

136-
The [`Container`](../std/container/trait.Container.html) trait provides the `len` method.
137+
The [`Container`](std/container/trait.Container.html) trait provides the `len` method.
137138

138139
~~~
139140
let u: ~[u32] = ~[0, 1, 2];
@@ -145,7 +146,7 @@ println!("u: {}, v: {}, w: {}", u.len(), v.len(), w.len()); // 3, 4, 5
145146

146147
## How do I iterate over a vector?
147148

148-
Use the [`iter`](../std/vec/trait.ImmutableVector.html#tymethod.iter) method.
149+
Use the [`iter`](std/slice/trait.ImmutableVector.html#tymethod.iter) method.
149150

150151
~~~
151152
let values: ~[int] = ~[1, 2, 3, 4, 5];
@@ -154,9 +155,9 @@ for value in values.iter() { // value: &int
154155
}
155156
~~~
156157

157-
(See also [`mut_iter`](../std/vec/trait.MutableVector.html#tymethod.mut_iter)
158+
(See also [`mut_iter`](std/slice/trait.MutableVector.html#tymethod.mut_iter)
158159
which yields `&mut int` and
159-
[`move_iter`](../std/vec/trait.OwnedVector.html#tymethod.move_iter) which yields
160+
[`move_iter`](std/slice/trait.OwnedVector.html#tymethod.move_iter) which yields
160161
`int` while consuming the `values` vector.)
161162

162163
# Type system

src/doc/complement-lang-faq.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Some examples that demonstrate different aspects of the language:
2121
* The extra library's [json] module. Enums and pattern matching
2222

2323
[sprocketnes]: https://github.com/pcwalton/sprocketnes
24-
[hash]: https://github.com/mozilla/rust/blob/master/src/libstd/hash.rs
24+
[hash]: https://github.com/mozilla/rust/blob/master/src/libstd/hash/mod.rs
2525
[HashMap]: https://github.com/mozilla/rust/blob/master/src/libcollections/hashmap.rs
2626
[json]: https://github.com/mozilla/rust/blob/master/src/libserialize/json.rs
2727

@@ -149,6 +149,6 @@ example we were setting RUST_LOG to the name of the hello crate. Multiple paths
149149
can be combined to control the exact logging you want to see. For example, when
150150
debugging linking in the compiler you might set
151151
`RUST_LOG=rustc::metadata::creader,rustc::util::filesearch,rustc::back::rpath`
152-
For a full description see [the language reference][1].
152+
For a full description see [the logging crate][1].
153153

154-
[1]:http://doc.rust-lang.org/doc/master/rust.html#logging-system
154+
[1]:log/index.html

src/doc/guide-unsafe.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -499,9 +499,9 @@ shouldn't get triggered.
499499

500500
The second of these two functions, `eh_personality`, is used by the failure
501501
mechanisms of the compiler. This is often mapped to GCC's personality function
502-
(see the [libstd implementation](../std/rt/unwind/) for more information), but
503-
crates which do not trigger failure can be assured that this function is never
504-
called.
502+
(see the [libstd implementation](std/rt/unwind/index.html) for more
503+
information), but crates which do not trigger failure can be assured that this
504+
function is never called.
505505

506506
## Using libcore
507507

@@ -511,7 +511,8 @@ called.
511511
With the above techniques, we've got a bare-metal executable running some Rust
512512
code. There is a good deal of functionality provided by the standard library,
513513
however, that is necessary to be productive in Rust. If the standard library is
514-
not sufficient, then [libcore](../core/) is designed to be used instead.
514+
not sufficient, then [libcore](../core/index.html) is designed to be used
515+
instead.
515516

516517
The core library has very few dependencies and is much more portable than the
517518
standard library itself. Additionally, the core library has most of the

src/liballoc/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ pub mod arc;
9797
pub mod rc;
9898

9999
#[cfg(not(test))]
100+
#[doc(hidden)]
100101
mod std {
101102
pub use core::fmt;
102103
pub use core::option;

src/libcore/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,12 @@ pub mod fmt;
134134
// crate.
135135
mod should_not_exist;
136136

137+
#[doc(hidden)]
137138
mod core {
138139
pub use failure;
139140
}
140141

142+
#[doc(hidden)]
141143
mod std {
142144
pub use clone;
143145
pub use cmp;

src/libcore/result.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@
234234
//! similar and complementary: they are often employed to indicate a
235235
//! lack of a return value; and they are trivially converted between
236236
//! each other, so `Result`s are often handled by first converting to
237-
//! `Option` with the [`ok`](enum.Result.html#method.ok) and
238-
//! [`err`](enum.Result.html#method.ok) methods.
237+
//! `Option` with the [`ok`](type.Result.html#method.ok) and
238+
//! [`err`](type.Result.html#method.ok) methods.
239239
//!
240240
//! Whereas `Option` only indicates the lack of a value, `Result` is
241241
//! specifically for error reporting, and carries with it an error

src/librustdoc/html/format.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,18 +278,24 @@ fn primitive_link(f: &mut fmt::Formatter,
278278
needs_termination = true;
279279
}
280280
Some(&cnum) => {
281+
let path = m.paths.get(&ast::DefId {
282+
krate: cnum,
283+
node: ast::CRATE_NODE_ID,
284+
});
281285
let loc = match *m.extern_locations.get(&cnum) {
282286
render::Remote(ref s) => Some(s.to_string()),
283287
render::Local => {
284288
let loc = current_location_key.get().unwrap();
285-
Some(("../".repeat(loc.len())).to_string())
289+
Some("../".repeat(loc.len()))
286290
}
287291
render::Unknown => None,
288292
};
289293
match loc {
290-
Some(s) => {
291-
try!(write!(f, "<a href='{}/primitive.{}.html'>",
292-
s, prim.to_url_str()));
294+
Some(root) => {
295+
try!(write!(f, "<a href='{}{}/primitive.{}.html'>",
296+
root,
297+
path.ref0().as_slice().head().unwrap(),
298+
prim.to_url_str()));
293299
needs_termination = true;
294300
}
295301
None => {}

src/librustdoc/html/render.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,8 +1380,13 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
13801380
if s.len() == 0 { return Ok(()); }
13811381
try!(write!(f, "<code> = </code>"));
13821382
if s.contains("\n") {
1383-
write!(f, "<a href='{}'>[definition]</a>",
1384-
item.href())
1383+
match item.href() {
1384+
Some(url) => {
1385+
write!(f, "<a href='{}'>[definition]</a>",
1386+
url)
1387+
}
1388+
None => Ok(()),
1389+
}
13851390
} else {
13861391
write!(f, "<code>{}</code>", s.as_slice())
13871392
}
@@ -1547,8 +1552,8 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
15471552
}
15481553
try!(write!(w, "</ul>"));
15491554
try!(write!(w, r#"<script type="text/javascript" async
1550-
src="{root_path}/implementors/{path}/\
1551-
{ty}.{name}.js"></script>"#,
1555+
src="{root_path}/implementors/{path}/{ty}.{name}.js">
1556+
</script>"#,
15521557
root_path = Vec::from_elem(cx.current.len(), "..").connect("/"),
15531558
path = if ast_util::is_local(it.def_id) {
15541559
cx.current.connect("/")

src/librustuv/homing.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ pub fn local_id() -> uint {
8282
}
8383
}
8484

85+
#[doc(hidden)]
8586
pub trait HomingIO {
8687
fn home<'r>(&'r mut self) -> &'r mut HomeHandle;
8788

0 commit comments

Comments
 (0)