Skip to content

Commit 3f517fb

Browse files
committed
Split CSS classes for "typedef" vs "associatedtype".
1 parent c8e0f97 commit 3f517fb

File tree

8 files changed

+31
-17
lines changed

8 files changed

+31
-17
lines changed

Diff for: src/librustdoc/html/format.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,7 @@ fn fmt_type<'cx>(
944944
Ok((ref url, _, ref path)) if !f.alternate() => {
945945
write!(
946946
f,
947-
"<a class=\"type\" href=\"{url}#{shortty}.{name}\" \
947+
"<a class=\"associatedtype\" href=\"{url}#{shortty}.{name}\" \
948948
title=\"type {path}::{name}\">{name}</a>",
949949
url = url,
950950
shortty = ItemType::AssocType,

Diff for: src/librustdoc/html/render/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ fn assoc_type(
797797
) {
798798
write!(
799799
w,
800-
"{}type <a href=\"{}\" class=\"type\">{}</a>",
800+
"{}type <a href=\"{}\" class=\"associatedtype\">{}</a>",
801801
extra,
802802
naive_assoc_href(it, link, cx),
803803
it.name.as_ref().unwrap()

Diff for: src/librustdoc/html/static/css/themes/ayu.css

+10-2
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,12 @@ pre, .rustdoc.source .example-wrap {
190190
.content span.type, .content a.type {
191191
color: #39AFD7;
192192
}
193+
.content span.type,
194+
.content a.type,
195+
.block a.current.type { color: #39AFD7; }
196+
.content span.associatedtype,
197+
.content a.associatedtype,
198+
.block a.current.associatedtype { color: #39AFD7; }
193199
.content span.fn, .content a.fn, .content span.method,
194200
.content a.method, .content span.tymethod,
195201
.content a.tymethod, .content .fnname {
@@ -454,11 +460,12 @@ above the `@media (max-width: 700px)` rules due to a bug in the css checker */
454460
.block a.current.derive,.content span.macro,.content a.macro,.block a.current.macro {}
455461
.content span.struct,.content a.struct,.block a.current.struct {}
456462
#titles>button:hover,#titles>button.selected {}
457-
.content span.type,.content a.type,.block a.current.type {}
463+
.content span.typedef,.content a.typedef,.block a.current.typedef {}
458464
.content span.union,.content a.union,.block a.current.union {}
459465
pre.rust .lifetime {}
460466
.stab.unstable {}
461-
h2,h3:not(.impl):not(.method):not(.type):not(.tymethod),h4:not(.method):not(.type):not(.tymethod) {}
467+
h2,
468+
h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.type):not(.tymethod) {}
462469
.content span.enum,.content a.enum,.block a.current.enum {}
463470
.content span.constant,.content a.constant,.block a.current.constant,.content span.static,
464471
.content a.static, .block a.current.static {}
@@ -495,6 +502,7 @@ a.result-fn:focus,
495502
a.result-method:focus,
496503
a.result-tymethod:focus {}
497504
a.result-type:focus {}
505+
a.result-associatedtype:focus {}
498506
a.result-foreigntype:focus {}
499507
a.result-attr:focus,
500508
a.result-derive:focus,

Diff for: src/librustdoc/html/static/css/themes/dark.css

+6-2
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ a.result-union:focus { background-color: #194e9f; }
126126
a.result-fn:focus,
127127
a.result-method:focus,
128128
a.result-tymethod:focus { background-color: #4950ed; }
129-
a.result-type:focus { background-color: #884719; }
129+
a.result-type:focus { background-color: #194e9f; }
130+
a.result-associatedtype:focus { background-color: #884719; }
130131
a.result-foreigntype:focus { background-color: #194e9f; }
131132
a.result-attr:focus,
132133
a.result-derive:focus,
@@ -140,7 +141,10 @@ a.result-keyword:focus { background-color: #884719; }
140141

141142
.content span.enum, .content a.enum, .block a.current.enum { color: #2dbfb8; }
142143
.content span.struct, .content a.struct, .block a.current.struct { color: #2dbfb8; }
143-
.content span.type, .content a.type, .block a.current.type { color: #D2991D; }
144+
.content span.type, .content a.type, .block a.current.type { color: #2dbfb8; }
145+
.content span.associatedtype,
146+
.content a.associatedtype,
147+
.block a.current.associatedtype { color: #D2991D; }
144148
.content span.foreigntype, .content a.foreigntype, .block a.current.foreigntype { color: #2dbfb8; }
145149
.content span.attr, .content a.attr, .block a.current.attr,
146150
.content span.derive, .content a.derive, .block a.current.derive,

Diff for: src/librustdoc/html/static/css/themes/light.css

+7-3
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ a.result-union:focus { background-color: #e7b1a0; }
126126
a.result-fn:focus,
127127
a.result-method:focus,
128128
a.result-tymethod:focus { background-color: #c6afb3; }
129-
a.result-type:focus { background-color: #afc6e4; }
129+
a.result-type:focus { background-color: #e7b1a0; }
130+
a.result-associatedtype:focus { background-color: #afc6e4; }
130131
a.result-foreigntype:focus { background-color: #e7b1a0; }
131132
a.result-attr:focus,
132133
a.result-derive:focus,
@@ -140,8 +141,11 @@ a.result-keyword:focus { background-color: #afc6e4; }
140141

141142
.content span.enum, .content a.enum, .block a.current.enum { color: #AD378A; }
142143
.content span.struct, .content a.struct, .block a.current.struct { color: #AD378A; }
143-
.content span.type, .content a.type, .block a.current.type { color: #3873AD; }
144-
.content span.foreigntype, .content a.foreigntype, .block a.current.foreigntype { color: #AD378A; }
144+
.content span.type, .content a.type, .block a.current.type { color: #AD378A; }
145+
.content span.foreigntype, .content a.foreigntype, .block a.current.foreigntype { color: #3873AD; }
146+
.content span.associatedtype,
147+
.content a.associatedtype,
148+
.block a.current.associatedtype { color: #3873AD; }
145149
.content span.attr, .content a.attr, .block a.current.attr,
146150
.content span.derive, .content a.derive, .block a.current.derive,
147151
.content span.macro, .content a.macro, .block a.current.macro { color: #068000; }

Diff for: src/test/rustdoc-gui/font-weight.goml

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ goto: file://|DOC_PATH|/lib2/trait.Trait.html
2828
assert-count: ("//*[@class='docblock item-decl']/pre[@class='rust trait']/code/a[@class='constant']//text()/parent::*", 1)
2929
assert-css: ("//*[@class='docblock item-decl']/pre[@class='rust trait']/code/a[@class='constant']//text()/parent::*", {"font-weight": "400"})
3030

31-
assert-count: (".methods .type", 1)
32-
assert-css: (".methods .type", {"font-weight": "600"})
31+
assert-count: (".methods .associatedtype", 1)
32+
assert-css: (".methods .associatedtype", {"font-weight": "600"})
3333
assert-count: (".methods .constant", 1)
3434
assert-css: (".methods .constant", {"font-weight": "600"})
3535
assert-css: (".methods .method", {"font-weight": "600"})

Diff for: src/test/rustdoc/assoc-item-cast.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#![crate_name = "foo"]
22

3-
43
pub trait Expression {
54
type SqlType;
65
}
@@ -11,5 +10,5 @@ pub trait AsExpression<T> {
1110
}
1211

1312
// @has foo/type.AsExprOf.html
14-
// @has - '//*[@class="rust typedef"]' 'type AsExprOf<Item, Type> = <Item as AsExpression<Type>>::Expression;'
13+
// @has - '//pre[@class="rust typedef"]' 'type AsExprOf<Item, Type> = <Item as AsExpression<Type>>::Expression;'
1514
pub type AsExprOf<Item, Type> = <Item as AsExpression<Type>>::Expression;

Diff for: src/test/rustdoc/trait-impl-items-links-and-anchors.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ pub trait MyTrait {
66
fn defaulted_override(&self) {}
77
}
88

9-
109
impl MyTrait for String {
11-
// @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-1"]//a[@class="type"]/@href' #associatedtype.Assoc
10+
// @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-1"]//a[@class="associatedtype"]/@href' #associatedtype.Assoc
1211
// @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-1"]//a[@class="anchor"]/@href' #associatedtype.Assoc-1
1312
type Assoc = ();
1413
// @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 {
2322
}
2423

2524
impl MyTrait for Vec<u8> {
26-
// @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-2"]//a[@class="type"]/@href' #associatedtype.Assoc
25+
// @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-2"]//a[@class="associatedtype"]/@href' #associatedtype.Assoc
2726
// @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-2"]//a[@class="anchor"]/@href' #associatedtype.Assoc-2
2827
type Assoc = ();
2928
// @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<u8> {
3938

4039
impl MyTrait for MyStruct {
4140
// @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-3"]//a[@class="anchor"]/@href' #associatedtype.Assoc-3
42-
// @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedtype.Assoc"]//a[@class="type"]/@href' trait.MyTrait.html#associatedtype.Assoc
41+
// @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedtype.Assoc"]//a[@class="associatedtype"]/@href' trait.MyTrait.html#associatedtype.Assoc
4342
// @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedtype.Assoc"]//a[@class="anchor"]/@href' #associatedtype.Assoc
4443
type Assoc = bool;
4544
// @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedconstant.VALUE-3"]//a[@class="anchor"]/@href' #associatedconstant.VALUE-3

0 commit comments

Comments
 (0)