Auto merge of #46574 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 5 pull requests

- Successful merges: #46416, #46444, #46526, #46539, #46548
- Failed merges:
This commit is contained in:
bors 2017-12-08 02:36:15 +00:00
commit 5f4b09ee48
10 changed files with 207 additions and 41 deletions

1
.gitattributes vendored
View file

@ -7,3 +7,4 @@
src/etc/installer/gfx/* binary src/etc/installer/gfx/* binary
*.woff binary *.woff binary
src/vendor/** -text src/vendor/** -text
Cargo.lock -merge

View file

@ -736,7 +736,7 @@ mod builtin {
#[cfg(dox)] #[cfg(dox)]
macro_rules! module_path { () => ({ /* compiler built-in */ }) } macro_rules! module_path { () => ({ /* compiler built-in */ }) }
/// Boolean evaluation of configuration flags. /// Boolean evaluation of configuration flags, at compile-time.
/// ///
/// For more information, see the documentation for [`std::cfg!`]. /// For more information, see the documentation for [`std::cfg!`].
/// ///

View file

@ -338,6 +338,12 @@ impl<T> Option<T> {
/// Returns the contained value or a default. /// Returns the contained value or a default.
/// ///
/// Arguments passed to `unwrap_or` are eagerly evaluated; if you are passing
/// the result of a function call, it is recommended to use [`unwrap_or_else`],
/// which is lazily evaluated.
///
/// [`unwrap_or_else`]: #method.unwrap_or_else
///
/// # Examples /// # Examples
/// ///
/// ``` /// ```
@ -451,11 +457,16 @@ impl<T> Option<T> {
/// Transforms the `Option<T>` into a [`Result<T, E>`], mapping [`Some(v)`] to /// Transforms the `Option<T>` into a [`Result<T, E>`], mapping [`Some(v)`] to
/// [`Ok(v)`] and [`None`] to [`Err(err)`]. /// [`Ok(v)`] and [`None`] to [`Err(err)`].
/// ///
/// Arguments passed to `ok_or` are eagerly evaluated; if you are passing the
/// result of a function call, it is recommended to use [`ok_or_else`], which is
/// lazily evaluated.
///
/// [`Result<T, E>`]: ../../std/result/enum.Result.html /// [`Result<T, E>`]: ../../std/result/enum.Result.html
/// [`Ok(v)`]: ../../std/result/enum.Result.html#variant.Ok /// [`Ok(v)`]: ../../std/result/enum.Result.html#variant.Ok
/// [`Err(err)`]: ../../std/result/enum.Result.html#variant.Err /// [`Err(err)`]: ../../std/result/enum.Result.html#variant.Err
/// [`None`]: #variant.None /// [`None`]: #variant.None
/// [`Some(v)`]: #variant.Some /// [`Some(v)`]: #variant.Some
/// [`ok_or_else`]: #method.ok_or_else
/// ///
/// # Examples /// # Examples
/// ///
@ -644,6 +655,12 @@ impl<T> Option<T> {
/// Returns the option if it contains a value, otherwise returns `optb`. /// Returns the option if it contains a value, otherwise returns `optb`.
/// ///
/// Arguments passed to `or` are eagerly evaluated; if you are passing the
/// result of a function call, it is recommended to use [`or_else`], which is
/// lazily evaluated.
///
/// [`or_else`]: #method.or_else
///
/// # Examples /// # Examples
/// ///
/// ``` /// ```

View file

@ -625,8 +625,13 @@ impl<T, E> Result<T, E> {
/// Returns `res` if the result is [`Err`], otherwise returns the [`Ok`] value of `self`. /// Returns `res` if the result is [`Err`], otherwise returns the [`Ok`] value of `self`.
/// ///
/// Arguments passed to `or` are eagerly evaluated; if you are passing the
/// result of a function call, it is recommended to use [`or_else`], which is
/// lazily evaluated.
///
/// [`Ok`]: enum.Result.html#variant.Ok /// [`Ok`]: enum.Result.html#variant.Ok
/// [`Err`]: enum.Result.html#variant.Err /// [`Err`]: enum.Result.html#variant.Err
/// [`or_else`]: #method.or_else
/// ///
/// # Examples /// # Examples
/// ///
@ -690,8 +695,13 @@ impl<T, E> Result<T, E> {
/// Unwraps a result, yielding the content of an [`Ok`]. /// Unwraps a result, yielding the content of an [`Ok`].
/// Else, it returns `optb`. /// Else, it returns `optb`.
/// ///
/// Arguments passed to `unwrap_or` are eagerly evaluated; if you are passing
/// the result of a function call, it is recommended to use [`unwrap_or_else`],
/// which is lazily evaluated.
///
/// [`Ok`]: enum.Result.html#variant.Ok /// [`Ok`]: enum.Result.html#variant.Ok
/// [`Err`]: enum.Result.html#variant.Err /// [`Err`]: enum.Result.html#variant.Err
/// [`unwrap_or_else`]: #method.unwrap_or_else
/// ///
/// # Examples /// # Examples
/// ///

View file

@ -65,6 +65,7 @@ r##"<!DOCTYPE html>
{before_content} {before_content}
<nav class="sidebar"> <nav class="sidebar">
<div class="sidebar-menu">&#9776;</div>
{logo} {logo}
{sidebar} {sidebar}
</nav> </nav>

View file

@ -3542,6 +3542,7 @@ impl<'a> fmt::Display for Sidebar<'a> {
let cx = self.cx; let cx = self.cx;
let it = self.item; let it = self.item;
let parentlen = cx.current.len() - if it.is_mod() {1} else {0}; let parentlen = cx.current.len() - if it.is_mod() {1} else {0};
let mut should_close = false;
if it.is_struct() || it.is_trait() || it.is_primitive() || it.is_union() if it.is_struct() || it.is_trait() || it.is_primitive() || it.is_union()
|| it.is_enum() || it.is_mod() || it.is_typedef() || it.is_enum() || it.is_mod() || it.is_typedef()
@ -3575,6 +3576,8 @@ impl<'a> fmt::Display for Sidebar<'a> {
} }
} }
write!(fmt, "<div class=\"sidebar-elems\">")?;
should_close = true;
match it.inner { match it.inner {
clean::StructItem(ref s) => sidebar_struct(fmt, it, s)?, clean::StructItem(ref s) => sidebar_struct(fmt, it, s)?,
clean::TraitItem(ref t) => sidebar_trait(fmt, it, t)?, clean::TraitItem(ref t) => sidebar_trait(fmt, it, t)?,
@ -3625,6 +3628,10 @@ impl<'a> fmt::Display for Sidebar<'a> {
write!(fmt, "<script defer src=\"{path}sidebar-items.js\"></script>", write!(fmt, "<script defer src=\"{path}sidebar-items.js\"></script>",
path = relpath)?; path = relpath)?;
} }
if should_close {
// Closes sidebar-elems div.
write!(fmt, "</div>")?;
}
Ok(()) Ok(())
} }

View file

@ -106,6 +106,30 @@
return (elem.offsetParent === null) return (elem.offsetParent === null)
} }
function showSidebar() {
var elems = document.getElementsByClassName("sidebar-elems")[0];
if (elems) {
elems.style.display = "block";
}
var sidebar = document.getElementsByClassName('sidebar')[0];
sidebar.style.position = 'fixed';
sidebar.style.width = '100%';
sidebar.style.marginLeft = '0';
document.getElementsByTagName("body")[0].style.marginTop = '45px';
}
function hideSidebar() {
var elems = document.getElementsByClassName("sidebar-elems")[0];
if (elems) {
elems.style.display = "";
}
var sidebar = document.getElementsByClassName('sidebar')[0];
sidebar.style.position = '';
sidebar.style.width = '';
sidebar.style.marginLeft = '';
document.getElementsByTagName("body")[0].style.marginTop = '';
}
// used for special search precedence // used for special search precedence
var TY_PRIMITIVE = itemTypes.indexOf("primitive"); var TY_PRIMITIVE = itemTypes.indexOf("primitive");
@ -130,6 +154,8 @@
} }
function highlightSourceLines(ev) { function highlightSourceLines(ev) {
// If we're in mobile mode, we should add the sidebar in any case.
hideSidebar();
var search = document.getElementById("search"); var search = document.getElementById("search");
var i, from, to, match = window.location.hash.match(/^#?(\d+)(?:-(\d+))?$/); var i, from, to, match = window.location.hash.match(/^#?(\d+)(?:-(\d+))?$/);
if (match) { if (match) {
@ -1459,7 +1485,7 @@
// delayed sidebar rendering. // delayed sidebar rendering.
function initSidebarItems(items) { function initSidebarItems(items) {
var sidebar = document.getElementsByClassName('sidebar')[0]; var sidebar = document.getElementsByClassName('sidebar-elems')[0];
var current = window.sidebarCurrent; var current = window.sidebarCurrent;
function block(shortty, longty) { function block(shortty, longty) {
@ -1829,6 +1855,22 @@
removeClass(search, "hidden"); removeClass(search, "hidden");
search.innerHTML = '<h3 style="text-align: center;">Loading search results...</h3>'; search.innerHTML = '<h3 style="text-align: center;">Loading search results...</h3>';
} }
var sidebar_menu = document.getElementsByClassName("sidebar-menu")[0];
if (sidebar_menu) {
sidebar_menu.onclick = function() {
var sidebar = document.getElementsByClassName('sidebar')[0];
if (sidebar.style.position === "fixed") {
hideSidebar();
} else {
showSidebar();
}
};
}
window.onresize = function() {
hideSidebar();
};
}()); }());
// Sets the focus on the search bar at the top of the page // Sets the focus on the search bar at the top of the page

View file

@ -208,7 +208,7 @@ nav.sub {
.sidebar .version { .sidebar .version {
font-size: 15px; font-size: 15px;
text-align: center; text-align: center;
border-bottom: #DDDDDD 1px solid; border-bottom: 1px solid;
overflow-wrap: break-word; overflow-wrap: break-word;
word-wrap: break-word; /* deprecated */ word-wrap: break-word; /* deprecated */
word-break: break-word; /* Chrome, non-standard */ word-break: break-word; /* Chrome, non-standard */
@ -247,8 +247,8 @@ nav.sub {
} }
.sidebar-title { .sidebar-title {
border-top: 1px solid #777; border-top: 1px solid;
border-bottom: 1px solid #777; border-bottom: 1px solid;
text-align: center; text-align: center;
font-size: 17px; font-size: 17px;
margin-bottom: 5px; margin-bottom: 5px;
@ -263,6 +263,10 @@ nav.sub {
width: 100%; width: 100%;
} }
.sidebar-menu {
display: none;
}
.content { .content {
padding: 15px 0; padding: 15px 0;
} }
@ -364,7 +368,6 @@ h4 > code, h3 > code, .invisible > code {
} }
.invisible { .invisible {
background: rgba(0, 0, 0, 0);
width: 100%; width: 100%;
display: inline-block; display: inline-block;
} }
@ -444,7 +447,6 @@ h4 > code, h3 > code, .invisible > code {
.content .fn .where, .content .fn .where,
.content .where.fmt-newline { .content .where.fmt-newline {
display: block; display: block;
color: #4E4C4C;
font-size: 0.8em; font-size: 0.8em;
} }
@ -538,7 +540,6 @@ a {
} }
.search-input:focus { .search-input:focus {
border-color: #66afe9;
border-radius: 2px; border-radius: 2px;
border: 0; border: 0;
outline: 0; outline: 0;
@ -560,7 +561,8 @@ a {
.content .search-results td:first-child a { padding-right: 10px; } .content .search-results td:first-child a { padding-right: 10px; }
tr.result span.primitive::after { tr.result span.primitive::after {
content: ' (primitive type)'; font-style: italic; color: black; content: ' (primitive type)';
font-style: italic;
} }
body.blur > :not(#help) { body.blur > :not(#help) {
@ -697,7 +699,6 @@ a.test-arrow:hover{
font-weight: 300; font-weight: 300;
position: absolute; position: absolute;
left: -23px; left: -23px;
color: #999;
top: 0; top: 0;
} }
@ -823,7 +824,7 @@ span.since {
position: static; position: static;
} }
.sidebar .location { .sidebar > .location {
float: right; float: right;
margin: 0px; margin: 0px;
margin-top: 2px; margin-top: 2px;
@ -843,16 +844,33 @@ span.since {
margin-top: 5px; margin-top: 5px;
margin-bottom: 5px; margin-bottom: 5px;
float: left; float: left;
margin-left: 50px;
}
.sidebar-menu {
position: absolute;
font-size: 2rem;
cursor: pointer;
margin-top: 2px;
display: block;
}
.sidebar-elems {
background-color: #F1F1F1;
position: fixed;
z-index: 1;
left: 0;
top: 45px;
bottom: 0;
overflow-y: auto;
border-right: 1px solid #000;
display: none;
} }
nav.sub { nav.sub {
margin: 0 auto; margin: 0 auto;
} }
.sidebar .block {
display: none;
}
.content { .content {
margin-left: 0px; margin-left: 0px;
} }
@ -904,8 +922,6 @@ span.since {
.tooltip .tooltiptext { .tooltip .tooltiptext {
width: 120px; width: 120px;
display: none; display: none;
background-color: black;
color: #fff;
text-align: center; text-align: center;
padding: 5px 3px; padding: 5px 3px;
border-radius: 6px; border-radius: 6px;
@ -927,13 +943,10 @@ span.since {
margin-top: -5px; margin-top: -5px;
border-width: 5px; border-width: 5px;
border-style: solid; border-style: solid;
border-color: transparent black transparent transparent;
} }
.important-traits .tooltip .tooltiptext { .important-traits .tooltip .tooltiptext {
background-color: white; border: 1px solid;
color: black;
border: 1px solid #000;
} }
pre.rust { pre.rust {
@ -953,22 +966,21 @@ pre.rust {
float: left; float: left;
width: 33.3%; width: 33.3%;
text-align: center; text-align: center;
border-bottom: 1px solid #ccc; border-bottom: 1px solid;
font-size: 18px; font-size: 18px;
cursor: pointer; cursor: pointer;
} }
#titles > div.selected { #titles > div.selected {
border-bottom: 3px solid #0078ee; border-bottom: 3px solid;
} }
#titles > div:hover { #titles > div:hover {
border-bottom: 3px solid #0089ff; border-bottom: 3px solid;
} }
#titles > div > div.count { #titles > div > div.count {
display: inline-block; display: inline-block;
color: #888;
font-size: 16px; font-size: 16px;
} }
@ -987,7 +999,6 @@ h4 > .important-traits {
position: fixed; position: fixed;
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
background-color: rgba(0,0,0,0.3);
z-index: 10000; z-index: 10000;
top: 0; top: 0;
left: 0; left: 0;
@ -997,13 +1008,12 @@ h4 > .important-traits {
display: block; display: block;
max-width: 60%; max-width: 60%;
min-width: 200px; min-width: 200px;
background-color: #eee;
padding: 8px; padding: 8px;
top: 40%; top: 40%;
position: absolute; position: absolute;
left: 50%; left: 50%;
transform: translate(-50%, -40%); transform: translate(-50%, -40%);
border: 1px solid #999; border: 1px solid;
border-radius: 4px; border-radius: 4px;
border-top-right-radius: 0; border-top-right-radius: 0;
} }
@ -1030,35 +1040,24 @@ h3.important {
right: -25px; right: -25px;
top: -1px; top: -1px;
font-size: 18px; font-size: 18px;
background-color: #eee;
width: 25px; width: 25px;
padding-right: 2px; padding-right: 2px;
border-top-right-radius: 5px; border-top-right-radius: 5px;
border-bottom-right-radius: 5px; border-bottom-right-radius: 5px;
text-align: center; text-align: center;
border: 1px solid #999; border: 1px solid;
border-right: 0; border-right: 0;
cursor: pointer; cursor: pointer;
} }
.modal-content > .close:hover {
background-color: #ff1f1f;
color: white;
}
.modal-content > .whiter { .modal-content > .whiter {
height: 25px; height: 25px;
position: absolute; position: absolute;
width: 3px; width: 3px;
background-color: #eee;
right: -2px; right: -2px;
top: 0px; top: 0px;
} }
.modal-content > .close:hover + .whiter {
background-color: #ff1f1f;
}
#main > div.important-traits { #main > div.important-traits {
position: absolute; position: absolute;
left: -24px; left: -24px;

View file

@ -31,6 +31,10 @@ h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.t
background-color: white; background-color: white;
} }
.invisible {
background: rgba(0, 0, 0, 0);
}
.docblock code, .docblock-short code { .docblock code, .docblock-short code {
background-color: #F5F5F5; background-color: #F5F5F5;
} }
@ -56,6 +60,15 @@ pre {
color: #333; color: #333;
} }
.sidebar .version {
border-bottom-color: #DDD;
}
.sidebar-title {
border-top-color: #777;
border-bottom-color: #777;
}
.block a:hover { .block a:hover {
background: #F5F5F5; background: #F5F5F5;
} }
@ -89,6 +102,12 @@ pre {
background: #FDFFD3; background: #FDFFD3;
} }
.content .method .where,
.content .fn .where,
.content .where.fmt-newline {
color: #4E4C4C;
}
.content .highlighted { .content .highlighted {
color: #000 !important; color: #000 !important;
background-color: #ccc; background-color: #ccc;
@ -152,12 +171,20 @@ a.test-arrow {
color: #f5f5f5; color: #f5f5f5;
} }
.collapse-toggle {
color: #999;
}
.search-input { .search-input {
color: #555; color: #555;
box-shadow: 0 0 0 1px #e0e0e0, 0 0 0 2px transparent; box-shadow: 0 0 0 1px #e0e0e0, 0 0 0 2px transparent;
background-color: white; background-color: white;
} }
.search-input:focus {
border-color: #66afe9;
}
.stab.unstable { background: #FFF5D6; border-color: #FFC600; } .stab.unstable { background: #FFF5D6; border-color: #FFC600; }
.stab.deprecated { background: #F3DFFF; border-color: #7F0087; } .stab.deprecated { background: #F3DFFF; border-color: #7F0087; }
.stab.portability { background: #C4ECFF; border-color: #7BA5DB; } .stab.portability { background: #C4ECFF; border-color: #7BA5DB; }
@ -176,6 +203,10 @@ a.test-arrow {
color: grey; color: grey;
} }
tr.result span.primitive::after {
color: black;
}
.line-numbers :target { background-color: transparent; } .line-numbers :target { background-color: transparent; }
/* Code highlighting */ /* Code highlighting */
@ -241,3 +272,61 @@ pre.ignore:hover, .information:hover + pre.ignore {
.search-failed > a { .search-failed > a {
color: #0089ff; color: #0089ff;
} }
.tooltip .tooltiptext {
background-color: black;
color: #fff;
}
.tooltip .tooltiptext::after {
border-color: transparent black transparent transparent;
}
.important-traits .tooltip .tooltiptext {
background-color: white;
color: black;
border-color: black;
}
#titles > div {
border-bottom-color: #ccc;
}
#titles > div.selected {
border-bottom-color: #0078ee;
}
#titles > div:hover {
border-bottom-color: #0089ff;
}
#titles > div > div.count {
color: #888;
}
.modal {
background-color: rgba(0,0,0,0.3);
}
.modal-content {
background-color: #eee;
border-color: #999;
}
.modal-content > .close {
background-color: #eee;
border-color: #999;
}
.modal-content > .close:hover {
background-color: #ff1f1f;
color: white;
}
.modal-content > .whiter {
background-color: #eee;
}
.modal-content > .close:hover + .whiter {
background-color: #ff1f1f;
}

View file

@ -631,7 +631,7 @@ pub mod builtin {
#[macro_export] #[macro_export]
macro_rules! module_path { () => ({ /* compiler built-in */ }) } macro_rules! module_path { () => ({ /* compiler built-in */ }) }
/// Boolean evaluation of configuration flags. /// Boolean evaluation of configuration flags, at compile-time.
/// ///
/// In addition to the `#[cfg]` attribute, this macro is provided to allow /// In addition to the `#[cfg]` attribute, this macro is provided to allow
/// boolean expression evaluation of configuration flags. This frequently /// boolean expression evaluation of configuration flags. This frequently