Skip to content

Commit

Permalink
Include type in non-exhaustive message. Include new css in dark theme.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtwco committed Jun 27, 2018
1 parent a074bd7 commit 039709d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/librustdoc/html/render.rs
Expand Up @@ -2265,21 +2265,22 @@ fn document_stability(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item)

fn document_non_exhaustive(w: &mut fmt::Formatter, item: &clean::Item) -> fmt::Result {
if item.non_exhaustive {
let name = item.type_();
write!(w, r##"
<div class='non-exhaustive'>
<div class='stab non-exhaustive'>
<details>
<summary>
<span class=microscope>🔬</span>
This type is marked as non exhaustive.
This {} is marked as non exhaustive.
</summary>
<p>
This type will require a wildcard arm in any match statements or constructors.
This {} will require a wildcard arm in any match statements or constructors.
</p>
</details>
</div>
</div>
"##)?;
"##, name, name)?;
}

Ok(())
Expand Down
3 changes: 2 additions & 1 deletion src/librustdoc/html/static/themes/dark.css
Expand Up @@ -188,6 +188,7 @@ a.test-arrow {
border-color: #008dfd;
}

.stab.non-exhaustive { background: #2a2a2a; border-color: #707070; }
.stab.unstable { background: #FFF5D6; border-color: #FFC600; color: #404040; }
.stab.deprecated { background: #F3DFFF; border-color: #7F0087; color: #404040; }
.stab.portability { background: #C4ECFF; border-color: #7BA5DB; color: #404040; }
Expand Down Expand Up @@ -406,4 +407,4 @@ kbd {
}
.search-results td span.grey {
color: #ccc;
}
}

0 comments on commit 039709d

Please sign in to comment.