diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp index 99ce13a6ed59c..3595e37cf9625 100644 --- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp @@ -793,16 +793,23 @@ LLVMRustOptimizeWithNewPassManager( PGOOpt = PGOOptions(PGOUsePath, "", "", PGOOptions::IRUse); } -#if LLVM_VERSION_GE(12, 0) +#if LLVM_VERSION_GE(12, 0) && !LLVM_VERSION_GE(13,0) PassBuilder PB(DebugPassManager, TM, PTO, PGOOpt, &PIC); #else PassBuilder PB(TM, PTO, PGOOpt, &PIC); #endif +#if LLVM_VERSION_GE(13, 0) + LoopAnalysisManager LAM; + FunctionAnalysisManager FAM; + CGSCCAnalysisManager CGAM; + ModuleAnalysisManager MAM; +#else LoopAnalysisManager LAM(DebugPassManager); FunctionAnalysisManager FAM(DebugPassManager); CGSCCAnalysisManager CGAM(DebugPassManager); ModuleAnalysisManager MAM(DebugPassManager); +#endif FAM.registerPass([&] { return PB.buildDefaultAAPipeline(); }); @@ -956,7 +963,11 @@ LLVMRustOptimizeWithNewPassManager( } } +#if LLVM_VERSION_GE(13, 0) + ModulePassManager MPM; +#else ModulePassManager MPM(DebugPassManager); +#endif bool NeedThinLTOBufferPasses = UseThinLTOBuffers; if (!NoPrepopulatePasses) { if (OptLevel == PassBuilder::OptimizationLevel::O0) { diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 14ee083eceebe..46ef308cbf27c 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -132,6 +132,7 @@ symbols! { Borrow, Break, C, + CStr, CString, Center, Clone, diff --git a/library/std/src/ffi/c_str.rs b/library/std/src/ffi/c_str.rs index 2f9845d7536cd..2a4ef553be399 100644 --- a/library/std/src/ffi/c_str.rs +++ b/library/std/src/ffi/c_str.rs @@ -10,7 +10,6 @@ use crate::error::Error; use crate::fmt::{self, Write}; use crate::io; use crate::mem; -use crate::memchr; use crate::num::NonZeroU8; use crate::ops; use crate::os::raw::c_char; @@ -20,6 +19,7 @@ use crate::slice; use crate::str::{self, Utf8Error}; use crate::sync::Arc; use crate::sys; +use crate::sys_common::memchr; /// A type representing an owned, C-compatible, nul-terminated string with no nul bytes in the /// middle. @@ -185,6 +185,7 @@ pub struct CString { /// /// [`&str`]: prim@str #[derive(Hash)] +#[cfg_attr(not(test), rustc_diagnostic_item = "CStr")] #[stable(feature = "rust1", since = "1.0.0")] // FIXME: // `fn from` in `impl From<&CStr> for Box` current implementation relies diff --git a/library/std/src/io/buffered/linewritershim.rs b/library/std/src/io/buffered/linewritershim.rs index d0c859d2e0c87..0175d2693e894 100644 --- a/library/std/src/io/buffered/linewritershim.rs +++ b/library/std/src/io/buffered/linewritershim.rs @@ -1,5 +1,5 @@ use crate::io::{self, BufWriter, IoSlice, Write}; -use crate::memchr; +use crate::sys_common::memchr; /// Private helper struct for implementing the line-buffered writing logic. /// This shim temporarily wraps a BufWriter, and uses its internals to diff --git a/library/std/src/io/mod.rs b/library/std/src/io/mod.rs index e18402f8dec1c..a8f3412c61116 100644 --- a/library/std/src/io/mod.rs +++ b/library/std/src/io/mod.rs @@ -253,12 +253,12 @@ mod tests; use crate::cmp; use crate::fmt; -use crate::memchr; use crate::ops::{Deref, DerefMut}; use crate::ptr; use crate::slice; use crate::str; use crate::sys; +use crate::sys_common::memchr; #[stable(feature = "rust1", since = "1.0.0")] pub use self::buffered::IntoInnerError; diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 6d11698d26822..442b5628d1dc0 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -530,7 +530,6 @@ mod sys; pub mod alloc; // Private support modules -mod memchr; mod panicking; // The runtime entry point and a few unstable public functions used by the diff --git a/library/std/src/sys/hermit/os.rs b/library/std/src/sys/hermit/os.rs index 81cd68a74e665..40bd393098f57 100644 --- a/library/std/src/sys/hermit/os.rs +++ b/library/std/src/sys/hermit/os.rs @@ -4,11 +4,11 @@ use crate::ffi::{CStr, OsStr, OsString}; use crate::fmt; use crate::io; use crate::marker::PhantomData; -use crate::memchr; use crate::path::{self, PathBuf}; use crate::str; use crate::sync::Mutex; use crate::sys::hermit::abi; +use crate::sys::memchr; use crate::sys::unsupported; use crate::sys_common::os_str_bytes::*; use crate::vec; diff --git a/library/std/src/sys/unix/os.rs b/library/std/src/sys/unix/os.rs index 51c3e5d175cca..bbc4691d963c6 100644 --- a/library/std/src/sys/unix/os.rs +++ b/library/std/src/sys/unix/os.rs @@ -13,13 +13,13 @@ use crate::fmt; use crate::io; use crate::iter; use crate::mem; -use crate::memchr; use crate::path::{self, PathBuf}; use crate::ptr; use crate::slice; use crate::str; use crate::sys::cvt; use crate::sys::fd; +use crate::sys::memchr; use crate::sys::rwlock::{RWLockReadGuard, StaticRWLock}; use crate::sys_common::mutex::{StaticMutex, StaticMutexGuard}; use crate::vec; diff --git a/library/std/src/memchr.rs b/library/std/src/sys_common/memchr.rs similarity index 92% rename from library/std/src/memchr.rs rename to library/std/src/sys_common/memchr.rs index 86a08f75a8d48..b219e87891264 100644 --- a/library/std/src/memchr.rs +++ b/library/std/src/sys_common/memchr.rs @@ -1,6 +1,8 @@ // Original implementation taken from rust-memchr. // Copyright 2015 Andrew Gallant, bluss and Nicolas Koch +use crate::sys::memchr as sys; + #[cfg(test)] mod tests; @@ -25,7 +27,7 @@ mod tests; /// ``` #[inline] pub fn memchr(needle: u8, haystack: &[u8]) -> Option { - crate::sys::memchr::memchr(needle, haystack) + sys::memchr(needle, haystack) } /// A safe interface to `memrchr`. @@ -45,5 +47,5 @@ pub fn memchr(needle: u8, haystack: &[u8]) -> Option { /// ``` #[inline] pub fn memrchr(needle: u8, haystack: &[u8]) -> Option { - crate::sys::memchr::memrchr(needle, haystack) + sys::memrchr(needle, haystack) } diff --git a/library/std/src/memchr/tests.rs b/library/std/src/sys_common/memchr/tests.rs similarity index 100% rename from library/std/src/memchr/tests.rs rename to library/std/src/sys_common/memchr/tests.rs diff --git a/library/std/src/sys_common/mod.rs b/library/std/src/sys_common/mod.rs index 7fa6977f2af26..5d2136ae74488 100644 --- a/library/std/src/sys_common/mod.rs +++ b/library/std/src/sys_common/mod.rs @@ -25,6 +25,7 @@ pub mod bytestring; pub mod condvar; pub mod fs; pub mod io; +pub mod memchr; pub mod mutex; // `doc` is required because `sys/mod.rs` imports `unix/ext/mod.rs` on Windows // when generating documentation. diff --git a/library/test/src/lib.rs b/library/test/src/lib.rs index 9adc099aaa566..bda5ed888d7e1 100644 --- a/library/test/src/lib.rs +++ b/library/test/src/lib.rs @@ -49,7 +49,7 @@ pub mod test { cli::{parse_opts, TestOpts}, filter_tests, helpers::metrics::{Metric, MetricMap}, - options::{Options, RunIgnored, RunStrategy, ShouldPanic}, + options::{Concurrent, Options, RunIgnored, RunStrategy, ShouldPanic}, run_test, test_main, test_main_static, test_result::{TestResult, TrFailed, TrFailedMsg, TrIgnored, TrOk}, time::{TestExecTime, TestTimeOptions}, diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index a288b43722ad4..318e1b44f8683 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -1352,8 +1352,11 @@ fn render_impl( } let w = if short_documented && trait_.is_some() { interesting } else { boring }; - if !doc_buffer.is_empty() { - w.write_str("
"); + let toggled = !doc_buffer.is_empty(); + if toggled { + let method_toggle_class = + if item_type == ItemType::Method { " method-toggle" } else { "" }; + write!(w, "
", method_toggle_class); } match *item.kind { clean::MethodItem(..) | clean::TyMethodItem(_) => { @@ -1453,7 +1456,7 @@ fn render_impl( } w.push_buffer(info_buffer); - if !doc_buffer.is_empty() { + if toggled { w.write_str(""); w.push_buffer(doc_buffer); w.push_str("
"); diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index 7c00cf940c773..8204949267250 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -924,24 +924,16 @@ function hideThemeButtonState() { }); } - if (hideMethodDocs) { - onEachLazy(document.getElementsByClassName("method"), function(e) { - var toggle = e.parentNode; - if (toggle) { - toggle = toggle.parentNode; - } - if (toggle && toggle.tagName === "DETAILS") { - toggle.open = false; - } - }); - } - onEachLazy(document.getElementsByTagName("details"), function (e) { var showLargeItem = !hideLargeItemContents && hasClass(e, "type-contents-toggle"); var showImplementor = !hideImplementors && hasClass(e, "implementors-toggle"); if (showLargeItem || showImplementor) { e.open = true; } + if (hideMethodDocs && hasClass(e, "method-toggle")) { + e.open = false; + } + }); var currentType = document.getElementsByClassName("type-decl")[0]; diff --git a/src/librustdoc/html/static/themes/ayu.css b/src/librustdoc/html/static/themes/ayu.css index 989ea7140c587..e59909ffdf05e 100644 --- a/src/librustdoc/html/static/themes/ayu.css +++ b/src/librustdoc/html/static/themes/ayu.css @@ -151,17 +151,14 @@ pre, .rustdoc.source .example-wrap { color: #c5c5c5; } -.content a:hover { +.search-results a:hover { background-color: #777; } -.content a:focus { +.search-results a:focus { color: #000 !important; background-color: #c6afb3; } -.content a:focus { - color: #000 !important; -} .search-results a { color: #0096cf; } diff --git a/src/librustdoc/html/static/themes/dark.css b/src/librustdoc/html/static/themes/dark.css index e6bd16ddd11b8..a2bcb43f44e6f 100644 --- a/src/librustdoc/html/static/themes/dark.css +++ b/src/librustdoc/html/static/themes/dark.css @@ -109,11 +109,11 @@ pre, .rustdoc.source .example-wrap { color: #ddd; } -.content a:hover { +.search-results a:hover { background-color: #777; } -.content a:focus { +.search-results a:focus { color: #eee !important; background-color: #616161; } diff --git a/src/librustdoc/html/static/themes/light.css b/src/librustdoc/html/static/themes/light.css index 5481b348aa26f..2ad3551d900ea 100644 --- a/src/librustdoc/html/static/themes/light.css +++ b/src/librustdoc/html/static/themes/light.css @@ -109,11 +109,11 @@ pre, .rustdoc.source .example-wrap { color: #4E4C4C; } -.content a:hover { +.search-results a:hover { background-color: #ddd; } -.content a:focus { +.search-results a:focus { color: #000 !important; background-color: #ccc; } diff --git a/src/tools/rust-analyzer b/src/tools/rust-analyzer index fd109fb587904..b82458818d44d 160000 --- a/src/tools/rust-analyzer +++ b/src/tools/rust-analyzer @@ -1 +1 @@ -Subproject commit fd109fb587904cfecc1149e068814bfd38feb83c +Subproject commit b82458818d44dfe5b4b5db38d8113e3f3194506e