diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 4f2049132046d..ad5d20550ee4c 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -944,7 +944,7 @@ fn fmt_type<'cx>( Ok((ref url, _, ref path)) if !f.alternate() => { write!( f, - "{name}", url = url, shortty = ItemType::AssocType, diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 24baca285c6ff..99cc9cecb1ea0 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -797,7 +797,7 @@ fn assoc_type( ) { write!( w, - "{}type {}", + "{}type {}", extra, naive_assoc_href(it, link, cx), it.name.as_ref().unwrap() diff --git a/src/librustdoc/html/static/css/themes/ayu.css b/src/librustdoc/html/static/css/themes/ayu.css index bbf9b5ba6ff55..9b98fd7582d48 100644 --- a/src/librustdoc/html/static/css/themes/ayu.css +++ b/src/librustdoc/html/static/css/themes/ayu.css @@ -190,6 +190,12 @@ pre, .rustdoc.source .example-wrap { .content span.type, .content a.type { color: #39AFD7; } +.content span.type, +.content a.type, +.block a.current.type { color: #39AFD7; } +.content span.associatedtype, +.content a.associatedtype, +.block a.current.associatedtype { color: #39AFD7; } .content span.fn, .content a.fn, .content span.method, .content a.method, .content span.tymethod, .content a.tymethod, .content .fnname { @@ -454,11 +460,12 @@ above the `@media (max-width: 700px)` rules due to a bug in the css checker */ .block a.current.derive,.content span.macro,.content a.macro,.block a.current.macro {} .content span.struct,.content a.struct,.block a.current.struct {} #titles>button:hover,#titles>button.selected {} -.content span.type,.content a.type,.block a.current.type {} +.content span.typedef,.content a.typedef,.block a.current.typedef {} .content span.union,.content a.union,.block a.current.union {} pre.rust .lifetime {} .stab.unstable {} -h2,h3:not(.impl):not(.method):not(.type):not(.tymethod),h4:not(.method):not(.type):not(.tymethod) {} +h2, +h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.type):not(.tymethod) {} .content span.enum,.content a.enum,.block a.current.enum {} .content span.constant,.content a.constant,.block a.current.constant,.content span.static, .content a.static, .block a.current.static {} @@ -495,6 +502,7 @@ a.result-fn:focus, a.result-method:focus, a.result-tymethod:focus {} a.result-type:focus {} +a.result-associatedtype:focus {} a.result-foreigntype:focus {} a.result-attr:focus, a.result-derive:focus, diff --git a/src/librustdoc/html/static/css/themes/dark.css b/src/librustdoc/html/static/css/themes/dark.css index f3aca6746c946..968a6218d984f 100644 --- a/src/librustdoc/html/static/css/themes/dark.css +++ b/src/librustdoc/html/static/css/themes/dark.css @@ -126,7 +126,8 @@ a.result-union:focus { background-color: #194e9f; } a.result-fn:focus, a.result-method:focus, a.result-tymethod:focus { background-color: #4950ed; } -a.result-type:focus { background-color: #884719; } +a.result-type:focus { background-color: #194e9f; } +a.result-associatedtype:focus { background-color: #884719; } a.result-foreigntype:focus { background-color: #194e9f; } a.result-attr:focus, a.result-derive:focus, @@ -140,7 +141,10 @@ a.result-keyword:focus { background-color: #884719; } .content span.enum, .content a.enum, .block a.current.enum { color: #2dbfb8; } .content span.struct, .content a.struct, .block a.current.struct { color: #2dbfb8; } -.content span.type, .content a.type, .block a.current.type { color: #D2991D; } +.content span.type, .content a.type, .block a.current.type { color: #2dbfb8; } +.content span.associatedtype, +.content a.associatedtype, +.block a.current.associatedtype { color: #D2991D; } .content span.foreigntype, .content a.foreigntype, .block a.current.foreigntype { color: #2dbfb8; } .content span.attr, .content a.attr, .block a.current.attr, .content span.derive, .content a.derive, .block a.current.derive, diff --git a/src/librustdoc/html/static/css/themes/light.css b/src/librustdoc/html/static/css/themes/light.css index 4bf323d3396ba..14b8461116fca 100644 --- a/src/librustdoc/html/static/css/themes/light.css +++ b/src/librustdoc/html/static/css/themes/light.css @@ -126,7 +126,8 @@ a.result-union:focus { background-color: #e7b1a0; } a.result-fn:focus, a.result-method:focus, a.result-tymethod:focus { background-color: #c6afb3; } -a.result-type:focus { background-color: #afc6e4; } +a.result-type:focus { background-color: #e7b1a0; } +a.result-associatedtype:focus { background-color: #afc6e4; } a.result-foreigntype:focus { background-color: #e7b1a0; } a.result-attr:focus, a.result-derive:focus, @@ -140,8 +141,11 @@ a.result-keyword:focus { background-color: #afc6e4; } .content span.enum, .content a.enum, .block a.current.enum { color: #AD378A; } .content span.struct, .content a.struct, .block a.current.struct { color: #AD378A; } -.content span.type, .content a.type, .block a.current.type { color: #3873AD; } -.content span.foreigntype, .content a.foreigntype, .block a.current.foreigntype { color: #AD378A; } +.content span.type, .content a.type, .block a.current.type { color: #AD378A; } +.content span.foreigntype, .content a.foreigntype, .block a.current.foreigntype { color: #3873AD; } +.content span.associatedtype, +.content a.associatedtype, +.block a.current.associatedtype { color: #3873AD; } .content span.attr, .content a.attr, .block a.current.attr, .content span.derive, .content a.derive, .block a.current.derive, .content span.macro, .content a.macro, .block a.current.macro { color: #068000; } diff --git a/src/test/rustdoc-gui/font-weight.goml b/src/test/rustdoc-gui/font-weight.goml index 0459fd4b9c353..a22167d8a1d81 100644 --- a/src/test/rustdoc-gui/font-weight.goml +++ b/src/test/rustdoc-gui/font-weight.goml @@ -28,8 +28,8 @@ goto: file://|DOC_PATH|/lib2/trait.Trait.html assert-count: ("//*[@class='docblock item-decl']/pre[@class='rust trait']/code/a[@class='constant']//text()/parent::*", 1) assert-css: ("//*[@class='docblock item-decl']/pre[@class='rust trait']/code/a[@class='constant']//text()/parent::*", {"font-weight": "400"}) -assert-count: (".methods .type", 1) -assert-css: (".methods .type", {"font-weight": "600"}) +assert-count: (".methods .associatedtype", 1) +assert-css: (".methods .associatedtype", {"font-weight": "600"}) assert-count: (".methods .constant", 1) assert-css: (".methods .constant", {"font-weight": "600"}) assert-css: (".methods .method", {"font-weight": "600"}) diff --git a/src/test/rustdoc/assoc-item-cast.rs b/src/test/rustdoc/assoc-item-cast.rs index 273fc62aa1793..a409d64131afd 100644 --- a/src/test/rustdoc/assoc-item-cast.rs +++ b/src/test/rustdoc/assoc-item-cast.rs @@ -1,6 +1,5 @@ #![crate_name = "foo"] - pub trait Expression { type SqlType; } @@ -11,5 +10,5 @@ pub trait AsExpression { } // @has foo/type.AsExprOf.html -// @has - '//*[@class="rust typedef"]' 'type AsExprOf = >::Expression;' +// @has - '//pre[@class="rust typedef"]' 'type AsExprOf = >::Expression;' pub type AsExprOf = >::Expression; diff --git a/src/test/rustdoc/trait-impl-items-links-and-anchors.rs b/src/test/rustdoc/trait-impl-items-links-and-anchors.rs index 4d25835bf08fd..db9adb4838e3e 100644 --- a/src/test/rustdoc/trait-impl-items-links-and-anchors.rs +++ b/src/test/rustdoc/trait-impl-items-links-and-anchors.rs @@ -6,9 +6,8 @@ pub trait MyTrait { fn defaulted_override(&self) {} } - impl MyTrait for String { - // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-1"]//a[@class="type"]/@href' #associatedtype.Assoc + // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-1"]//a[@class="associatedtype"]/@href' #associatedtype.Assoc // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-1"]//a[@class="anchor"]/@href' #associatedtype.Assoc-1 type Assoc = (); // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedconstant.VALUE-1"]//a[@class="constant"]/@href' #associatedconstant.VALUE @@ -23,7 +22,7 @@ impl MyTrait for String { } impl MyTrait for Vec { - // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-2"]//a[@class="type"]/@href' #associatedtype.Assoc + // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-2"]//a[@class="associatedtype"]/@href' #associatedtype.Assoc // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-2"]//a[@class="anchor"]/@href' #associatedtype.Assoc-2 type Assoc = (); // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedconstant.VALUE-2"]//a[@class="constant"]/@href' #associatedconstant.VALUE @@ -39,7 +38,7 @@ impl MyTrait for Vec { impl MyTrait for MyStruct { // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-3"]//a[@class="anchor"]/@href' #associatedtype.Assoc-3 - // @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedtype.Assoc"]//a[@class="type"]/@href' trait.MyTrait.html#associatedtype.Assoc + // @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedtype.Assoc"]//a[@class="associatedtype"]/@href' trait.MyTrait.html#associatedtype.Assoc // @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedtype.Assoc"]//a[@class="anchor"]/@href' #associatedtype.Assoc type Assoc = bool; // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedconstant.VALUE-3"]//a[@class="anchor"]/@href' #associatedconstant.VALUE-3