diff --git a/src/doc/rust.md b/src/doc/rust.md index aeda95aa26195..d5fd3d15ba53a 100644 --- a/src/doc/rust.md +++ b/src/doc/rust.md @@ -471,7 +471,7 @@ Two examples of paths with type arguments: # fn f() { # fn id(t: T) -> T { t } type T = HashMap; // Type arguments used in a type expression -let x = id::(10); // Type arguments used in a call expression +let x = id::(10); // Type arguments used in a call expression # } ~~~~ diff --git a/src/doc/tutorial.md b/src/doc/tutorial.md index 4b95cfc283f9e..ca636c82521e8 100644 --- a/src/doc/tutorial.md +++ b/src/doc/tutorial.md @@ -982,7 +982,8 @@ The obvious approach is to define `Cons` as containing an element in the list along with the next `List` node. However, this will generate a compiler error. ~~~ {.ignore} -// error: illegal recursive enum type; wrap the inner value in a box to make it representable +// error: illegal recursive enum type; wrap the inner value in a box to make it +// representable enum List { Cons(u32, List), // an element (`u32`) and the next node in the list Nil @@ -1054,10 +1055,10 @@ immutable, the whole list is immutable. The memory allocation itself is the box, while the owner holds onto a pointer to it: ~~~ {.notrust} - List box List box List box List box - +--------------+ +--------------+ +--------------+ +--------------+ -list -> | Cons | 1 | ~ | -> | Cons | 2 | ~ | -> | Cons | 3 | ~ | -> | Nil | - +--------------+ +--------------+ +--------------+ +--------------+ + List box List box List box List box + +--------------+ +--------------+ +--------------+ +----------+ +list -> | Cons | 1 | ~ | -> | Cons | 2 | ~ | -> | Cons | 3 | ~ | -> | Nil | + +--------------+ +--------------+ +--------------+ +----------+ ~~~ > *Note:* the above diagram shows the logical contents of the enum. The actual @@ -1197,7 +1198,8 @@ fn eq(xs: &List, ys: &List) -> bool { // If we have reached the end of both lists, they are equal. (&Nil, &Nil) => true, // If the current element in both lists is equal, keep going. - (&Cons(x, ~ref next_xs), &Cons(y, ~ref next_ys)) if x == y => eq(next_xs, next_ys), + (&Cons(x, ~ref next_xs), &Cons(y, ~ref next_ys)) + if x == y => eq(next_xs, next_ys), // If the current elements are not equal, the lists are not equal. _ => false } @@ -1256,7 +1258,7 @@ Using the generic `List` works much like before, thanks to type inference: # Cons(value, ~xs) # } let mut xs = Nil; // Unknown type! This is a `List`, but `T` can be anything. -xs = prepend(xs, 10); // The compiler infers the type of `xs` as `List` from this. +xs = prepend(xs, 10); // Here the compiler infers `xs`'s type as `List`. xs = prepend(xs, 15); xs = prepend(xs, 20); ~~~ @@ -1303,7 +1305,8 @@ fn eq(xs: &List, ys: &List) -> bool { // If we have reached the end of both lists, they are equal. (&Nil, &Nil) => true, // If the current element in both lists is equal, keep going. - (&Cons(ref x, ~ref next_xs), &Cons(ref y, ~ref next_ys)) if x == y => eq(next_xs, next_ys), + (&Cons(ref x, ~ref next_xs), &Cons(ref y, ~ref next_ys)) + if x == y => eq(next_xs, next_ys), // If the current elements are not equal, the lists are not equal. _ => false } @@ -1331,7 +1334,8 @@ impl Eq for List { // If we have reached the end of both lists, they are equal. (&Nil, &Nil) => true, // If the current element in both lists is equal, keep going. - (&Cons(ref x, ~ref next_xs), &Cons(ref y, ~ref next_ys)) if x == y => next_xs == next_ys, + (&Cons(ref x, ~ref next_xs), &Cons(ref y, ~ref next_ys)) + if x == y => next_xs == next_ys, // If the current elements are not equal, the lists are not equal. _ => false } diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index fa285185a6184..fab3ca80099b9 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -209,7 +209,7 @@ pub fn render(w: &mut io::Writer, s: &str, print_toc: bool) -> fmt::Result { }; // Render the HTML - let text = format!(r#"{sec_len,plural,=0{}other{{sec} }}{}"#, s, lvl = level, id = id, sec_len = sec.len(), sec = sec); diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 539eb42305c77..63aec6395c3a0 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -1121,7 +1121,7 @@ fn item_module(w: &mut Writer, cx: &Context, clean::MacroItem(..) => ("macros", "Macros"), }; try!(write!(w, - "

\ {name}

\n", id = short, name = name)); } diff --git a/src/librustdoc/html/static/main.css b/src/librustdoc/html/static/main.css index b5ce3919bdd79..f8cff5c3a673a 100644 --- a/src/librustdoc/html/static/main.css +++ b/src/librustdoc/html/static/main.css @@ -53,32 +53,40 @@ body { color: #333; min-width: 500px; - font: 18px "Heuristica", "Helvetica Neue", Helvetica, Arial, sans-serif; - line-height: 1.4; + font: 15.5px/1.4 "Heuristica", "Helvetica Neue", Helvetica, Arial, sans-serif; margin: 0; position: relative; padding: 10px 15px 20px 15px; } -h1, h2, h3:not(.impl), h4:not(.method) { +h1 { + font-size: 1.5em; +} +h2 { + font-size: 1.4em; +} +h3 { + font-size: 1.3em; +} +h1, h2, h3:not(.impl):not(.method), h4:not(.method) { color: black; font-weight: 500; - margin: 30px 0 15px 0; + margin: 20px 0 15px 0; padding-bottom: 6px; } h1.fqn { border-bottom: 1px dashed #D5D5D5; margin-top: 0; } -h2, h3:not(.impl), h4:not(.method) { +h2, h3:not(.impl):not(.method), h4:not(.method) { border-bottom: 1px solid #DDDDDD; } -h3.impl, h4.method { +h3.impl, h3.method, h4.method { font-weight: 600; margin-top: 10px; margin-bottom: 10px; } -h3.impl { +h3.impl, h3.method { margin-top: 15px; } h1, h2, h3, h4, section.sidebar, a.source, .search-input, .content table a { @@ -93,7 +101,7 @@ ul ul, ol ul, ul ol, ol ol { } p { - margin: 0 0 1em 0; + margin: 0 0 .6em 0; } code, pre { @@ -101,19 +109,15 @@ code, pre { white-space: pre-wrap; } pre { - font-size: 15px; + background-color: #F5F5F5; padding: 14px; - padding-right: 0; - border-left: 2px solid #eee; } .source pre { - border-left: none; padding: 20px; } nav.sub { - padding-top: 10px; font-size: 16px; text-transform: uppercase; } @@ -149,7 +153,7 @@ nav.sub { } .block { - padding: 10px; + padding: 0 10px; margin-bottom: 10px; } .block h2 { @@ -170,7 +174,7 @@ nav.sub { } .content { - padding: 20px 0; + padding: 15px 0; } .content.source pre.rust { @@ -207,9 +211,9 @@ nav.sub { text-overflow: ellipsis; margin: 0; } +.docblock.short code { white-space: nowrap; } .docblock h1, .docblock h2, .docblock h3, .docblock h4, .docblock h5 { - margin: 30px 0 15px 0; border-bottom: 1px solid #DDD; } @@ -363,9 +367,10 @@ a { .stability { border-left: 6px solid #000; border-radius: 3px; - padding: 2px 10px; + font-weight: 400; + padding: 4px 10px; text-transform: lowercase; - margin-left: 10px; + margin-left: 14px; } .stability.Deprecated { border-color: #D60027; color: #880017; } @@ -388,16 +393,18 @@ pre.rust .doccomment { color: #4D4D4C; } pre.rust .macro, pre.rust .macro-nonterminal { color: #3E999F; } pre.rust .lifetime { color: #B76514; } -h1.section-link:hover a:after, -h2.section-link:hover a:after, -h3.section-link:hover a:after, -h4.section-link:hover a:after, -h5.section-link:hover a:after, -h6.section-link:hover a:after { - content: '\2002\00a7\2002'; +.section-header { + /* Override parent class attributes. */ + border-bottom: none !important; + font-size: 1.1em !important; + margin: 0 0 -5px; + padding: 0; +} +.section-header:hover a:after { + content: '\2002\00a7\2002'; } -/** Media Queries **/ +/* Media Queries */ @media (max-width: 700px) { .sidebar {