Skip to content

Commit f3dd06e

Browse files
committed
Auto merge of rust-lang#141209 - fmease:rollup-s1ck9vb, r=fmease
Rollup of 7 pull requests Successful merges: - rust-lang#140113 (Add per page TOC in the `rustc` book) - rust-lang#140490 (split `asm!` parsing and validation) - rust-lang#140924 (Make some `f32`/`f64` tests also run in const-context) - rust-lang#141045 ([win][arm64] Remove 'Arm64 Hazard' undocumented MSVC option and instead disable problematic test) - rust-lang#141071 (Enable [behind-upstream] triagebot option for rust-lang/rust) - rust-lang#141132 (Use `crate::` prefix for root macro suggestions) - rust-lang#141139 (Fix Rust for Linux ping group label) r? `@ghost` `@rustbot` modify labels: rollup
2 parents ae3b909 + 34613ab commit f3dd06e

File tree

21 files changed

+765
-417
lines changed

21 files changed

+765
-417
lines changed

compiler/rustc_builtin_macros/src/asm.rs

+294-218
Large diffs are not rendered by default.

compiler/rustc_builtin_macros/src/errors.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,7 @@ pub(crate) struct AsmOptAlreadyprovided {
910910
pub(crate) span: Span,
911911
pub(crate) symbol: Symbol,
912912
#[suggestion(code = "", applicability = "machine-applicable", style = "tool-only")]
913-
pub(crate) full_span: Span,
913+
pub(crate) span_with_comma: Span,
914914
}
915915

916916
#[derive(Diagnostic)]
@@ -921,7 +921,7 @@ pub(crate) struct AsmUnsupportedOption {
921921
pub(crate) span: Span,
922922
pub(crate) symbol: Symbol,
923923
#[suggestion(code = "", applicability = "machine-applicable", style = "tool-only")]
924-
pub(crate) full_span: Span,
924+
pub(crate) span_with_comma: Span,
925925
pub(crate) macro_name: &'static str,
926926
}
927927

compiler/rustc_resolve/src/diagnostics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2493,7 +2493,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
24932493
let Res::Def(DefKind::Macro(MacroKind::Bang), _) = binding.res() else {
24942494
return None;
24952495
};
2496-
let module_name = crate_module.kind.name().unwrap_or(kw::Empty);
2496+
let module_name = crate_module.kind.name().unwrap_or(kw::Crate);
24972497
let import_snippet = match import.kind {
24982498
ImportKind::Single { source, target, .. } if source != target => {
24992499
format!("{source} as {target}")

compiler/rustc_target/src/spec/targets/aarch64_pc_windows_msvc.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{FramePointer, LinkerFlavor, Lld, Target, TargetMetadata, base};
1+
use crate::spec::{FramePointer, Target, TargetMetadata, base};
22

33
pub(crate) fn target() -> Target {
44
let mut base = base::windows_msvc::opts();
@@ -11,11 +11,6 @@ pub(crate) fn target() -> Target {
1111
// and other services. It must point to the previous {x29, x30} pair on the stack."
1212
base.frame_pointer = FramePointer::NonLeaf;
1313

14-
// MSVC emits a warning about code that may trip "Cortex-A53 MPCore processor bug #843419" (see
15-
// https://developer.arm.com/documentation/epm048406/latest) which is sometimes emitted by LLVM.
16-
// Since Arm64 Windows 10+ isn't supported on that processor, it's safe to disable the warning.
17-
base.add_pre_link_args(LinkerFlavor::Msvc(Lld::No), &["/arm64hazardfree"]);
18-
1914
Target {
2015
llvm_target: "aarch64-pc-windows-msvc".into(),
2116
metadata: TargetMetadata {

library/coretests/tests/num/mod.rs

+189-143
Large diffs are not rendered by default.

src/doc/rustc-dev-guide/src/notification-groups/rust-for-linux.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Rust for Linux notification group
22

3-
**Github Label:** [O-rfl] <br>
3+
**Github Label:** [A-rust-for-linux] <br>
44
**Ping command:** `@rustbot ping rfl`
55

6-
[O-rfl]: https://github.com/rust-lang/rust/labels/O-rfl
6+
[A-rust-for-linux]: https://github.com/rust-lang/rust/labels/A-rust-for-linux
77

88
This list will be used to notify [Rust for Linux (RfL)][rfl] maintainers
99
when the compiler or the standard library changes in a way that would

src/doc/rustc/book.toml

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ title = "The rustc book"
66
[output.html]
77
git-repository-url = "https://github.com/rust-lang/rust/tree/master/src/doc/rustc"
88
edit-url-template = "https://github.com/rust-lang/rust/edit/master/src/doc/rustc/{path}"
9+
additional-css = ["theme/pagetoc.css"]
10+
additional-js = ["theme/pagetoc.js"]
911

1012
[output.html.search]
1113
use-boolean-and = true

src/doc/rustc/theme/pagetoc.css

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/* Inspired by https://github.com/JorelAli/mdBook-pagetoc/tree/98ee241 (under WTFPL) */
2+
3+
:root {
4+
--toc-width: 270px;
5+
--center-content-toc-shift: calc(-1 * var(--toc-width) / 2);
6+
}
7+
8+
.nav-chapters {
9+
/* adjust width of buttons that bring to the previous or the next page */
10+
min-width: 50px;
11+
}
12+
13+
@media only screen {
14+
@media (max-width: 1179px) {
15+
.sidebar-hidden #sidetoc {
16+
display: none;
17+
}
18+
}
19+
20+
@media (max-width: 1439px) {
21+
.sidebar-visible #sidetoc {
22+
display: none;
23+
}
24+
}
25+
26+
@media (1180px <= width <= 1439px) {
27+
.sidebar-hidden main {
28+
position: relative;
29+
left: var(--center-content-toc-shift);
30+
}
31+
}
32+
33+
@media (1440px <= width <= 1700px) {
34+
.sidebar-visible main {
35+
position: relative;
36+
left: var(--center-content-toc-shift);
37+
}
38+
}
39+
40+
#sidetoc {
41+
margin-left: calc(100% + 20px);
42+
}
43+
#pagetoc {
44+
position: fixed;
45+
/* adjust TOC width */
46+
width: var(--toc-width);
47+
height: calc(100vh - var(--menu-bar-height) - 0.67em * 4);
48+
overflow: auto;
49+
}
50+
#pagetoc a {
51+
border-left: 1px solid var(--sidebar-bg);
52+
color: var(--sidebar-fg) !important;
53+
display: block;
54+
padding-bottom: 5px;
55+
padding-top: 5px;
56+
padding-left: 10px;
57+
text-align: left;
58+
text-decoration: none;
59+
}
60+
#pagetoc a:hover,
61+
#pagetoc a.active {
62+
background: var(--sidebar-bg);
63+
color: var(--sidebar-active) !important;
64+
}
65+
#pagetoc .active {
66+
background: var(--sidebar-bg);
67+
color: var(--sidebar-active);
68+
}
69+
#pagetoc .pagetoc-H2 {
70+
padding-left: 20px;
71+
}
72+
#pagetoc .pagetoc-H3 {
73+
padding-left: 40px;
74+
}
75+
#pagetoc .pagetoc-H4 {
76+
padding-left: 60px;
77+
}
78+
}
79+
80+
@media print {
81+
#sidetoc {
82+
display: none;
83+
}
84+
}

src/doc/rustc/theme/pagetoc.js

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
// Inspired by https://github.com/JorelAli/mdBook-pagetoc/tree/98ee241 (under WTFPL)
2+
3+
let activeHref = location.href;
4+
function updatePageToc(elem = undefined) {
5+
let selectedPageTocElem = elem;
6+
const pagetoc = document.getElementById("pagetoc");
7+
8+
function getRect(element) {
9+
return element.getBoundingClientRect();
10+
}
11+
12+
function overflowTop(container, element) {
13+
return getRect(container).top - getRect(element).top;
14+
}
15+
16+
function overflowBottom(container, element) {
17+
return getRect(container).bottom - getRect(element).bottom;
18+
}
19+
20+
// We've not selected a heading to highlight, and the URL needs updating
21+
// so we need to find a heading based on the URL
22+
if (selectedPageTocElem === undefined && location.href !== activeHref) {
23+
activeHref = location.href;
24+
for (const pageTocElement of pagetoc.children) {
25+
if (pageTocElement.href === activeHref) {
26+
selectedPageTocElem = pageTocElement;
27+
}
28+
}
29+
}
30+
31+
// We still don't have a selected heading, let's try and find the most
32+
// suitable heading based on the scroll position
33+
if (selectedPageTocElem === undefined) {
34+
const margin = window.innerHeight / 3;
35+
36+
const headers = document.getElementsByClassName("header");
37+
for (let i = 0; i < headers.length; i++) {
38+
const header = headers[i];
39+
if (selectedPageTocElem === undefined && getRect(header).top >= 0) {
40+
if (getRect(header).top < margin) {
41+
selectedPageTocElem = header;
42+
} else {
43+
selectedPageTocElem = headers[Math.max(0, i - 1)];
44+
}
45+
}
46+
// a very long last section's heading is over the screen
47+
if (selectedPageTocElem === undefined && i === headers.length - 1) {
48+
selectedPageTocElem = header;
49+
}
50+
}
51+
}
52+
53+
// Remove the active flag from all pagetoc elements
54+
for (const pageTocElement of pagetoc.children) {
55+
pageTocElement.classList.remove("active");
56+
}
57+
58+
// If we have a selected heading, set it to active and scroll to it
59+
if (selectedPageTocElem !== undefined) {
60+
for (const pageTocElement of pagetoc.children) {
61+
if (selectedPageTocElem.href.localeCompare(pageTocElement.href) === 0) {
62+
pageTocElement.classList.add("active");
63+
if (overflowTop(pagetoc, pageTocElement) > 0) {
64+
pagetoc.scrollTop = pageTocElement.offsetTop;
65+
}
66+
if (overflowBottom(pagetoc, pageTocElement) < 0) {
67+
pagetoc.scrollTop -= overflowBottom(pagetoc, pageTocElement);
68+
}
69+
}
70+
}
71+
}
72+
}
73+
74+
if (document.getElementById("sidetoc") === null &&
75+
document.getElementsByClassName("header").length > 0) {
76+
// The sidetoc element doesn't exist yet, let's create it
77+
78+
// Create the empty sidetoc and pagetoc elements
79+
const sidetoc = document.createElement("div");
80+
const pagetoc = document.createElement("div");
81+
sidetoc.id = "sidetoc";
82+
pagetoc.id = "pagetoc";
83+
sidetoc.appendChild(pagetoc);
84+
85+
// And append them to the current DOM
86+
const main = document.querySelector('main');
87+
main.insertBefore(sidetoc, main.firstChild);
88+
89+
// Populate sidebar on load
90+
window.addEventListener("load", () => {
91+
for (const header of document.getElementsByClassName("header")) {
92+
const link = document.createElement("a");
93+
link.innerHTML = header.innerHTML;
94+
link.href = header.hash;
95+
link.classList.add("pagetoc-" + header.parentElement.tagName);
96+
document.getElementById("pagetoc").appendChild(link);
97+
link.onclick = () => updatePageToc(link);
98+
}
99+
updatePageToc();
100+
});
101+
102+
// Update page table of contents selected heading on scroll
103+
window.addEventListener("scroll", () => updatePageToc());
104+
}

src/tools/rustfmt/src/parse/macros/asm.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use rustc_ast::ast;
2-
use rustc_builtin_macros::asm::{AsmArgs, parse_asm_args};
2+
use rustc_builtin_macros::asm::{AsmArg, parse_asm_args};
33

44
use crate::rewrite::RewriteContext;
55

66
#[allow(dead_code)]
7-
pub(crate) fn parse_asm(context: &RewriteContext<'_>, mac: &ast::MacCall) -> Option<AsmArgs> {
7+
pub(crate) fn parse_asm(context: &RewriteContext<'_>, mac: &ast::MacCall) -> Option<Vec<AsmArg>> {
88
let ts = mac.args.tokens.clone();
99
let mut parser = super::build_parser(context, ts);
1010
parse_asm_args(&mut parser, mac.span(), ast::AsmMacro::Asm).ok()

tests/run-make/llvm-location-discriminator-limit-dummy-span/rmake.rs

+7
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111
//@ needs-dynamic-linking
1212
//@ only-nightly (requires unstable rustc flag)
1313

14+
// This test trips a check in the MSVC linker for an outdated processor:
15+
// "LNK1322: cannot avoid potential ARM hazard (Cortex-A53 MPCore processor bug #843419)"
16+
// Until MSVC removes this check:
17+
// https://developercommunity.microsoft.com/t/Remove-checking-for-and-fixing-Cortex-A/10905134
18+
// we'll need to disable this test on Arm64 Windows.
19+
//@ ignore-aarch64-pc-windows-msvc
20+
1421
#![deny(warnings)]
1522

1623
use run_make_support::{dynamic_lib_name, rfs, rust_lib_name, rustc};

tests/ui/asm/parse-error.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,9 @@ global_asm!("", options(FOO));
113113
global_asm!("", options(FOO,));
114114
//~^ ERROR expected one of `)`, `att_syntax`, or `raw`, found `FOO`
115115
global_asm!("", options(nomem FOO));
116-
//~^ ERROR the `nomem` option cannot be used with `global_asm!`
117-
//~| ERROR expected one of `)` or `,`, found `FOO`
116+
//~^ ERROR expected one of `)` or `,`, found `FOO`
118117
global_asm!("", options(nomem, FOO));
119-
//~^ ERROR the `nomem` option cannot be used with `global_asm!`
120-
//~| ERROR expected one of `)`, `att_syntax`, or `raw`, found `FOO`
118+
//~^ ERROR expected one of `)`, `att_syntax`, or `raw`, found `FOO`
121119
global_asm!("{}", options(), const FOO);
122120
global_asm!("", clobber_abi(FOO));
123121
//~^ ERROR expected string literal

0 commit comments

Comments
 (0)