Skip to content

Commit 41826c4

Browse files
committed
auto merge of #9475 : alexcrichton/rust/rustdoc++, r=cmr
The commit messages are a good technical summary, a good visual summary (contrib is this version): Pub use statements now rendered. Notice how almost all components are also clickable! * http://static.rust-lang.org/doc/master/std/prelude/index.html * http://www.contrib.andrew.cmu.edu/~acrichto/doc/std/prelude/index.html Private things hidden by default (for at least some approximation of privacy). I hope to improve this once privacy is totally ironed out. * http://static.rust-lang.org/doc/master/std/hashmap/struct.HashMap.html * http://www.contrib.andrew.cmu.edu/~acrichto/doc/std/hashmap/struct.HashMap.html Unindentation now works properly: * http://static.rust-lang.org/doc/master/extra/getopts/index.html * http://www.contrib.andrew.cmu.edu/~acrichto/doc/extra/getopts/index.html Also sundown has massively reduced compilation time (of docs, not the of the crates)
2 parents 24d46a0 + 3d5873f commit 41826c4

File tree

110 files changed

+6433
-576
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+6433
-576
lines changed

configure

+1-1
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ do
684684
isaac linenoise sync test \
685685
arch/i386 arch/x86_64 arch/arm arch/mips \
686686
libuv libuv/src/ares libuv/src/eio libuv/src/ev \
687-
jemalloc
687+
jemalloc sundown/src sundown/html
688688
do
689689
make_dir $t/rt/stage$s/$i
690690
done

mk/rt.mk

+12-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,16 @@ RUNTIME_CXXS_$(1)_$(2) := \
8282
rt/rust_android_dummy.cpp \
8383
rt/rust_test_helpers.cpp
8484

85-
RUNTIME_CS_$(1)_$(2) := rt/linenoise/linenoise.c rt/linenoise/utf8.c
85+
RUNTIME_CS_$(1)_$(2) := rt/linenoise/linenoise.c \
86+
rt/linenoise/utf8.c \
87+
rt/sundown/src/autolink.c \
88+
rt/sundown/src/buffer.c \
89+
rt/sundown/src/stack.c \
90+
rt/sundown/src/markdown.c \
91+
rt/sundown/html/houdini_href_e.c \
92+
rt/sundown/html/houdini_html_e.c \
93+
rt/sundown/html/html_smartypants.c \
94+
rt/sundown/html/html.c
8695

8796
RUNTIME_S_$(1)_$(2) := rt/arch/$$(HOST_$(1))/_context.S \
8897
rt/arch/$$(HOST_$(1))/ccall.S \
@@ -117,6 +126,8 @@ RUNTIME_DEF_$(1)_$(2) := $$(RT_OUTPUT_DIR_$(1))/rustrt$$(CFG_DEF_SUFFIX_$(1))
117126
RUNTIME_INCS_$(1)_$(2) := -I $$(S)src/rt -I $$(S)src/rt/isaac -I $$(S)src/rt/uthash \
118127
-I $$(S)src/rt/arch/$$(HOST_$(1)) \
119128
-I $$(S)src/rt/linenoise \
129+
-I $$(S)src/rt/sundown/src \
130+
-I $$(S)src/rt/sundown/html \
120131
-I $$(S)src/libuv/include
121132
RUNTIME_OBJS_$(1)_$(2) := $$(RUNTIME_CXXS_$(1)_$(2):rt/%.cpp=$$(RT_BUILD_DIR_$(1)_$(2))/%.o) \
122133
$$(RUNTIME_CS_$(1)_$(2):rt/%.c=$$(RT_BUILD_DIR_$(1)_$(2))/%.o) \

mk/tests.mk

+5-2
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,9 @@ ALL_CS := $(wildcard $(S)src/rt/*.cpp \
227227
$(S)src/rt/*/*/*.cpp \
228228
$(S)src/rustllvm/*.cpp)
229229
ALL_CS := $(filter-out $(S)src/rt/miniz.cpp \
230-
$(S)src/rt/linenoise/linenoise.c \
231-
$(S)src/rt/linenoise/utf8.c \
230+
$(wildcard $(S)src/rt/linenoise/*.c) \
231+
$(wildcard $(S)src/rt/sundown/src/*.c) \
232+
$(wildcard $(S)src/rt/sundown/html/*.c) \
232233
,$(ALL_CS))
233234
ALL_HS := $(wildcard $(S)src/rt/*.h \
234235
$(S)src/rt/*/*.h \
@@ -241,6 +242,8 @@ ALL_HS := $(filter-out $(S)src/rt/vg/valgrind.h \
241242
$(S)src/rt/msvc/inttypes.h \
242243
$(S)src/rt/linenoise/linenoise.h \
243244
$(S)src/rt/linenoise/utf8.h \
245+
$(wildcard $(S)src/rt/sundown/src/*.h) \
246+
$(wildcard $(S)src/rt/sundown/html/*.h) \
244247
,$(ALL_HS))
245248

246249
# Run the tidy script in multiple parts to avoid huge 'echo' commands

src/libextra/arc.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* In this example, a large vector of floats is shared between several tasks.
1818
* With simple pipes, without Arc, a copy would have to be made for each task.
1919
*
20-
* ~~~ {.rust}
20+
* ```rust
2121
* extern mod std;
2222
* use extra::arc;
2323
* let numbers=vec::from_fn(100, |ind| (ind as float)*rand::random());
@@ -34,7 +34,7 @@
3434
* // Work with the local numbers
3535
* }
3636
* }
37-
* ~~~
37+
* ```
3838
*/
3939

4040
#[allow(missing_doc)];
@@ -440,7 +440,7 @@ impl<T:Freeze + Send> RWArc<T> {
440440
*
441441
* # Example
442442
*
443-
* ~~~ {.rust}
443+
* ```rust
444444
* do arc.write_downgrade |mut write_token| {
445445
* do write_token.write_cond |state, condvar| {
446446
* ... exclusive access with mutable state ...
@@ -450,7 +450,7 @@ impl<T:Freeze + Send> RWArc<T> {
450450
* ... shared access with immutable state ...
451451
* }
452452
* }
453-
* ~~~
453+
* ```
454454
*/
455455
pub fn write_downgrade<U>(&self, blk: &fn(v: RWWriteMode<T>) -> U) -> U {
456456
unsafe {

src/libextra/base64.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,15 @@ impl<'self> ToBase64 for &'self [u8] {
6262
*
6363
* # Example
6464
*
65-
* ~~~ {.rust}
65+
* ```rust
6666
* extern mod extra;
6767
* use extra::base64::{ToBase64, standard};
6868
*
6969
* fn main () {
7070
* let str = [52,32].to_base64(standard);
7171
* printfln!("%s", str);
7272
* }
73-
* ~~~
73+
* ```
7474
*/
7575
fn to_base64(&self, config: Config) -> ~str {
7676
let bytes = match config.char_set {
@@ -170,7 +170,7 @@ impl<'self> FromBase64 for &'self str {
170170
*
171171
* This converts a string literal to base64 and back.
172172
*
173-
* ~~~ {.rust}
173+
* ```rust
174174
* extern mod extra;
175175
* use extra::base64::{ToBase64, FromBase64, standard};
176176
* use std::str;
@@ -183,7 +183,7 @@ impl<'self> FromBase64 for &'self str {
183183
* let result_str = str::from_utf8(bytes);
184184
* printfln!("%s", result_str);
185185
* }
186-
* ~~~
186+
* ```
187187
*/
188188
fn from_base64(&self) -> Result<~[u8], ~str> {
189189
let mut r = ~[];

src/libextra/extra.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ Rust extras are part of the standard Rust distribution.
2626
url = "https://github.com/mozilla/rust/tree/master/src/libextra")];
2727

2828
#[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk.png",
29-
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
30-
passes = "strip-hidden")];
29+
html_favicon_url = "http://www.rust-lang.org/favicon.ico")];
3130

3231
#[comment = "Rust extras"];
3332
#[license = "MIT/ASL2"];

src/libextra/flatpipes.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ ports and channels.
2525
2626
This example sends boxed integers across tasks using serialization.
2727
28-
~~~ {.rust}
28+
```rust
2929
let (port, chan) = serial::pipe_stream();
3030
3131
do task::spawn || {
@@ -37,7 +37,7 @@ do task::spawn || {
3737
for i in range(0, 10) {
3838
assert @i == port.recv()
3939
}
40-
~~~
40+
```
4141
4242
# Safety Note
4343

src/libextra/future.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
*
1515
* # Example
1616
*
17-
* ~~~ {.rust}
17+
* ```rust
1818
* # fn fib(n: uint) -> uint {42};
1919
* # fn make_a_sandwich() {};
2020
* let mut delayed_fib = extra::future::spawn (|| fib(5000) );
2121
* make_a_sandwich();
2222
* printfln!("fib(5000) = %?", delayed_fib.get())
23-
* ~~~
23+
* ```
2424
*/
2525

2626
#[allow(missing_doc)];

src/libextra/getopts.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
//! that requires an input file to be specified, accepts an optional output
3030
//! file name following -o, and accepts both -h and --help as optional flags.
3131
//!
32-
//! ```
32+
//! ~~~{.rust}
3333
//! exter mod extra;
3434
//! use extra::getopts::*;
3535
//! use std::os;
@@ -75,7 +75,7 @@
7575
//! };
7676
//! do_work(input, output);
7777
//! }
78-
//! ```
78+
//! ~~~
7979
8080
use std::cmp::Eq;
8181
use std::result::{Err, Ok};

src/libextra/glob.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,18 @@ pub struct GlobIterator {
5151
* Consider a directory `/media/pictures` containing only the files `kittens.jpg`,
5252
* `puppies.jpg` and `hamsters.gif`:
5353
*
54-
* ~~~ {.rust}
54+
* ```rust
5555
* for path in glob("/media/pictures/*.jpg") {
5656
* println(path.to_str());
5757
* }
58-
* ~~~
58+
* ```
5959
*
6060
* The above code will print:
6161
*
62-
* ~~~
62+
* ```
6363
* /media/pictures/kittens.jpg
6464
* /media/pictures/puppies.jpg
65-
* ~~~
65+
* ```
6666
*/
6767
pub fn glob(pattern: &str) -> GlobIterator {
6868
glob_with(pattern, MatchOptions::new())
@@ -270,11 +270,11 @@ impl Pattern {
270270
*
271271
* # Example
272272
*
273-
* ~~~ {.rust}
273+
* ```rust
274274
* assert!(Pattern::new("c?t").matches("cat"));
275275
* assert!(Pattern::new("k[!e]tteh").matches("kitteh"));
276276
* assert!(Pattern::new("d*g").matches("doog"));
277-
* ~~~
277+
* ```
278278
*/
279279
pub fn matches(&self, str: &str) -> bool {
280280
self.matches_with(str, MatchOptions::new())
@@ -492,13 +492,13 @@ impl MatchOptions {
492492
*
493493
* This function always returns this value:
494494
*
495-
* ~~~ {.rust}
495+
* ```rust
496496
* MatchOptions {
497497
* case_sensitive: true,
498498
* require_literal_separator: false.
499499
* require_literal_leading_dot: false
500500
* }
501-
* ~~~
501+
* ```
502502
*/
503503
pub fn new() -> MatchOptions {
504504
MatchOptions {

src/libextra/hex.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ impl<'self> ToHex for &'self [u8] {
2727
*
2828
* # Example
2929
*
30-
* ~~~ {.rust}
30+
* ```rust
3131
* extern mod extra;
3232
* use extra::hex::ToHex;
3333
*
3434
* fn main () {
3535
* let str = [52,32].to_hex();
3636
* printfln!("%s", str);
3737
* }
38-
* ~~~
38+
* ```
3939
*/
4040
fn to_hex(&self) -> ~str {
4141
let mut v = vec::with_capacity(self.len() * 2);
@@ -70,7 +70,7 @@ impl<'self> FromHex for &'self str {
7070
*
7171
* This converts a string literal to hexadecimal and back.
7272
*
73-
* ~~~ {.rust}
73+
* ```rust
7474
* extern mod extra;
7575
* use extra::hex::{FromHex, ToHex};
7676
* use std::str;
@@ -83,7 +83,7 @@ impl<'self> FromHex for &'self str {
8383
* let result_str = str::from_utf8(bytes);
8484
* printfln!("%s", result_str);
8585
* }
86-
* ~~~
86+
* ```
8787
*/
8888
fn from_hex(&self) -> Result<~[u8], ~str> {
8989
// This may be an overestimate if there is any whitespace

src/libextra/sync.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ impl RWLock {
578578
*
579579
* # Example
580580
*
581-
* ~~~ {.rust}
581+
* ```rust
582582
* do lock.write_downgrade |mut write_token| {
583583
* do write_token.write_cond |condvar| {
584584
* ... exclusive access ...
@@ -588,7 +588,7 @@ impl RWLock {
588588
* ... shared access ...
589589
* }
590590
* }
591-
* ~~~
591+
* ```
592592
*/
593593
pub fn write_downgrade<U>(&self, blk: &fn(v: RWLockWriteMode) -> U) -> U {
594594
// Implementation slightly different from the slicker 'write's above.

src/libextra/uuid.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ unlikely.
2828
2929
To create a new random (V4) UUID and print it out in hexadecimal form:
3030
31-
~~~ {.rust}
31+
```rust
3232
extern mod extra;
3333
use extra::uuid::Uuid;
3434
3535
fn main() {
3636
let uuid1 = Uuid::new_v4();
3737
println(uuid1.to_str());
3838
}
39-
~~~
39+
```
4040
4141
# Strings
4242

src/librustc/middle/resolve.rs

+28
Original file line numberDiff line numberDiff line change
@@ -2499,6 +2499,26 @@ impl Resolver {
24992499
assert!(import_resolution.outstanding_references >= 1);
25002500
import_resolution.outstanding_references -= 1;
25012501

2502+
// record what this import resolves to for later uses in documentation,
2503+
// this may resolve to either a value or a type, but for documentation
2504+
// purposes it's good enough to just favor one over the other.
2505+
match i.value_target {
2506+
Some(target) => {
2507+
self.def_map.insert(i.value_id,
2508+
target.bindings.value_def.get_ref().def);
2509+
}
2510+
None => {}
2511+
}
2512+
match i.type_target {
2513+
Some(target) => {
2514+
match target.bindings.type_def.get_ref().type_def {
2515+
Some(def) => { self.def_map.insert(i.type_id, def); }
2516+
None => {}
2517+
}
2518+
}
2519+
None => {}
2520+
}
2521+
25022522
debug!("(resolving single import) successfully resolved import");
25032523
return Success(());
25042524
}
@@ -2626,6 +2646,14 @@ impl Resolver {
26262646
merge_import_resolution(name, name_bindings);
26272647
}
26282648

2649+
// Record the destination of this import
2650+
match containing_module.def_id {
2651+
Some(did) => {
2652+
self.def_map.insert(id, DefMod(did));
2653+
}
2654+
None => {}
2655+
}
2656+
26292657
debug!("(resolving glob import) successfully resolved import");
26302658
return Success(());
26312659
}

src/librustc/middle/typeck/infer/doc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,4 +240,4 @@ We make use of a trait-like impementation strategy to consolidate
240240
duplicated code between subtypes, GLB, and LUB computations. See the
241241
section on "Type Combining" below for details.
242242
243-
*/
243+
*/

0 commit comments

Comments
 (0)