Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 7 pull requests #85474

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(); });

Expand Down Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ symbols! {
Borrow,
Break,
C,
CStr,
CString,
Center,
Clone,
Expand Down
3 changes: 2 additions & 1 deletion library/std/src/ffi/c_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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.
Expand Down Expand Up @@ -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<CStr>` current implementation relies
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/io/buffered/linewritershim.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion library/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sys/hermit/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sys/unix/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -25,7 +27,7 @@ mod tests;
/// ```
#[inline]
pub fn memchr(needle: u8, haystack: &[u8]) -> Option<usize> {
crate::sys::memchr::memchr(needle, haystack)
sys::memchr(needle, haystack)
}

/// A safe interface to `memrchr`.
Expand All @@ -45,5 +47,5 @@ pub fn memchr(needle: u8, haystack: &[u8]) -> Option<usize> {
/// ```
#[inline]
pub fn memrchr(needle: u8, haystack: &[u8]) -> Option<usize> {
crate::sys::memchr::memrchr(needle, haystack)
sys::memrchr(needle, haystack)
}
1 change: 1 addition & 0 deletions library/std/src/sys_common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion library/test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
9 changes: 6 additions & 3 deletions src/librustdoc/html/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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("<details class=\"rustdoc-toggle\" open><summary>");
let toggled = !doc_buffer.is_empty();
if toggled {
let method_toggle_class =
if item_type == ItemType::Method { " method-toggle" } else { "" };
write!(w, "<details class=\"rustdoc-toggle{}\" open><summary>", method_toggle_class);
}
match *item.kind {
clean::MethodItem(..) | clean::TyMethodItem(_) => {
Expand Down Expand Up @@ -1453,7 +1456,7 @@ fn render_impl(
}

w.push_buffer(info_buffer);
if !doc_buffer.is_empty() {
if toggled {
w.write_str("</summary>");
w.push_buffer(doc_buffer);
w.push_str("</details>");
Expand Down
16 changes: 4 additions & 12 deletions src/librustdoc/html/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
7 changes: 2 additions & 5 deletions src/librustdoc/html/static/themes/ayu.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/html/static/themes/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/html/static/themes/light.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/tools/rust-analyzer