Skip to content

Commit b53e5c9

Browse files
committed
Auto merge of rust-lang#141216 - fmease:rollup-pa5mvx3, r=fmease
Rollup of 8 pull requests Successful merges: - rust-lang#140113 (Add per page TOC in the `rustc` book) - rust-lang#140511 (Stabilize `#![feature(non_null_from_ref)]`) - rust-lang#140924 (Make some `f32`/`f64` tests also run in const-context) - rust-lang#140966 (Remove #![feature(let_chains)] from library and src/librustdoc) - 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 7205fc5 + c7e2e88 commit b53e5c9

File tree

22 files changed

+449
-165
lines changed

22 files changed

+449
-165
lines changed

compiler/rustc_pattern_analysis/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#![allow(rustc::diagnostic_outside_of_impl)]
77
#![allow(rustc::untranslatable_diagnostic)]
88
#![allow(unused_crate_dependencies)]
9-
#![cfg_attr(all(feature = "rustc", bootstrap), feature(let_chains))]
109
// tidy-alphabetical-end
1110

1211
pub mod constructor;

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/core/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@
111111
#![feature(is_ascii_octdigit)]
112112
#![feature(lazy_get)]
113113
#![feature(link_cfg)]
114-
#![feature(non_null_from_ref)]
115114
#![feature(offset_of_enum)]
116115
#![feature(panic_internals)]
117116
#![feature(ptr_alignment_type)]

library/core/src/ptr/non_null.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -262,15 +262,17 @@ impl<T: ?Sized> NonNull<T> {
262262
}
263263

264264
/// Converts a reference to a `NonNull` pointer.
265-
#[unstable(feature = "non_null_from_ref", issue = "130823")]
265+
#[stable(feature = "non_null_from_ref", since = "CURRENT_RUSTC_VERSION")]
266+
#[rustc_const_stable(feature = "non_null_from_ref", since = "CURRENT_RUSTC_VERSION")]
266267
#[inline]
267268
pub const fn from_ref(r: &T) -> Self {
268269
// SAFETY: A reference cannot be null.
269270
unsafe { NonNull { pointer: r as *const T } }
270271
}
271272

272273
/// Converts a mutable reference to a `NonNull` pointer.
273-
#[unstable(feature = "non_null_from_ref", issue = "130823")]
274+
#[stable(feature = "non_null_from_ref", since = "CURRENT_RUSTC_VERSION")]
275+
#[rustc_const_stable(feature = "non_null_from_ref", since = "CURRENT_RUSTC_VERSION")]
274276
#[inline]
275277
pub const fn from_mut(r: &mut T) -> Self {
276278
// SAFETY: A mutable reference cannot be null.

library/coretests/tests/num/mod.rs

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

library/std/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,6 @@
305305
#![feature(iter_advance_by)]
306306
#![feature(iter_next_chunk)]
307307
#![feature(lang_items)]
308-
#![feature(let_chains)]
309308
#![feature(link_cfg)]
310309
#![feature(linkage)]
311310
#![feature(macro_metavar_expr_concat)]

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/librustdoc/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#![feature(if_let_guard)]
1212
#![feature(impl_trait_in_assoc_type)]
1313
#![feature(iter_intersperse)]
14-
#![feature(let_chains)]
1514
#![feature(never_type)]
1615
#![feature(round_char_boundary)]
1716
#![feature(test)]

tests/run-make/core-no-oom-handling/rmake.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use run_make_support::{rustc, source_root};
66

77
fn main() {
88
rustc()
9-
.edition("2021")
9+
.edition("2024")
1010
.arg("-Dwarnings")
1111
.crate_type("rlib")
1212
.input(source_root().join("library/core/src/lib.rs"))

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/imports/issue-99695-b.fixed

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ mod m {
1111
pub struct other_item;
1212
}
1313

14-
use ::nu;
14+
use crate::nu;
1515
pub use self::p::{other_item as _};
1616
//~^ ERROR unresolved import `self::p::nu` [E0432]
1717
//~| HELP a macro with this name exists at the root of the crate

tests/ui/imports/issue-99695-b.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | pub use self::p::{nu, other_item as _};
77
= note: this could be because a macro annotated with `#[macro_export]` will be exported at the root of the crate instead of the module where it is defined
88
help: a macro with this name exists at the root of the crate
99
|
10-
LL ~ use ::nu;
10+
LL ~ use crate::nu;
1111
LL ~ pub use self::p::{other_item as _};
1212
|
1313

tests/ui/imports/issue-99695.fixed renamed to tests/ui/imports/issue-99695.edition_2015.fixed

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
//@ run-rustfix
2+
//@ revisions: edition_2015 edition_2018
3+
//@ [edition_2015] edition: 2015
4+
//@ [edition_2018] edition: 2018
5+
26
#![allow(unused, nonstandard_style)]
37
mod m {
48
#[macro_export]
@@ -8,7 +12,7 @@ mod m {
812

913
pub struct other_item;
1014

11-
use ::nu;
15+
use crate::nu;
1216
pub use self::{other_item as _};
1317
//~^ ERROR unresolved import `self::nu` [E0432]
1418
//~| HELP a macro with this name exists at the root of the crate

tests/ui/imports/issue-99695.stderr renamed to tests/ui/imports/issue-99695.edition_2015.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
error[E0432]: unresolved import `self::nu`
2-
--> $DIR/issue-99695.rs:11:20
2+
--> $DIR/issue-99695.rs:15:20
33
|
44
LL | pub use self::{nu, other_item as _};
55
| ^^ no `nu` in `m`
66
|
77
= note: this could be because a macro annotated with `#[macro_export]` will be exported at the root of the crate instead of the module where it is defined
88
help: a macro with this name exists at the root of the crate
99
|
10-
LL ~ use ::nu;
10+
LL ~ use crate::nu;
1111
LL ~ pub use self::{other_item as _};
1212
|
1313

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//@ run-rustfix
2+
//@ revisions: edition_2015 edition_2018
3+
//@ [edition_2015] edition: 2015
4+
//@ [edition_2018] edition: 2018
5+
6+
#![allow(unused, nonstandard_style)]
7+
mod m {
8+
#[macro_export]
9+
macro_rules! nu {
10+
{} => {};
11+
}
12+
13+
pub struct other_item;
14+
15+
use crate::nu;
16+
pub use self::{other_item as _};
17+
//~^ ERROR unresolved import `self::nu` [E0432]
18+
//~| HELP a macro with this name exists at the root of the crate
19+
}
20+
21+
fn main() {}

0 commit comments

Comments
 (0)