Auto merge of #107967 - matthiaskrgr:rollup-7wvbla5, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #107748 (refer to new home) - #107842 (Patch `build/rustfmt/lib/*.so` for NixOS) - #107930 (Improve JS function itemTypeFromName code a bit) - #107934 (rustdoc: account for intra-doc links in `<meta name="description">`) - #107943 (Document `PointerLike`) - #107954 (avoid mixing accesses of ptrs derived from a mutable ref and parent ptrs) - #107955 (fix UB in ancient test) - #107964 (rustdoc: use tighter line height in h1 and h2) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
59083c57d4
@ -156,7 +156,7 @@ pub struct Session {
|
||||
/// `-C metadata` arguments passed to the compiler. Its value forms a unique
|
||||
/// global identifier for the crate. It is used to allow multiple crates
|
||||
/// with the same name to coexist. See the
|
||||
/// `rustc_codegen_llvm::back::symbol_names` module for more information.
|
||||
/// `rustc_symbol_mangling` crate for more information.
|
||||
pub stable_crate_id: OnceCell<StableCrateId>,
|
||||
|
||||
features: OnceCell<rustc_feature::Features>,
|
||||
|
@ -871,7 +871,10 @@ pub trait Destruct {}
|
||||
#[rustc_deny_explicit_impl]
|
||||
pub trait Tuple {}
|
||||
|
||||
/// A marker for things
|
||||
/// A marker for pointer-like types.
|
||||
///
|
||||
/// All types that have the same size and alignment as a `usize` or
|
||||
/// `*const ()` automatically implement this trait.
|
||||
#[unstable(feature = "pointer_like_trait", issue = "none")]
|
||||
#[cfg_attr(bootstrap, lang = "pointer_sized")]
|
||||
#[cfg_attr(not(bootstrap), lang = "pointer_like")]
|
||||
|
@ -25,7 +25,7 @@ fn test() {
|
||||
snd: isize,
|
||||
}
|
||||
let mut p = Pair { fst: 10, snd: 20 };
|
||||
let pptr: *mut Pair = &mut p;
|
||||
let pptr: *mut Pair = addr_of_mut!(p);
|
||||
let iptr: *mut isize = pptr as *mut isize;
|
||||
assert_eq!(*iptr, 10);
|
||||
*iptr = 30;
|
||||
@ -1070,8 +1070,8 @@ fn swap_copy_untyped() {
|
||||
let mut x = 5u8;
|
||||
let mut y = 6u8;
|
||||
|
||||
let ptr1 = &mut x as *mut u8 as *mut bool;
|
||||
let ptr2 = &mut y as *mut u8 as *mut bool;
|
||||
let ptr1 = addr_of_mut!(x).cast::<bool>();
|
||||
let ptr2 = addr_of_mut!(y).cast::<bool>();
|
||||
|
||||
unsafe {
|
||||
ptr::swap(ptr1, ptr2);
|
||||
|
@ -181,8 +181,7 @@ impl Config {
|
||||
// appear to have this (even when `../lib` is redundant).
|
||||
// NOTE: there are only two paths here, delimited by a `:`
|
||||
let mut entries = OsString::from("$ORIGIN/../lib:");
|
||||
entries.push(t!(fs::canonicalize(nix_deps_dir)));
|
||||
entries.push("/lib");
|
||||
entries.push(t!(fs::canonicalize(nix_deps_dir)).join("lib"));
|
||||
entries
|
||||
};
|
||||
patchelf.args(&[OsString::from("--set-rpath"), rpath_entries]);
|
||||
@ -370,6 +369,13 @@ impl Config {
|
||||
if self.should_fix_bins_and_dylibs() {
|
||||
self.fix_bin_or_dylib(&bin_root.join("bin").join("rustfmt"));
|
||||
self.fix_bin_or_dylib(&bin_root.join("bin").join("cargo-fmt"));
|
||||
let lib_dir = bin_root.join("lib");
|
||||
for lib in t!(fs::read_dir(&lib_dir), lib_dir.display().to_string()) {
|
||||
let lib = t!(lib);
|
||||
if lib.path().extension() == Some(OsStr::new("so")) {
|
||||
self.fix_bin_or_dylib(&lib.path());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.create(&rustfmt_stamp, &channel);
|
||||
|
@ -1176,14 +1176,23 @@ pub(crate) fn short_markdown_summary(markdown: &str, link_names: &[RenderedLink]
|
||||
/// - Headings, links, and formatting are stripped.
|
||||
/// - Inline code is rendered as-is, surrounded by backticks.
|
||||
/// - HTML and code blocks are ignored.
|
||||
pub(crate) fn plain_text_summary(md: &str) -> String {
|
||||
pub(crate) fn plain_text_summary(md: &str, link_names: &[RenderedLink]) -> String {
|
||||
if md.is_empty() {
|
||||
return String::new();
|
||||
}
|
||||
|
||||
let mut s = String::with_capacity(md.len() * 3 / 2);
|
||||
|
||||
for event in Parser::new_ext(md, summary_opts()) {
|
||||
let mut replacer = |broken_link: BrokenLink<'_>| {
|
||||
link_names
|
||||
.iter()
|
||||
.find(|link| link.original_text.as_str() == &*broken_link.reference)
|
||||
.map(|link| (link.href.as_str().into(), link.new_text.as_str().into()))
|
||||
};
|
||||
|
||||
let p = Parser::new_with_broken_link_callback(md, summary_opts(), Some(&mut replacer));
|
||||
|
||||
for event in p {
|
||||
match &event {
|
||||
Event::Text(text) => s.push_str(text),
|
||||
Event::Code(code) => {
|
||||
|
@ -249,7 +249,7 @@ fn test_short_markdown_summary() {
|
||||
#[test]
|
||||
fn test_plain_text_summary() {
|
||||
fn t(input: &str, expect: &str) {
|
||||
let output = plain_text_summary(input);
|
||||
let output = plain_text_summary(input, &[]);
|
||||
assert_eq!(output, expect, "original: {}", input);
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,10 @@ impl<'tcx> Context<'tcx> {
|
||||
};
|
||||
title.push_str(" - Rust");
|
||||
let tyname = it.type_();
|
||||
let desc = it.doc_value().as_ref().map(|doc| plain_text_summary(doc));
|
||||
let desc = it
|
||||
.doc_value()
|
||||
.as_ref()
|
||||
.map(|doc| plain_text_summary(doc, &it.link_names(&self.cache())));
|
||||
let desc = if let Some(desc) = desc {
|
||||
desc
|
||||
} else if it.is_crate() {
|
||||
|
@ -174,6 +174,14 @@ h1, h2, h3, h4 {
|
||||
.top-doc .docblock > h4 {
|
||||
border-bottom: 1px solid var(--headings-border-bottom-color);
|
||||
}
|
||||
/* while line-height 1.5 is required for any "block of text",
|
||||
which WCAG defines as more than one sentence, it looks weird for
|
||||
very large main headers */
|
||||
h1, h2 {
|
||||
line-height: 1.25;
|
||||
padding-top: 3px;
|
||||
padding-bottom: 9px;
|
||||
}
|
||||
h3.code-header {
|
||||
font-size: 1.125rem; /* 18px */
|
||||
}
|
||||
|
@ -142,13 +142,11 @@ function initSearch(rawSearchIndex) {
|
||||
}
|
||||
|
||||
function itemTypeFromName(typename) {
|
||||
for (let i = 0, len = itemTypes.length; i < len; ++i) {
|
||||
if (itemTypes[i] === typename) {
|
||||
return i;
|
||||
}
|
||||
const index = itemTypes.findIndex(i => i === typename);
|
||||
if (index < 0) {
|
||||
throw new Error("Unknown type filter `" + typename + "`");
|
||||
}
|
||||
|
||||
throw new Error("Unknown type filter `" + typename + "`");
|
||||
return index;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -12,7 +12,7 @@ assert-css: (".main-heading", {
|
||||
"flex-direction": "column"
|
||||
})
|
||||
|
||||
assert-property: (".mobile-topbar h2", {"offsetHeight": 36})
|
||||
assert-property: (".mobile-topbar h2", {"offsetHeight": 33})
|
||||
|
||||
// Note: We can't use assert-text here because the 'Since' is set by CSS and
|
||||
// is therefore not part of the DOM.
|
||||
|
@ -40,10 +40,10 @@ assert-property: (
|
||||
store-value: (offset_y, 4)
|
||||
|
||||
// First with desktop
|
||||
assert-position: (".scraped-example .code-wrapper", {"y": 255})
|
||||
assert-position: (".scraped-example .code-wrapper .prev", {"y": 255 + |offset_y|})
|
||||
assert-position: (".scraped-example .code-wrapper", {"y": 253})
|
||||
assert-position: (".scraped-example .code-wrapper .prev", {"y": 253 + |offset_y|})
|
||||
|
||||
// Then with mobile
|
||||
size: (600, 600)
|
||||
assert-position: (".scraped-example .code-wrapper", {"y": 314})
|
||||
assert-position: (".scraped-example .code-wrapper .prev", {"y": 314 + |offset_y|})
|
||||
assert-position: (".scraped-example .code-wrapper", {"y": 308})
|
||||
assert-position: (".scraped-example .code-wrapper .prev", {"y": 308 + |offset_y|})
|
||||
|
@ -22,7 +22,7 @@ size: (900, 900)
|
||||
|
||||
// First we check the current width, height and position.
|
||||
assert-css: ("#crate-search", {"width": "223px"})
|
||||
assert-css: (".search-results-title", {"height": "44px", "width": "640px"})
|
||||
assert-css: (".search-results-title", {"height": "50px", "width": "640px"})
|
||||
assert-css: ("#search", {"width": "640px"})
|
||||
|
||||
// Then we update the text of one of the `<option>`.
|
||||
@ -33,7 +33,7 @@ text: (
|
||||
|
||||
// Then we compare again to confirm the height didn't change.
|
||||
assert-css: ("#crate-search", {"width": "527px"})
|
||||
assert-css: (".search-results-title", {"height": "44px", "width": "640px"})
|
||||
assert-css: (".search-results-title", {"height": "50px", "width": "640px"})
|
||||
// And we check that the `<select>` isn't bigger than its container (".search-results-title").
|
||||
assert-css: ("#search", {"width": "640px"})
|
||||
|
||||
|
@ -6,7 +6,7 @@ assert-css: (".sidebar", {"display": "block", "left": "-1000px"})
|
||||
|
||||
// Scroll down.
|
||||
scroll-to: "//h2[@id='blanket-implementations']"
|
||||
assert-window-property: {"pageYOffset": "627"}
|
||||
assert-window-property: {"pageYOffset": "622"}
|
||||
|
||||
// Open the sidebar menu.
|
||||
click: ".sidebar-menu-toggle"
|
||||
@ -21,11 +21,11 @@ assert-window-property: {"pageYOffset": "0"}
|
||||
// Close the sidebar menu. Make sure the scroll position gets restored.
|
||||
click: ".sidebar-menu-toggle"
|
||||
wait-for-css: (".sidebar", {"left": "-1000px"})
|
||||
assert-window-property: {"pageYOffset": "627"}
|
||||
assert-window-property: {"pageYOffset": "622"}
|
||||
|
||||
// Now test that scrollability returns when the browser window is just resized.
|
||||
click: ".sidebar-menu-toggle"
|
||||
wait-for-css: (".sidebar", {"left": "0px"})
|
||||
assert-window-property: {"pageYOffset": "0"}
|
||||
size: (900, 600)
|
||||
assert-window-property: {"pageYOffset": "627"}
|
||||
assert-window-property: {"pageYOffset": "622"}
|
||||
|
@ -45,7 +45,7 @@ assert-property: (".mobile-topbar", {"clientHeight": "45"})
|
||||
// so the target is not obscured by the topbar.
|
||||
click: ".sidebar-menu-toggle"
|
||||
click: ".sidebar-elems section .block li > a"
|
||||
assert-position: ("#method\.must_use", {"y": 45})
|
||||
assert-position: ("#method\.must_use", {"y": 46})
|
||||
|
||||
// Check that the bottom-most item on the sidebar menu can be scrolled fully into view.
|
||||
click: ".sidebar-menu-toggle"
|
||||
|
@ -22,3 +22,9 @@ pub mod foo_mod {
|
||||
// 'Only paragraph.'
|
||||
/// Only paragraph.
|
||||
pub fn foo_fn() {}
|
||||
|
||||
// @has 'foo/fn.bar_fn.html' '//meta[@name="description"]/@content' \
|
||||
// 'Description with intra-doc link to foo_fn and [nonexistent_item] and foo_fn.'
|
||||
#[allow(rustdoc::broken_intra_doc_links)]
|
||||
/// Description with intra-doc link to [foo_fn] and [nonexistent_item] and [foo_fn](self::foo_fn).
|
||||
pub fn bar_fn() {}
|
||||
|
@ -22,15 +22,15 @@ struct Ccx {
|
||||
x: isize,
|
||||
}
|
||||
|
||||
fn allocate(_bcx: &arena) -> &Bcx<'_> {
|
||||
fn allocate(_bcx: &arena) -> &mut Bcx<'_> {
|
||||
unsafe {
|
||||
let layout = Layout::new::<Bcx>();
|
||||
let ptr = Global.allocate(layout).unwrap_or_else(|_| handle_alloc_error(layout));
|
||||
&*(ptr.as_ptr() as *const _)
|
||||
&mut *ptr.as_ptr().cast()
|
||||
}
|
||||
}
|
||||
|
||||
fn h<'a>(bcx: &'a Bcx<'a>) -> &'a Bcx<'a> {
|
||||
fn h<'a>(bcx: &'a Bcx<'a>) -> &'a mut Bcx<'a> {
|
||||
return allocate(bcx.fcx.arena);
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ fn g(fcx: &Fcx) {
|
||||
let bcx = Bcx { fcx };
|
||||
let bcx2 = h(&bcx);
|
||||
unsafe {
|
||||
Global.deallocate(NonNull::new_unchecked(bcx2 as *const _ as *mut _), Layout::new::<Bcx>());
|
||||
Global.deallocate(NonNull::new_unchecked(bcx2 as *mut _ as *mut _), Layout::new::<Bcx>());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user