Skip to content
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
e83a0a4
Stabilize `#![feature(non_null_from_ref)]`
mathisbot Apr 30, 2025
9ccabd5
Make some `f32`/`f64` tests also run in const-context
Urgau May 11, 2025
6128fca
[win][arm64] Remove 'Arm64 Hazard' undocumented MSVC option and inste…
dpaoliello May 15, 2025
8fcff8c
Add per page TOC in the rustc book
Urgau Apr 21, 2025
72f915a
Fix flicker when page loads
Urgau Apr 21, 2025
4cbcb44
Cleanup the Javascript and CSS of our custom TOC
Urgau Apr 21, 2025
84d7edd
Enable [behind-upstream] triagebot option for rust-lang/rust
xizheyin May 16, 2025
258e880
Remove #![feature(let_chains)] from library and src/librustdoc
est31 May 13, 2025
1adfdb4
Use `crate::` prefix for root macro suggestions
bvanjoi May 17, 2025
b3b2153
Update triagebot.toml
xizheyin May 17, 2025
65d381b
triagebot: fix Rust for Linux ping group rust-lang/rust label
jieyouxu May 17, 2025
2dddbd1
rustc-dev-guide: fix Rust for Linux rust-lang/rust label
jieyouxu May 17, 2025
5592f41
Rollup merge of #140113 - Urgau:rustc-book-page-toc, r=ehuss
fmease May 18, 2025
1585933
Rollup merge of #140511 - mathisbot:master, r=dtolnay
fmease May 18, 2025
5a55870
Rollup merge of #140924 - Urgau:f32_f64_const_tests, r=Mark-Simulacrum
fmease May 18, 2025
eb21b25
Rollup merge of #140966 - est31:let_chains_library, r=tgross35
fmease May 18, 2025
e323c64
Rollup merge of #141045 - dpaoliello:noarmhazard, r=jieyouxu
fmease May 18, 2025
2aff1d6
Rollup merge of #141071 - xizheyin:behind-upstream, r=Urgau
fmease May 18, 2025
b89118a
Rollup merge of #141132 - bvanjoi:issue-141082, r=fmease
fmease May 18, 2025
c7e2e88
Rollup merge of #141139 - jieyouxu:fix-rfl, r=Urgau
fmease May 18, 2025
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
1 change: 0 additions & 1 deletion compiler/rustc_pattern_analysis/src/lib.rs
Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
#![allow(unused_crate_dependencies)]
#![cfg_attr(all(feature = "rustc", bootstrap), feature(let_chains))]
// tidy-alphabetical-end

pub mod constructor;
2 changes: 1 addition & 1 deletion compiler/rustc_resolve/src/diagnostics.rs
Original file line number Diff line number Diff line change
@@ -2493,7 +2493,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
let Res::Def(DefKind::Macro(MacroKind::Bang), _) = binding.res() else {
return None;
};
let module_name = crate_module.kind.name().unwrap_or(kw::Empty);
let module_name = crate_module.kind.name().unwrap_or(kw::Crate);
let import_snippet = match import.kind {
ImportKind::Single { source, target, .. } if source != target => {
format!("{source} as {target}")
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::spec::{FramePointer, LinkerFlavor, Lld, Target, TargetMetadata, base};
use crate::spec::{FramePointer, Target, TargetMetadata, base};

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

// MSVC emits a warning about code that may trip "Cortex-A53 MPCore processor bug #843419" (see
// https://developer.arm.com/documentation/epm048406/latest) which is sometimes emitted by LLVM.
// Since Arm64 Windows 10+ isn't supported on that processor, it's safe to disable the warning.
base.add_pre_link_args(LinkerFlavor::Msvc(Lld::No), &["/arm64hazardfree"]);

Target {
llvm_target: "aarch64-pc-windows-msvc".into(),
metadata: TargetMetadata {
1 change: 0 additions & 1 deletion library/core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -111,7 +111,6 @@
#![feature(is_ascii_octdigit)]
#![feature(lazy_get)]
#![feature(link_cfg)]
#![feature(non_null_from_ref)]
#![feature(offset_of_enum)]
#![feature(panic_internals)]
#![feature(ptr_alignment_type)]
6 changes: 4 additions & 2 deletions library/core/src/ptr/non_null.rs
Original file line number Diff line number Diff line change
@@ -262,15 +262,17 @@ impl<T: ?Sized> NonNull<T> {
}

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

/// Converts a mutable reference to a `NonNull` pointer.
#[unstable(feature = "non_null_from_ref", issue = "130823")]
#[stable(feature = "non_null_from_ref", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "non_null_from_ref", since = "CURRENT_RUSTC_VERSION")]
#[inline]
pub const fn from_mut(r: &mut T) -> Self {
// SAFETY: A mutable reference cannot be null.
332 changes: 189 additions & 143 deletions library/coretests/tests/num/mod.rs

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion library/std/src/lib.rs
Original file line number Diff line number Diff line change
@@ -305,7 +305,6 @@
#![feature(iter_advance_by)]
#![feature(iter_next_chunk)]
#![feature(lang_items)]
#![feature(let_chains)]
#![feature(link_cfg)]
#![feature(linkage)]
#![feature(macro_metavar_expr_concat)]
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Rust for Linux notification group

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

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

This list will be used to notify [Rust for Linux (RfL)][rfl] maintainers
when the compiler or the standard library changes in a way that would
2 changes: 2 additions & 0 deletions src/doc/rustc/book.toml
Original file line number Diff line number Diff line change
@@ -6,6 +6,8 @@ title = "The rustc book"
[output.html]
git-repository-url = "https://github.com/rust-lang/rust/tree/master/src/doc/rustc"
edit-url-template = "https://github.com/rust-lang/rust/edit/master/src/doc/rustc/{path}"
additional-css = ["theme/pagetoc.css"]
additional-js = ["theme/pagetoc.js"]

[output.html.search]
use-boolean-and = true
84 changes: 84 additions & 0 deletions src/doc/rustc/theme/pagetoc.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/* Inspired by https://github.com/JorelAli/mdBook-pagetoc/tree/98ee241 (under WTFPL) */

:root {
--toc-width: 270px;
--center-content-toc-shift: calc(-1 * var(--toc-width) / 2);
}

.nav-chapters {
/* adjust width of buttons that bring to the previous or the next page */
min-width: 50px;
}

@media only screen {
@media (max-width: 1179px) {
.sidebar-hidden #sidetoc {
display: none;
}
}

@media (max-width: 1439px) {
.sidebar-visible #sidetoc {
display: none;
}
}

@media (1180px <= width <= 1439px) {
.sidebar-hidden main {
position: relative;
left: var(--center-content-toc-shift);
}
}

@media (1440px <= width <= 1700px) {
.sidebar-visible main {
position: relative;
left: var(--center-content-toc-shift);
}
}

#sidetoc {
margin-left: calc(100% + 20px);
}
#pagetoc {
position: fixed;
/* adjust TOC width */
width: var(--toc-width);
height: calc(100vh - var(--menu-bar-height) - 0.67em * 4);
overflow: auto;
}
#pagetoc a {
border-left: 1px solid var(--sidebar-bg);
color: var(--sidebar-fg) !important;
display: block;
padding-bottom: 5px;
padding-top: 5px;
padding-left: 10px;
text-align: left;
text-decoration: none;
}
#pagetoc a:hover,
#pagetoc a.active {
background: var(--sidebar-bg);
color: var(--sidebar-active) !important;
}
#pagetoc .active {
background: var(--sidebar-bg);
color: var(--sidebar-active);
}
#pagetoc .pagetoc-H2 {
padding-left: 20px;
}
#pagetoc .pagetoc-H3 {
padding-left: 40px;
}
#pagetoc .pagetoc-H4 {
padding-left: 60px;
}
}

@media print {
#sidetoc {
display: none;
}
}
104 changes: 104 additions & 0 deletions src/doc/rustc/theme/pagetoc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
// Inspired by https://github.com/JorelAli/mdBook-pagetoc/tree/98ee241 (under WTFPL)

let activeHref = location.href;
function updatePageToc(elem = undefined) {
let selectedPageTocElem = elem;
const pagetoc = document.getElementById("pagetoc");

function getRect(element) {
return element.getBoundingClientRect();
}

function overflowTop(container, element) {
return getRect(container).top - getRect(element).top;
}

function overflowBottom(container, element) {
return getRect(container).bottom - getRect(element).bottom;
}

// We've not selected a heading to highlight, and the URL needs updating
// so we need to find a heading based on the URL
if (selectedPageTocElem === undefined && location.href !== activeHref) {
activeHref = location.href;
for (const pageTocElement of pagetoc.children) {
if (pageTocElement.href === activeHref) {
selectedPageTocElem = pageTocElement;
}
}
}

// We still don't have a selected heading, let's try and find the most
// suitable heading based on the scroll position
if (selectedPageTocElem === undefined) {
const margin = window.innerHeight / 3;

const headers = document.getElementsByClassName("header");
for (let i = 0; i < headers.length; i++) {
const header = headers[i];
if (selectedPageTocElem === undefined && getRect(header).top >= 0) {
if (getRect(header).top < margin) {
selectedPageTocElem = header;
} else {
selectedPageTocElem = headers[Math.max(0, i - 1)];
}
}
// a very long last section's heading is over the screen
if (selectedPageTocElem === undefined && i === headers.length - 1) {
selectedPageTocElem = header;
}
}
}

// Remove the active flag from all pagetoc elements
for (const pageTocElement of pagetoc.children) {
pageTocElement.classList.remove("active");
}

// If we have a selected heading, set it to active and scroll to it
if (selectedPageTocElem !== undefined) {
for (const pageTocElement of pagetoc.children) {
if (selectedPageTocElem.href.localeCompare(pageTocElement.href) === 0) {
pageTocElement.classList.add("active");
if (overflowTop(pagetoc, pageTocElement) > 0) {
pagetoc.scrollTop = pageTocElement.offsetTop;
}
if (overflowBottom(pagetoc, pageTocElement) < 0) {
pagetoc.scrollTop -= overflowBottom(pagetoc, pageTocElement);
}
}
}
}
}

if (document.getElementById("sidetoc") === null &&
document.getElementsByClassName("header").length > 0) {
// The sidetoc element doesn't exist yet, let's create it

// Create the empty sidetoc and pagetoc elements
const sidetoc = document.createElement("div");
const pagetoc = document.createElement("div");
sidetoc.id = "sidetoc";
pagetoc.id = "pagetoc";
sidetoc.appendChild(pagetoc);

// And append them to the current DOM
const main = document.querySelector('main');
main.insertBefore(sidetoc, main.firstChild);

// Populate sidebar on load
window.addEventListener("load", () => {
for (const header of document.getElementsByClassName("header")) {
const link = document.createElement("a");
link.innerHTML = header.innerHTML;
link.href = header.hash;
link.classList.add("pagetoc-" + header.parentElement.tagName);
document.getElementById("pagetoc").appendChild(link);
link.onclick = () => updatePageToc(link);
}
updatePageToc();
});

// Update page table of contents selected heading on scroll
window.addEventListener("scroll", () => updatePageToc());
}
1 change: 0 additions & 1 deletion src/librustdoc/lib.rs
Original file line number Diff line number Diff line change
@@ -11,7 +11,6 @@
#![feature(if_let_guard)]
#![feature(impl_trait_in_assoc_type)]
#![feature(iter_intersperse)]
#![feature(let_chains)]
#![feature(never_type)]
#![feature(round_char_boundary)]
#![feature(test)]
2 changes: 1 addition & 1 deletion tests/run-make/core-no-oom-handling/rmake.rs
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ use run_make_support::{rustc, source_root};

fn main() {
rustc()
.edition("2021")
.edition("2024")
.arg("-Dwarnings")
.crate_type("rlib")
.input(source_root().join("library/core/src/lib.rs"))
Original file line number Diff line number Diff line change
@@ -11,6 +11,13 @@
//@ needs-dynamic-linking
//@ only-nightly (requires unstable rustc flag)

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

#![deny(warnings)]

use run_make_support::{dynamic_lib_name, rfs, rust_lib_name, rustc};
2 changes: 1 addition & 1 deletion tests/ui/imports/issue-99695-b.fixed
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ mod m {
pub struct other_item;
}

use ::nu;
use crate::nu;
pub use self::p::{other_item as _};
//~^ ERROR unresolved import `self::p::nu` [E0432]
//~| HELP a macro with this name exists at the root of the crate
2 changes: 1 addition & 1 deletion tests/ui/imports/issue-99695-b.stderr
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ LL | pub use self::p::{nu, other_item as _};
= 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
help: a macro with this name exists at the root of the crate
|
LL ~ use ::nu;
LL ~ use crate::nu;
LL ~ pub use self::p::{other_item as _};
|

Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
//@ run-rustfix
//@ revisions: edition_2015 edition_2018
//@ [edition_2015] edition: 2015
//@ [edition_2018] edition: 2018

#![allow(unused, nonstandard_style)]
mod m {
#[macro_export]
@@ -8,7 +12,7 @@ mod m {

pub struct other_item;

use ::nu;
use crate::nu;
pub use self::{other_item as _};
//~^ ERROR unresolved import `self::nu` [E0432]
//~| HELP a macro with this name exists at the root of the crate
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
error[E0432]: unresolved import `self::nu`
--> $DIR/issue-99695.rs:11:20
--> $DIR/issue-99695.rs:15:20
|
LL | pub use self::{nu, other_item as _};
| ^^ no `nu` in `m`
|
= 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
help: a macro with this name exists at the root of the crate
|
LL ~ use ::nu;
LL ~ use crate::nu;
LL ~ pub use self::{other_item as _};
|

21 changes: 21 additions & 0 deletions tests/ui/imports/issue-99695.edition_2018.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//@ run-rustfix
//@ revisions: edition_2015 edition_2018
//@ [edition_2015] edition: 2015
//@ [edition_2018] edition: 2018

#![allow(unused, nonstandard_style)]
mod m {
#[macro_export]
macro_rules! nu {
{} => {};
}

pub struct other_item;

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

fn main() {}
16 changes: 16 additions & 0 deletions tests/ui/imports/issue-99695.edition_2018.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
error[E0432]: unresolved import `self::nu`
--> $DIR/issue-99695.rs:15:20
|
LL | pub use self::{nu, other_item as _};
| ^^ no `nu` in `m`
|
= 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
help: a macro with this name exists at the root of the crate
|
LL ~ use crate::nu;
LL ~ pub use self::{other_item as _};
|

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0432`.
4 changes: 4 additions & 0 deletions tests/ui/imports/issue-99695.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
//@ run-rustfix
//@ revisions: edition_2015 edition_2018
//@ [edition_2015] edition: 2015
//@ [edition_2018] edition: 2018

#![allow(unused, nonstandard_style)]
mod m {
#[macro_export]
5 changes: 4 additions & 1 deletion triagebot.toml
Original file line number Diff line number Diff line change
@@ -133,7 +133,7 @@ In case it's useful, here are some [instructions] for tackling these sorts of is
[instructions]: https://rustc-dev-guide.rust-lang.org/notification-groups/rust-for-linux.html
"""
label = "O-rfl"
label = "A-rust-for-linux"

[ping.wasm]
alias = ["webassembly"]
@@ -1424,3 +1424,6 @@ compiletest = [
# Enable `@rustbot note` functionality
# Documentation at: https://forge.rust-lang.org/triagebot/note.html
[note]

[behind-upstream]
days-threshold = 14