提交 bb491ed2 编写于 作者: B bors

Auto merge of #84490 - JohnTitor:rollup-wrdj4ko, r=JohnTitor

Rollup of 11 pull requests

Successful merges:

 - #80805 (Improve `Iterator::by_ref` example)
 - #84248 (Remove duplicated fn(Box<[T]>) -> Vec<T>)
 - #84321 (rustdoc: Convert sub-variant toggle to HTML)
 - #84359 ( rust-analyzer)
 - #84374 (Clean up .gitignore)
 - #84387 (Move `sys_common::poison` to `sync::poison`)
 - #84430 (doc/platform-support: clarify UEFI support)
 - #84433 (Prevent control, shift and alt keys to make search input lose focus)
 - #84444 (doc: Get rid of "[+] show undocumented items" toggle on numeric From impls)
 - #84456 (Fix ICE if original_span(fn_sig) returns a span not in body sourcefile)
 - #84469 (Update comment on `PrimTy::name_str`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
...@@ -5,53 +5,71 @@ ...@@ -5,53 +5,71 @@
# created during manual debugging and many people like to clean up instead of # created during manual debugging and many people like to clean up instead of
# having git ignore such leftovers. You can use `.git/info/exclude` to # having git ignore such leftovers. You can use `.git/info/exclude` to
# configure your local ignore list. # configure your local ignore list.
# FIXME: This needs cleanup.
*~ ## File system
.DS_Store
desktop.ini
## Editor
*.swp *.swp
*.swo *.swo
.#* Session.vim
.DS_Store
.cproject .cproject
.hg/
.hgignore
.idea .idea
*.iml *.iml
__pycache__/ .vscode
*.py[cod]
*$py.class
.project .project
.favorites.json
.settings/ .settings/
## Tool
.valgrindrc .valgrindrc
.vscode .cargo
.favorites.json # Included because it is part of the test case
/Makefile !/src/test/run-make/thumb-none-qemu/example/.cargo
/build/
## Configuration
/config.toml /config.toml
/dist/ /Makefile
config.mk
config.stamp
no_llvm_build
## Build
/dl/ /dl/
/doc/ /doc/
/inst/ /inst/
/llvm/ /llvm/
/mingw-build/ /mingw-build/
/src/tools/x/target /build/
# Created by default with `src/ci/docker/run.sh`: /dist/
/obj/
/unicode-downloads /unicode-downloads
/target /target
# Generated by compiletest for incremental: /src/tools/x/target
# Generated by compiletest for incremental
/tmp/ /tmp/
# Created by default with `src/ci/docker/run.sh`
/obj/
## Temporary files
*~
\#*
\#*\#
.#*
## Tags
tags tags
tags.* tags.*
TAGS TAGS
TAGS.* TAGS.*
\#*
\#*\# ## Python
config.mk __pycache__/
config.stamp *.py[cod]
Session.vim *$py.class
.cargo
!/src/test/run-make/thumb-none-qemu/example/.cargo ## Node
no_llvm_build
**node_modules **node_modules
**package-lock.json **package-lock.json
# Before adding new lines, see the comment at the top. # Before adding new lines, see the comment at the top.
...@@ -2201,7 +2201,7 @@ impl PrimTy { ...@@ -2201,7 +2201,7 @@ impl PrimTy {
/// Like [`PrimTy::name`], but returns a &str instead of a symbol. /// Like [`PrimTy::name`], but returns a &str instead of a symbol.
/// ///
/// Used by rustdoc. /// Used by clippy.
pub fn name_str(self) -> &'static str { pub fn name_str(self) -> &'static str {
match self { match self {
PrimTy::Int(i) => i.name_str(), PrimTy::Int(i) => i.name_str(),
......
...@@ -111,7 +111,8 @@ fn new(pass_name: &'a str, tcx: TyCtxt<'tcx>, mir_body: &'a mut mir::Body<'tcx>) ...@@ -111,7 +111,8 @@ fn new(pass_name: &'a str, tcx: TyCtxt<'tcx>, mir_body: &'a mut mir::Body<'tcx>)
let body_span = hir_body.value.span; let body_span = hir_body.value.span;
let source_file = source_map.lookup_source_file(body_span.lo()); let source_file = source_map.lookup_source_file(body_span.lo());
let fn_sig_span = match some_fn_sig.filter(|fn_sig| { let fn_sig_span = match some_fn_sig.filter(|fn_sig| {
Lrc::ptr_eq(&source_file, &source_map.lookup_source_file(fn_sig.span.hi())) fn_sig.span.ctxt() == body_span.ctxt()
&& Lrc::ptr_eq(&source_file, &source_map.lookup_source_file(fn_sig.span.hi()))
}) { }) {
Some(fn_sig) => fn_sig.span.with_hi(body_span.lo()), Some(fn_sig) => fn_sig.span.with_hi(body_span.lo()),
None => body_span.shrink_to_lo(), None => body_span.shrink_to_lo(),
......
...@@ -240,13 +240,13 @@ impl<'a, 'tcx> CoverageSpans<'a, 'tcx> { ...@@ -240,13 +240,13 @@ impl<'a, 'tcx> CoverageSpans<'a, 'tcx> {
/// to be). /// to be).
pub(super) fn generate_coverage_spans( pub(super) fn generate_coverage_spans(
mir_body: &'a mir::Body<'tcx>, mir_body: &'a mir::Body<'tcx>,
fn_sig_span: Span, fn_sig_span: Span, // Ensured to be same SourceFile and SyntaxContext as `body_span`
body_span: Span, body_span: Span,
basic_coverage_blocks: &'a CoverageGraph, basic_coverage_blocks: &'a CoverageGraph,
) -> Vec<CoverageSpan> { ) -> Vec<CoverageSpan> {
let mut coverage_spans = CoverageSpans { let mut coverage_spans = CoverageSpans {
mir_body, mir_body,
fn_sig_span: fn_sig_source_span(fn_sig_span, body_span), fn_sig_span,
body_span, body_span,
basic_coverage_blocks, basic_coverage_blocks,
sorted_spans_iter: None, sorted_spans_iter: None,
...@@ -731,11 +731,6 @@ pub(super) fn filtered_terminator_span( ...@@ -731,11 +731,6 @@ pub(super) fn filtered_terminator_span(
} }
} }
#[inline]
fn fn_sig_source_span(fn_sig_span: Span, body_span: Span) -> Span {
original_sp(fn_sig_span, body_span).with_ctxt(body_span.ctxt())
}
#[inline] #[inline]
fn function_source_span(span: Span, body_span: Span) -> Span { fn function_source_span(span: Span, body_span: Span) -> Span {
let span = original_sp(span, body_span).with_ctxt(body_span.ctxt()); let span = original_sp(span, body_span).with_ctxt(body_span.ctxt());
......
...@@ -2810,8 +2810,7 @@ impl<T, A: Allocator> From<Box<[T], A>> for Vec<T, A> { ...@@ -2810,8 +2810,7 @@ impl<T, A: Allocator> From<Box<[T], A>> for Vec<T, A> {
/// assert_eq!(Vec::from(b), vec![1, 2, 3]); /// assert_eq!(Vec::from(b), vec![1, 2, 3]);
/// ``` /// ```
fn from(s: Box<[T], A>) -> Self { fn from(s: Box<[T], A>) -> Self {
let len = s.len(); s.into_vec()
Self { buf: RawVec::from_box(s), len }
} }
} }
......
...@@ -45,8 +45,10 @@ unsafe fn to_int_unchecked(self) -> $Int { ...@@ -45,8 +45,10 @@ unsafe fn to_int_unchecked(self) -> $Int {
macro_rules! impl_from { macro_rules! impl_from {
($Small: ty, $Large: ty, #[$attr:meta], $doc: expr) => { ($Small: ty, $Large: ty, #[$attr:meta], $doc: expr) => {
#[$attr] #[$attr]
#[doc = $doc]
impl From<$Small> for $Large { impl From<$Small> for $Large {
// Rustdocs on the impl block show a "[+] show undocumented items" toggle.
// Rustdocs on functions do not.
#[doc = $doc]
#[inline] #[inline]
fn from(small: $Small) -> Self { fn from(small: $Small) -> Self {
small as Self small as Self
...@@ -383,8 +385,10 @@ mod ptr_try_from_impls { ...@@ -383,8 +385,10 @@ mod ptr_try_from_impls {
macro_rules! nzint_impl_from { macro_rules! nzint_impl_from {
($Small: ty, $Large: ty, #[$attr:meta], $doc: expr) => { ($Small: ty, $Large: ty, #[$attr:meta], $doc: expr) => {
#[$attr] #[$attr]
#[doc = $doc]
impl From<$Small> for $Large { impl From<$Small> for $Large {
// Rustdocs on the impl block show a "[+] show undocumented items" toggle.
// Rustdocs on functions do not.
#[doc = $doc]
#[inline] #[inline]
fn from(small: $Small) -> Self { fn from(small: $Small) -> Self {
// SAFETY: input type guarantees the value is non-zero // SAFETY: input type guarantees the value is non-zero
...@@ -450,10 +454,12 @@ fn from(small: $Small) -> Self { ...@@ -450,10 +454,12 @@ fn from(small: $Small) -> Self {
macro_rules! nzint_impl_try_from_int { macro_rules! nzint_impl_try_from_int {
($Int: ty, $NonZeroInt: ty, #[$attr:meta], $doc: expr) => { ($Int: ty, $NonZeroInt: ty, #[$attr:meta], $doc: expr) => {
#[$attr] #[$attr]
#[doc = $doc]
impl TryFrom<$Int> for $NonZeroInt { impl TryFrom<$Int> for $NonZeroInt {
type Error = TryFromIntError; type Error = TryFromIntError;
// Rustdocs on the impl block show a "[+] show undocumented items" toggle.
// Rustdocs on functions do not.
#[doc = $doc]
#[inline] #[inline]
fn try_from(value: $Int) -> Result<Self, Self::Error> { fn try_from(value: $Int) -> Result<Self, Self::Error> {
Self::new(value).ok_or(TryFromIntError(())) Self::new(value).ok_or(TryFromIntError(()))
...@@ -489,10 +495,12 @@ fn try_from(value: $Int) -> Result<Self, Self::Error> { ...@@ -489,10 +495,12 @@ fn try_from(value: $Int) -> Result<Self, Self::Error> {
macro_rules! nzint_impl_try_from_nzint { macro_rules! nzint_impl_try_from_nzint {
($From:ty => $To:ty, $doc: expr) => { ($From:ty => $To:ty, $doc: expr) => {
#[stable(feature = "nzint_try_from_nzint_conv", since = "1.49.0")] #[stable(feature = "nzint_try_from_nzint_conv", since = "1.49.0")]
#[doc = $doc]
impl TryFrom<$From> for $To { impl TryFrom<$From> for $To {
type Error = TryFromIntError; type Error = TryFromIntError;
// Rustdocs on the impl block show a "[+] show undocumented items" toggle.
// Rustdocs on functions do not.
#[doc = $doc]
#[inline] #[inline]
fn try_from(value: $From) -> Result<Self, Self::Error> { fn try_from(value: $From) -> Result<Self, Self::Error> {
TryFrom::try_from(value.get()).map(|v| { TryFrom::try_from(value.get()).map(|v| {
......
...@@ -1646,31 +1646,16 @@ fn inspect<F>(self, f: F) -> Inspect<Self, F> ...@@ -1646,31 +1646,16 @@ fn inspect<F>(self, f: F) -> Inspect<Self, F>
/// Basic usage: /// Basic usage:
/// ///
/// ``` /// ```
/// let a = [1, 2, 3]; /// let mut words = vec!["hello", "world", "of", "Rust"].into_iter();
///
/// let iter = a.iter();
///
/// let sum: i32 = iter.take(5).fold(0, |acc, i| acc + i);
///
/// assert_eq!(sum, 6);
///
/// // if we try to use iter again, it won't work. The following line
/// // gives "error: use of moved value: `iter`
/// // assert_eq!(iter.next(), None);
/// ///
/// // let's try that again /// // Take the first two words.
/// let a = [1, 2, 3]; /// let hello_world: Vec<_> = words.by_ref().take(2).collect();
/// /// assert_eq!(hello_world, vec!["hello", "world"]);
/// let mut iter = a.iter();
///
/// // instead, we add in a .by_ref()
/// let sum: i32 = iter.by_ref().take(2).fold(0, |acc, i| acc + i);
/// ///
/// assert_eq!(sum, 3); /// // Collect the rest of the words.
/// /// // We can only do this because we used `by_ref` earlier.
/// // now this is just fine: /// let of_rust: Vec<_> = words.collect();
/// assert_eq!(iter.next(), Some(&3)); /// assert_eq!(of_rust, vec!["of", "Rust"]);
/// assert_eq!(iter.next(), None);
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn by_ref(&mut self) -> &mut Self fn by_ref(&mut self) -> &mut Self
......
...@@ -2,9 +2,8 @@ ...@@ -2,9 +2,8 @@
mod tests; mod tests;
use crate::fmt; use crate::fmt;
use crate::sync::{mutex, MutexGuard, PoisonError}; use crate::sync::{mutex, poison, LockResult, MutexGuard, PoisonError};
use crate::sys_common::condvar as sys; use crate::sys_common::condvar as sys;
use crate::sys_common::poison::{self, LockResult};
use crate::time::{Duration, Instant}; use crate::time::{Duration, Instant};
/// A type indicating whether a timed wait on a condition variable returned /// A type indicating whether a timed wait on a condition variable returned
......
...@@ -166,9 +166,9 @@ ...@@ -166,9 +166,9 @@
#[allow(deprecated)] #[allow(deprecated)]
pub use self::once::{Once, OnceState, ONCE_INIT}; pub use self::once::{Once, OnceState, ONCE_INIT};
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub use self::rwlock::{RwLock, RwLockReadGuard, RwLockWriteGuard}; pub use self::poison::{LockResult, PoisonError, TryLockError, TryLockResult};
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub use crate::sys_common::poison::{LockResult, PoisonError, TryLockError, TryLockResult}; pub use self::rwlock::{RwLock, RwLockReadGuard, RwLockWriteGuard};
pub mod mpsc; pub mod mpsc;
...@@ -176,4 +176,5 @@ ...@@ -176,4 +176,5 @@
mod condvar; mod condvar;
mod mutex; mod mutex;
mod once; mod once;
mod poison;
mod rwlock; mod rwlock;
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
use crate::mem; use crate::mem;
use crate::ops::{Deref, DerefMut}; use crate::ops::{Deref, DerefMut};
use crate::ptr; use crate::ptr;
use crate::sync::{poison, LockResult, TryLockError, TryLockResult};
use crate::sys_common::mutex as sys; use crate::sys_common::mutex as sys;
use crate::sys_common::poison::{self, LockResult, TryLockError, TryLockResult};
/// A mutual exclusion primitive useful for protecting shared data /// A mutual exclusion primitive useful for protecting shared data
/// ///
......
...@@ -3,9 +3,6 @@ ...@@ -3,9 +3,6 @@
use crate::sync::atomic::{AtomicBool, Ordering}; use crate::sync::atomic::{AtomicBool, Ordering};
use crate::thread; use crate::thread;
#[allow(unused_imports)] // for intra-doc links
use crate::sync::{Mutex, RwLock};
pub struct Flag { pub struct Flag {
failed: AtomicBool, failed: AtomicBool,
} }
...@@ -80,6 +77,8 @@ pub struct Guard { ...@@ -80,6 +77,8 @@ pub struct Guard {
/// } /// }
/// }; /// };
/// ``` /// ```
/// [`Mutex`]: crate::sync::Mutex
/// [`RwLock`]: crate::sync::RwLock
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct PoisonError<T> { pub struct PoisonError<T> {
guard: T, guard: T,
...@@ -89,9 +88,11 @@ pub struct PoisonError<T> { ...@@ -89,9 +88,11 @@ pub struct PoisonError<T> {
/// can occur while trying to acquire a lock, from the [`try_lock`] method on a /// can occur while trying to acquire a lock, from the [`try_lock`] method on a
/// [`Mutex`] or the [`try_read`] and [`try_write`] methods on an [`RwLock`]. /// [`Mutex`] or the [`try_read`] and [`try_write`] methods on an [`RwLock`].
/// ///
/// [`try_lock`]: Mutex::try_lock /// [`try_lock`]: crate::sync::Mutex::try_lock
/// [`try_read`]: RwLock::try_read /// [`try_read`]: crate::sync::RwLock::try_read
/// [`try_write`]: RwLock::try_write /// [`try_write`]: crate::sync::RwLock::try_write
/// [`Mutex`]: crate::sync::Mutex
/// [`RwLock`]: crate::sync::RwLock
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub enum TryLockError<T> { pub enum TryLockError<T> {
/// The lock could not be acquired because another thread failed while holding /// The lock could not be acquired because another thread failed while holding
...@@ -149,7 +150,8 @@ fn description(&self) -> &str { ...@@ -149,7 +150,8 @@ fn description(&self) -> &str {
impl<T> PoisonError<T> { impl<T> PoisonError<T> {
/// Creates a `PoisonError`. /// Creates a `PoisonError`.
/// ///
/// This is generally created by methods like [`Mutex::lock`] or [`RwLock::read`]. /// This is generally created by methods like [`Mutex::lock`](crate::sync::Mutex::lock)
/// or [`RwLock::read`](crate::sync::RwLock::read).
#[stable(feature = "sync_poison", since = "1.2.0")] #[stable(feature = "sync_poison", since = "1.2.0")]
pub fn new(guard: T) -> PoisonError<T> { pub fn new(guard: T) -> PoisonError<T> {
PoisonError { guard } PoisonError { guard }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
use crate::mem; use crate::mem;
use crate::ops::{Deref, DerefMut}; use crate::ops::{Deref, DerefMut};
use crate::ptr; use crate::ptr;
use crate::sys_common::poison::{self, LockResult, TryLockError, TryLockResult}; use crate::sync::{poison, LockResult, TryLockError, TryLockResult};
use crate::sys_common::rwlock as sys; use crate::sys_common::rwlock as sys;
/// A reader-writer lock /// A reader-writer lock
......
...@@ -59,7 +59,6 @@ ...@@ -59,7 +59,6 @@
// when generating documentation. // when generating documentation.
#[cfg(any(doc, not(windows)))] #[cfg(any(doc, not(windows)))]
pub mod os_str_bytes; pub mod os_str_bytes;
pub mod poison;
pub mod process; pub mod process;
pub mod remutex; pub mod remutex;
pub mod rwlock; pub mod rwlock;
......
...@@ -179,7 +179,7 @@ target | std | host | notes ...@@ -179,7 +179,7 @@ target | std | host | notes
`i386-apple-ios` | ✓ | | 32-bit x86 iOS `i386-apple-ios` | ✓ | | 32-bit x86 iOS
`i686-apple-darwin` | ✓ | ✓ | 32-bit macOS (10.7+, Lion+) `i686-apple-darwin` | ✓ | ✓ | 32-bit macOS (10.7+, Lion+)
`i686-pc-windows-msvc` | ✓ | | 32-bit Windows XP support `i686-pc-windows-msvc` | ✓ | | 32-bit Windows XP support
`i686-unknown-uefi` | ? | | 32-bit UEFI `i686-unknown-uefi` | * | | 32-bit UEFI
`i686-unknown-haiku` | ✓ | ✓ | 32-bit Haiku `i686-unknown-haiku` | ✓ | ✓ | 32-bit Haiku
`i686-unknown-netbsd` | ✓ | ✓ | NetBSD/i386 with SSE2 `i686-unknown-netbsd` | ✓ | ✓ | NetBSD/i386 with SSE2
`i686-unknown-openbsd` | ✓ | ✓ | 32-bit OpenBSD `i686-unknown-openbsd` | ✓ | ✓ | 32-bit OpenBSD
...@@ -228,7 +228,7 @@ target | std | host | notes ...@@ -228,7 +228,7 @@ target | std | host | notes
`x86_64-unknown-none-hermitkernel` | ? | | HermitCore kernel `x86_64-unknown-none-hermitkernel` | ? | | HermitCore kernel
`x86_64-unknown-l4re-uclibc` | ? | | `x86_64-unknown-l4re-uclibc` | ? | |
`x86_64-unknown-openbsd` | ✓ | ✓ | 64-bit OpenBSD `x86_64-unknown-openbsd` | ✓ | ✓ | 64-bit OpenBSD
`x86_64-unknown-uefi` | ? | | `x86_64-unknown-uefi` | * | | 64-bit UEFI
`x86_64-uwp-windows-gnu` | ✓ | | `x86_64-uwp-windows-gnu` | ✓ | |
`x86_64-uwp-windows-msvc` | ✓ | | `x86_64-uwp-windows-msvc` | ✓ | |
`x86_64-wrs-vxworks` | ? | | `x86_64-wrs-vxworks` | ? | |
......
...@@ -963,6 +963,7 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum ...@@ -963,6 +963,7 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum
use crate::clean::Variant; use crate::clean::Variant;
if let clean::VariantItem(Variant::Struct(ref s)) = *variant.kind { if let clean::VariantItem(Variant::Struct(ref s)) = *variant.kind {
toggle_open(w, "fields");
let variant_id = cx.derive_id(format!( let variant_id = cx.derive_id(format!(
"{}.{}.fields", "{}.{}.fields",
ItemType::Variant, ItemType::Variant,
...@@ -996,6 +997,7 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum ...@@ -996,6 +997,7 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum
} }
} }
w.write_str("</div></div>"); w.write_str("</div></div>");
toggle_close(w);
} }
render_stability_since(w, variant, it, cx.tcx()); render_stability_since(w, variant, it, cx.tcx());
} }
......
...@@ -455,6 +455,15 @@ function hideThemeButtonState() { ...@@ -455,6 +455,15 @@ function hideThemeButtonState() {
handleHashes(ev); handleHashes(ev);
} }
function openParentDetails(elem) {
while (elem) {
if (elem.tagName === "DETAILS") {
elem.open = true;
}
elem = elem.parentNode;
}
}
function expandSection(id) { function expandSection(id) {
var elem = document.getElementById(id); var elem = document.getElementById(id);
if (elem && isHidden(elem)) { if (elem && isHidden(elem)) {
...@@ -469,6 +478,8 @@ function hideThemeButtonState() { ...@@ -469,6 +478,8 @@ function hideThemeButtonState() {
// The element is not visible, we need to make it appear! // The element is not visible, we need to make it appear!
collapseDocs(collapses[0], "show"); collapseDocs(collapses[0], "show");
} }
// Open all ancestor <details> to make this element visible.
openParentDetails(h3.parentNode);
} }
} }
} }
...@@ -1009,7 +1020,7 @@ function hideThemeButtonState() { ...@@ -1009,7 +1020,7 @@ function hideThemeButtonState() {
if (hasClass(relatedDoc, "item-info")) { if (hasClass(relatedDoc, "item-info")) {
relatedDoc = relatedDoc.nextElementSibling; relatedDoc = relatedDoc.nextElementSibling;
} }
if (hasClass(relatedDoc, "docblock") || hasClass(relatedDoc, "sub-variant")) { if (hasClass(relatedDoc, "docblock")) {
if (mode === "toggle") { if (mode === "toggle") {
if (hasClass(relatedDoc, "hidden-by-usual-hider")) { if (hasClass(relatedDoc, "hidden-by-usual-hider")) {
action = "show"; action = "show";
...@@ -1318,8 +1329,6 @@ function hideThemeButtonState() { ...@@ -1318,8 +1329,6 @@ function hideThemeButtonState() {
if (hasClass(e, "type-decl")) { if (hasClass(e, "type-decl")) {
// We do something special for these // We do something special for these
return; return;
} else if (hasClass(e, "sub-variant")) {
otherMessage = "&nbsp;Show&nbsp;fields";
} else if (hasClass(e, "non-exhaustive")) { } else if (hasClass(e, "non-exhaustive")) {
otherMessage = "&nbsp;This&nbsp;"; otherMessage = "&nbsp;This&nbsp;";
if (hasClass(e, "non-exhaustive-struct")) { if (hasClass(e, "non-exhaustive-struct")) {
...@@ -1351,7 +1360,6 @@ function hideThemeButtonState() { ...@@ -1351,7 +1360,6 @@ function hideThemeButtonState() {
} }
onEachLazy(document.getElementsByClassName("docblock"), buildToggleWrapper); onEachLazy(document.getElementsByClassName("docblock"), buildToggleWrapper);
onEachLazy(document.getElementsByClassName("sub-variant"), buildToggleWrapper);
autoCollapse(getSettingValue("collapse") === "true"); autoCollapse(getSettingValue("collapse") === "true");
......
...@@ -1046,10 +1046,11 @@ h3 > .collapse-toggle, h4 > .collapse-toggle { ...@@ -1046,10 +1046,11 @@ h3 > .collapse-toggle, h4 > .collapse-toggle {
} }
.sub-variant, .sub-variant > h3 { .sub-variant, .sub-variant > h3 {
margin-top: 1px !important; margin-top: 0px !important;
padding-top: 1px;
} }
#main > .sub-variant > h3 { #main > details > .sub-variant > h3 {
font-size: 15px; font-size: 15px;
margin-left: 25px; margin-left: 25px;
margin-bottom: 5px; margin-bottom: 5px;
......
...@@ -935,6 +935,9 @@ window.initSearch = function(rawSearchIndex) { ...@@ -935,6 +935,9 @@ window.initSearch = function(rawSearchIndex) {
}); });
current += 1; current += 1;
}); });
var SHIFT = 16;
var CTRL = 17;
var ALT = 18;
var currentTab = searchState.currentTab; var currentTab = searchState.currentTab;
if (e.which === 38) { // up if (e.which === 38) { // up
...@@ -967,10 +970,10 @@ window.initSearch = function(rawSearchIndex) { ...@@ -967,10 +970,10 @@ window.initSearch = function(rawSearchIndex) {
e.preventDefault(); e.preventDefault();
} else if (e.which === 13) { // return } else if (e.which === 13) { // return
if (actives[currentTab].length) { if (actives[currentTab].length) {
document.location.href = var elem = actives[currentTab][0].getElementsByTagName("a")[0];
actives[currentTab][0].getElementsByTagName("a")[0].href; document.location.href = elem.href;
} }
} else if (e.which === 16) { // shift } else if ([SHIFT, CTRL, ALT].indexOf(e.which) !== -1) {
// Does nothing, it's just to avoid losing "focus" on the highlighted element. // Does nothing, it's just to avoid losing "focus" on the highlighted element.
} else if (actives[currentTab].length > 0) { } else if (actives[currentTab].length > 0) {
removeClass(actives[currentTab][0], "highlighted"); removeClass(actives[currentTab][0], "highlighted");
......
...@@ -29,7 +29,9 @@ pub fn foo() {} ...@@ -29,7 +29,9 @@ pub fn foo() {}
impl Foo { impl Foo {
#[must_use] #[must_use]
pub fn must_use(&self) -> bool { true } pub fn must_use(&self) -> bool {
true
}
} }
/// Just a normal enum. /// Just a normal enum.
...@@ -85,3 +87,7 @@ pub trait AnotherOne { ...@@ -85,3 +87,7 @@ pub trait AnotherOne {
/// let x = 12; /// let x = 12;
/// ``` /// ```
pub fn check_list_code_block() {} pub fn check_list_code_block() {}
pub enum AnEnum {
WithVariants { and: usize, sub: usize, variants: usize },
}
...@@ -62,7 +62,8 @@ pub struct PrivStruct { ...@@ -62,7 +62,8 @@ pub struct PrivStruct {
} }
// @has 'item_hide_threshold/enum.Enum.html' // @has 'item_hide_threshold/enum.Enum.html'
// @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 0 // @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 1
// @has - '//details[@class="rustdoc-toggle type-contents-toggle"]' 'Show fields'
pub enum Enum { pub enum Enum {
A, B, C, A, B, C,
D { D {
......
Subproject commit 7be06139b632ee615fc18af04dd67947e2c794b2 Subproject commit 7570212a544b8e973a7d57be3657aae6465028a7
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册