Skip to content

Commit c128dd8

Browse files
Deploying to gh-pages from @ 7526a78 🚀
1 parent efc2403 commit c128dd8

22 files changed

+339
-51
lines changed

api/src/rustc_codegen_spirv/builder/intrinsics.rs.html

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,8 @@
624624
<a href="#623" id="623">623</a>
625625
<a href="#624" id="624">624</a>
626626
<a href="#625" id="625">625</a>
627-
<a href="#626" id="626">626</a></pre></div><pre class="rust"><code><span class="comment">// HACK(eddyb) avoids rewriting all of the imports (see `lib.rs` and `build.rs`).
627+
<a href="#626" id="626">626</a>
628+
<a href="#627" id="627">627</a></pre></div><pre class="rust"><code><span class="comment">// HACK(eddyb) avoids rewriting all of the imports (see `lib.rs` and `build.rs`).
628629
</span><span class="kw">use </span><span class="kw">crate</span>::maybe_pqp_cg_ssa <span class="kw">as </span>rustc_codegen_ssa;
629630

630631
<span class="kw">use </span><span class="kw">super</span>::Builder;
@@ -1157,18 +1158,19 @@
11571158
<span class="kw">let </span>higher = <span class="self">self</span>.emit().u_convert(u32, <span class="prelude-val">None</span>, higher).unwrap();
11581159

11591160
<span class="kw">if </span>trailing {
1160-
<span class="kw">let </span>use_lower = <span class="self">self</span>.emit().i_equal(bool, <span class="prelude-val">None</span>, higher, u32_0).unwrap();
1161+
<span class="kw">let </span>use_lower = <span class="self">self</span>.emit().i_equal(bool, <span class="prelude-val">None</span>, lower, u32_0).unwrap();
11611162
<span class="kw">let </span>lower_bits = find_xsb(lower, <span class="number">32</span>);
11621163
<span class="kw">let </span>higher_bits = find_xsb(higher, <span class="number">0</span>);
11631164
<span class="self">self</span>.emit()
1164-
.select(u32, <span class="prelude-val">None</span>, use_lower, lower_bits, higher_bits)
1165+
.select(u32, <span class="prelude-val">None</span>, use_lower, higher_bits, lower_bits)
11651166
.unwrap()
11661167
} <span class="kw">else </span>{
1167-
<span class="kw">let </span>use_higher = <span class="self">self</span>.emit().i_equal(bool, <span class="prelude-val">None</span>, lower, u32_0).unwrap();
1168+
<span class="kw">let </span>use_higher =
1169+
<span class="self">self</span>.emit().i_equal(bool, <span class="prelude-val">None</span>, higher, u32_0).unwrap();
11681170
<span class="kw">let </span>lower_bits = find_xsb(lower, <span class="number">0</span>);
11691171
<span class="kw">let </span>higher_bits = find_xsb(higher, <span class="number">32</span>);
11701172
<span class="self">self</span>.emit()
1171-
.select(u32, <span class="prelude-val">None</span>, use_higher, higher_bits, lower_bits)
1173+
.select(u32, <span class="prelude-val">None</span>, use_higher, lower_bits, higher_bits)
11721174
.unwrap()
11731175
}
11741176
}

book/404.html

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,17 @@
4242
<script src="toc.js"></script>
4343
</head>
4444
<body>
45+
<div id="mdbook-help-container">
46+
<div id="mdbook-help-popup">
47+
<h2 class="mdbook-help-title">Keyboard shortcuts</h2>
48+
<div>
49+
<p>Press <kbd></kbd> or <kbd></kbd> to navigate between chapters</p>
50+
<p>Press <kbd>S</kbd> or <kbd>/</kbd> to search in the book</p>
51+
<p>Press <kbd>?</kbd> to show this help</p>
52+
<p>Press <kbd>Esc</kbd> to hide this help</p>
53+
</div>
54+
</div>
55+
</div>
4556
<div id="body-container">
4657
<!-- Work around some values being stored in localStorage wrapped in quotes -->
4758
<script>
@@ -119,7 +130,7 @@
119130
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
120131
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
121132
</ul>
122-
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
133+
<button id="search-toggle" class="icon-button" type="button" title="Search (`/`)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="/ s" aria-controls="searchbar">
123134
<i class="fa fa-search"></i>
124135
</button>
125136
</div>

book/attributes.html

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@
4141
<script src="toc.js"></script>
4242
</head>
4343
<body>
44+
<div id="mdbook-help-container">
45+
<div id="mdbook-help-popup">
46+
<h2 class="mdbook-help-title">Keyboard shortcuts</h2>
47+
<div>
48+
<p>Press <kbd></kbd> or <kbd></kbd> to navigate between chapters</p>
49+
<p>Press <kbd>S</kbd> or <kbd>/</kbd> to search in the book</p>
50+
<p>Press <kbd>?</kbd> to show this help</p>
51+
<p>Press <kbd>Esc</kbd> to hide this help</p>
52+
</div>
53+
</div>
54+
</div>
4455
<div id="body-container">
4556
<!-- Work around some values being stored in localStorage wrapped in quotes -->
4657
<script>
@@ -118,7 +129,7 @@
118129
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
119130
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
120131
</ul>
121-
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
132+
<button id="search-toggle" class="icon-button" type="button" title="Search (`/`)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="/ s" aria-controls="searchbar">
122133
<i class="fa fa-search"></i>
123134
</button>
124135
</div>

book/book.js

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -557,9 +557,9 @@ aria-label="Show hidden lines"></button>';
557557
sidebarToggleAnchor.addEventListener('change', function sidebarToggle() {
558558
if (sidebarToggleAnchor.checked) {
559559
const current_width = parseInt(
560-
document.documentElement.style.getPropertyValue('--sidebar-width'), 10);
560+
document.documentElement.style.getPropertyValue('--sidebar-target-width'), 10);
561561
if (current_width < 150) {
562-
document.documentElement.style.setProperty('--sidebar-width', '150px');
562+
document.documentElement.style.setProperty('--sidebar-target-width', '150px');
563563
}
564564
showSidebar();
565565
} else {
@@ -583,7 +583,7 @@ aria-label="Show hidden lines"></button>';
583583
showSidebar();
584584
}
585585
pos = Math.min(pos, window.innerWidth - 100);
586-
document.documentElement.style.setProperty('--sidebar-width', pos + 'px');
586+
document.documentElement.style.setProperty('--sidebar-target-width', pos + 'px');
587587
}
588588
}
589589
//on mouseup remove windows functions mousemove & mouseup
@@ -623,7 +623,7 @@ aria-label="Show hidden lines"></button>';
623623

624624
(function chapterNavigation() {
625625
document.addEventListener('keydown', function(e) {
626-
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) {
626+
if (e.altKey || e.ctrlKey || e.metaKey) {
627627
return;
628628
}
629629
if (window.search && window.search.hasFocus()) {
@@ -643,6 +643,55 @@ aria-label="Show hidden lines"></button>';
643643
window.location.href = previousButton.href;
644644
}
645645
}
646+
function showHelp() {
647+
const container = document.getElementById('mdbook-help-container');
648+
const overlay = document.getElementById('mdbook-help-popup');
649+
container.style.display = 'flex';
650+
651+
// Clicking outside the popup will dismiss it.
652+
const mouseHandler = event => {
653+
if (overlay.contains(event.target)) {
654+
return;
655+
}
656+
if (event.button !== 0) {
657+
return;
658+
}
659+
event.preventDefault();
660+
event.stopPropagation();
661+
document.removeEventListener('mousedown', mouseHandler);
662+
hideHelp();
663+
};
664+
665+
// Pressing esc will dismiss the popup.
666+
const escapeKeyHandler = event => {
667+
if (event.key === 'Escape') {
668+
event.preventDefault();
669+
event.stopPropagation();
670+
document.removeEventListener('keydown', escapeKeyHandler, true);
671+
hideHelp();
672+
}
673+
};
674+
document.addEventListener('keydown', escapeKeyHandler, true);
675+
document.getElementById('mdbook-help-container')
676+
.addEventListener('mousedown', mouseHandler);
677+
}
678+
function hideHelp() {
679+
document.getElementById('mdbook-help-container').style.display = 'none';
680+
}
681+
682+
// Usually needs the Shift key to be pressed
683+
switch (e.key) {
684+
case '?':
685+
e.preventDefault();
686+
showHelp();
687+
break;
688+
}
689+
690+
// Rest of the keys are only active when the Shift key is not pressed
691+
if (e.shiftKey) {
692+
return;
693+
}
694+
646695
switch (e.key) {
647696
case 'ArrowRight':
648697
e.preventDefault();

book/building-rust-gpu.html

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@
4141
<script src="toc.js"></script>
4242
</head>
4343
<body>
44+
<div id="mdbook-help-container">
45+
<div id="mdbook-help-popup">
46+
<h2 class="mdbook-help-title">Keyboard shortcuts</h2>
47+
<div>
48+
<p>Press <kbd></kbd> or <kbd></kbd> to navigate between chapters</p>
49+
<p>Press <kbd>S</kbd> or <kbd>/</kbd> to search in the book</p>
50+
<p>Press <kbd>?</kbd> to show this help</p>
51+
<p>Press <kbd>Esc</kbd> to hide this help</p>
52+
</div>
53+
</div>
54+
</div>
4455
<div id="body-container">
4556
<!-- Work around some values being stored in localStorage wrapped in quotes -->
4657
<script>
@@ -118,7 +129,7 @@
118129
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
119130
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
120131
</ul>
121-
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
132+
<button id="search-toggle" class="icon-button" type="button" title="Search (`/`)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="/ s" aria-controls="searchbar">
122133
<i class="fa fa-search"></i>
123134
</button>
124135
</div>

book/codegen-args.html

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@
4141
<script src="toc.js"></script>
4242
</head>
4343
<body>
44+
<div id="mdbook-help-container">
45+
<div id="mdbook-help-popup">
46+
<h2 class="mdbook-help-title">Keyboard shortcuts</h2>
47+
<div>
48+
<p>Press <kbd></kbd> or <kbd></kbd> to navigate between chapters</p>
49+
<p>Press <kbd>S</kbd> or <kbd>/</kbd> to search in the book</p>
50+
<p>Press <kbd>?</kbd> to show this help</p>
51+
<p>Press <kbd>Esc</kbd> to hide this help</p>
52+
</div>
53+
</div>
54+
</div>
4455
<div id="body-container">
4556
<!-- Work around some values being stored in localStorage wrapped in quotes -->
4657
<script>
@@ -118,7 +129,7 @@
118129
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
119130
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
120131
</ul>
121-
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
132+
<button id="search-toggle" class="icon-button" type="button" title="Search (`/`)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="/ s" aria-controls="searchbar">
122133
<i class="fa fa-search"></i>
123134
</button>
124135
</div>

book/css/chrome.css

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,9 +474,24 @@ html:not(.sidebar-resizing) .sidebar {
474474

475475
.sidebar-resize-handle .sidebar-resize-indicator {
476476
width: 100%;
477-
height: 12px;
478-
background-color: var(--icons);
477+
height: 16px;
478+
color: var(--icons);
479479
margin-inline-start: var(--sidebar-resize-indicator-space);
480+
display: flex;
481+
align-items: center;
482+
justify-content: flex-start;
483+
}
484+
.sidebar-resize-handle .sidebar-resize-indicator::before {
485+
content: "";
486+
width: 2px;
487+
height: 12px;
488+
border-left: dotted 2px currentColor;
489+
}
490+
.sidebar-resize-handle .sidebar-resize-indicator::after {
491+
content: "";
492+
width: 2px;
493+
height: 16px;
494+
border-left: dotted 2px currentColor;
480495
}
481496

482497
[dir=rtl] .sidebar .sidebar-resize-handle {
@@ -641,3 +656,46 @@ html:not(.sidebar-resizing) .sidebar {
641656
margin-inline-start: -14px;
642657
width: 14px;
643658
}
659+
660+
/* The container for the help popup that covers the whole window. */
661+
#mdbook-help-container {
662+
/* Position and size for the whole window. */
663+
position: fixed;
664+
top: 0;
665+
left: 0;
666+
right: 0;
667+
bottom: 0;
668+
/* This uses flex layout (which is set in book.js), and centers the popup
669+
in the window.*/
670+
display: none;
671+
align-items: center;
672+
justify-content: center;
673+
z-index: 1000;
674+
/* Dim out the book while the popup is visible. */
675+
background: var(--overlay-bg);
676+
}
677+
678+
/* The popup help box. */
679+
#mdbook-help-popup {
680+
box-shadow: 0 4px 24px rgba(0,0,0,0.15);
681+
min-width: 300px;
682+
max-width: 500px;
683+
width: 100%;
684+
box-sizing: border-box;
685+
display: flex;
686+
flex-direction: column;
687+
align-items: center;
688+
background-color: var(--bg);
689+
color: var(--fg);
690+
border-width: 1px;
691+
border-color: var(--theme-popup-border);
692+
border-style: solid;
693+
border-radius: 8px;
694+
padding: 10px;
695+
}
696+
697+
.mdbook-help-title {
698+
text-align: center;
699+
/* mdbook's margin for h2 is way too large. */
700+
margin: 10px;
701+
}

book/css/variables.css

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
/* Globals */
33

44
:root {
5-
--sidebar-width: 300px;
5+
--sidebar-target-width: 300px;
6+
--sidebar-width: min(var(--sidebar-target-width), 80vw);
67
--sidebar-resize-indicator-width: 8px;
78
--sidebar-resize-indicator-space: 2px;
89
--page-padding: 15px;
@@ -63,6 +64,8 @@
6364
--copy-button-filter-hover: invert(68%) sepia(55%) saturate(531%) hue-rotate(341deg) brightness(104%) contrast(101%);
6465

6566
--footnote-highlight: #2668a6;
67+
68+
--overlay-bg: rgba(33, 40, 48, 0.4);
6669
}
6770

6871
.coal {
@@ -114,6 +117,8 @@
114117
--copy-button-filter-hover: invert(36%) sepia(70%) saturate(503%) hue-rotate(167deg) brightness(98%) contrast(89%);
115118

116119
--footnote-highlight: #4079ae;
120+
121+
--overlay-bg: rgba(33, 40, 48, 0.4);
117122
}
118123

119124
.light, html:not(.js) {
@@ -165,6 +170,8 @@
165170
--copy-button-filter-hover: invert(14%) sepia(93%) saturate(4250%) hue-rotate(243deg) brightness(99%) contrast(130%);
166171

167172
--footnote-highlight: #7e7eff;
173+
174+
--overlay-bg: rgba(200, 200, 205, 0.4);
168175
}
169176

170177
.navy {
@@ -216,6 +223,8 @@
216223
--copy-button-filter-hover: invert(46%) sepia(20%) saturate(1537%) hue-rotate(156deg) brightness(85%) contrast(90%);
217224

218225
--footnote-highlight: #4079ae;
226+
227+
--overlay-bg: rgba(33, 40, 48, 0.4);
219228
}
220229

221230
.rust {
@@ -265,6 +274,8 @@
265274
--copy-button-filter-hover: invert(77%) sepia(16%) saturate(1798%) hue-rotate(328deg) brightness(98%) contrast(83%);
266275

267276
--footnote-highlight: #d3a17a;
277+
278+
--overlay-bg: rgba(150, 150, 150, 0.25);
268279
}
269280

270281
@media (prefers-color-scheme: dark) {

book/image.html

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@
4141
<script src="toc.js"></script>
4242
</head>
4343
<body>
44+
<div id="mdbook-help-container">
45+
<div id="mdbook-help-popup">
46+
<h2 class="mdbook-help-title">Keyboard shortcuts</h2>
47+
<div>
48+
<p>Press <kbd></kbd> or <kbd></kbd> to navigate between chapters</p>
49+
<p>Press <kbd>S</kbd> or <kbd>/</kbd> to search in the book</p>
50+
<p>Press <kbd>?</kbd> to show this help</p>
51+
<p>Press <kbd>Esc</kbd> to hide this help</p>
52+
</div>
53+
</div>
54+
</div>
4455
<div id="body-container">
4556
<!-- Work around some values being stored in localStorage wrapped in quotes -->
4657
<script>
@@ -118,7 +129,7 @@
118129
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
119130
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
120131
</ul>
121-
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
132+
<button id="search-toggle" class="icon-button" type="button" title="Search (`/`)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="/ s" aria-controls="searchbar">
122133
<i class="fa fa-search"></i>
123134
</button>
124135
</div>

0 commit comments

Comments
 (0)