Skip to content

Rollup of 9 pull requests #145636

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

Closed
wants to merge 71 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
1ddb4d0
Fix parameter order for `_by()` variants of `min` / `max`/ `minmax` i…
miried Apr 4, 2025
d78e762
scrape-examples.js: give each function a signature
lolbinarycat Apr 25, 2025
b4c77e1
rustdoc js: add ScrapedLoc type
lolbinarycat Apr 25, 2025
35ba7dd
rustdoc js: add rustdoc.ScrapedLoc type
lolbinarycat Apr 25, 2025
8799d3d
fix typo
lolbinarycat Apr 28, 2025
b06113d
scrape-examples.js: add another nonnull() invokation
lolbinarycat May 22, 2025
c021e7a
scrape-examples.js: fix typos
lolbinarycat May 27, 2025
0ed3ef4
Use GH app for authenticating pull PRs
Kobzol Jul 29, 2025
1fd183e
Apply suggestions from code review
Kobzol Jul 29, 2025
6508b5a
Merge pull request #4505 from Kobzol/ci-gh-app
RalfJung Jul 29, 2025
64ed2b5
rustup
RalfJung Jul 31, 2025
76a213b
rely on preinstalled rustup on windows-arm
RalfJung Jul 31, 2025
4768724
Merge pull request #4509 from RalfJung/win-ci
RalfJung Jul 31, 2025
431fc2a
bless cargo miri doctest execution
RalfJung Jul 31, 2025
63cbeff
Merge pull request #4508 from RalfJung/rustup
RalfJung Jul 31, 2025
67cce09
Prepare for merging from rust-lang/rust
Aug 1, 2025
aa73f45
Merge ref 'adcb3d3b4cd3' from rust-lang/rust
Aug 1, 2025
620141d
fmt
Aug 1, 2025
be358c6
Merge pull request #4510 from rust-lang/rustup-2025-08-01
RalfJung Aug 1, 2025
6ab38e4
update rustup PR message
RalfJung Aug 1, 2025
8bd9bb9
Merge pull request #4511 from RalfJung/auto-rustup
RalfJung Aug 1, 2025
ff400ea
Prepare for merging from rust-lang/rust
Aug 4, 2025
4c07ca6
Merge ref '07b7dc90ee4d' from rust-lang/rust
Aug 4, 2025
fed28f8
Merge pull request #4513 from rust-lang/rustup-2025-08-04
saethlin Aug 4, 2025
55a8c2d
Prepare for merging from rust-lang/rust
Aug 9, 2025
fd45eef
Merge ref '4c7749e8c8e5' from rust-lang/rust
Aug 9, 2025
b4e279e
Remove cfg(bootstrap) for strict_overflow_ops
saethlin Aug 9, 2025
547e2b7
Fix a clippy::needless_borrow
saethlin Aug 9, 2025
5a79c57
Add gettid support for Android
saethlin Aug 10, 2025
210bd5f
Merge pull request #4518 from rust-lang/rustup-2025-08-09
saethlin Aug 10, 2025
117a095
Add tracing to data race functions
Stypox Aug 11, 2025
0b78f63
Prepare for merging from rust-lang/rust
Aug 13, 2025
24eaf5d
Merge ref '1553adfe6884' from rust-lang/rust
Aug 13, 2025
542bd3e
Merge pull request #4525 from rust-lang/rustup-2025-08-13
saethlin Aug 13, 2025
3ff426b
Prepare for merging from rust-lang/rust
Aug 15, 2025
c549eb3
Merge ref '3507a749b365' from rust-lang/rust
Aug 15, 2025
216b606
Merge pull request #4527 from rust-lang/rustup-2025-08-15
oli-obk Aug 15, 2025
36a3820
Use aarch64-apple-darwin as the fallback doc source for `-apple-`
shepmaster Aug 11, 2025
c574c91
Demote x86_64-apple-darwin to Tier 2 with host tools
shepmaster Aug 11, 2025
122517d
Prepare for merging from rust-lang/rust
Aug 18, 2025
9cac742
Merge ref '425a9c0a0e36' from rust-lang/rust
Aug 18, 2025
244eea5
fmt
Aug 18, 2025
4f1de56
Merge pull request #4528 from rust-lang/rustup-2025-08-18
RalfJung Aug 18, 2025
dc81d75
Add new `--test-codegen-backend` bootstrap option
GuillaumeGomez Aug 11, 2025
73d3d28
Implement feature `int_lowest_highest_one` for integer and NonZero types
Gnurou Aug 10, 2025
3bb9172
Merge pull request #4523 from Stypox/data-race-tracing
RalfJung Aug 18, 2025
1c42add
triagebot: Show range-diff links on force pushes
RalfJung Aug 18, 2025
ebb5f98
Merge pull request #4529 from RalfJung/triagebot-range-diff-awesomeness
RalfJung Aug 18, 2025
2d3ee01
Split compiletest `--codegen-backend` into two options `--default-cod…
GuillaumeGomez Aug 18, 2025
41d8d85
Remove hs_abs_cmp examples
miried Aug 19, 2025
36d309e
Merge remote-tracking branch 'upstream/master'
miried Aug 19, 2025
ce2d0d1
link to TB doc in unsafe-code-guidelines
JoJoDeveloping Aug 19, 2025
a7bf08f
God bless the tests
JoJoDeveloping Aug 19, 2025
77d6ee0
Fix bug where `rustdoc-js` tester would not pick the right `search.js…
GuillaumeGomez Aug 13, 2025
2ebe679
Strenghten rustdoc js tester file macthing regex
GuillaumeGomez Aug 16, 2025
ed1ff8d
Merge pull request #4530 from JoJoDeveloping/tb-doc-ugc-link
RalfJung Aug 19, 2025
309b87f
Support weak definitions
bjorn3 Jun 26, 2025
f9d08d9
Merge pull request #4414 from bjorn3/weak_defs
RalfJung Aug 19, 2025
a971238
`std_detect`: Use `rustc-std-workspace-*` to pull in `compiler-builtins`
joshtriplett Aug 19, 2025
4c948bc
Update lockfile for changes to `std_detect`
joshtriplett Aug 19, 2025
9a29e16
mention lint group in default level lint note
karolzwolak Apr 28, 2025
d14b83e
bless tests with new lint messages
karolzwolak Apr 28, 2025
3e4856c
Rollup merge of #139357 - miried:master, r=Amanieu
jhpratt Aug 19, 2025
86948fb
Rollup merge of #140314 - lolbinarycat:rustdoc-js-scrape-examples-typ…
jhpratt Aug 19, 2025
f3fbf39
Rollup merge of #140794 - karolzwolak:allow-unused-doc-65464, r=david…
jhpratt Aug 19, 2025
c64ae06
Rollup merge of #145252 - shepmaster:demote-x86_64-apple-darwin-to-ti…
jhpratt Aug 19, 2025
fd889a7
Rollup merge of #145256 - GuillaumeGomez:bootstrap-test-codegen-backe…
jhpratt Aug 19, 2025
2cfae3f
Rollup merge of #145359 - GuillaumeGomez:correctly-pick-search.js, r=…
jhpratt Aug 19, 2025
2370fa6
Rollup merge of #145381 - Gnurou:int_lowest_highest_one, r=jhpratt
jhpratt Aug 19, 2025
8a7c125
Rollup merge of #145619 - joshtriplett:use-the-right-core, r=tgross35
jhpratt Aug 19, 2025
46a6e7b
Rollup merge of #145632 - RalfJung:miri, r=RalfJung
jhpratt Aug 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 8 additions & 2 deletions compiler/rustc_lint/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use rustc_middle::ty::layout::{LayoutError, LayoutOfHelpers, TyAndLayout};
use rustc_middle::ty::print::{PrintError, PrintTraitRefExt as _, Printer, with_no_trimmed_paths};
use rustc_middle::ty::{self, GenericArg, RegisteredTools, Ty, TyCtxt, TypingEnv, TypingMode};
use rustc_session::lint::{FutureIncompatibleInfo, Lint, LintBuffer, LintExpectationId, LintId};
use rustc_session::{LintStoreMarker, Session};
use rustc_session::{DynLintStore, Session};
use rustc_span::edit_distance::find_best_match_for_names;
use rustc_span::{Ident, Span, Symbol, sym};
use tracing::debug;
Expand Down Expand Up @@ -62,7 +62,13 @@ pub struct LintStore {
lint_groups: FxIndexMap<&'static str, LintGroup>,
}

impl LintStoreMarker for LintStore {}
impl DynLintStore for LintStore {
fn lint_groups_iter(&self) -> Box<dyn Iterator<Item = rustc_session::LintGroup> + '_> {
Box::new(self.get_lint_groups().map(|(name, lints, is_externally_loaded)| {
rustc_session::LintGroup { name, lints, is_externally_loaded }
}))
}
}

/// The target of the `by_name` map, which accounts for renaming/deprecation.
#[derive(Debug)]
Expand Down
29 changes: 27 additions & 2 deletions compiler/rustc_middle/src/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,28 @@ impl LintExpectation {
}

fn explain_lint_level_source(
sess: &Session,
lint: &'static Lint,
level: Level,
src: LintLevelSource,
err: &mut Diag<'_, ()>,
) {
// Find the name of the lint group that contains the given lint.
// Assumes the lint only belongs to one group.
let lint_group_name = |lint| {
let lint_groups_iter = sess.lint_groups_iter();
let lint_id = LintId::of(lint);
lint_groups_iter
.filter(|lint_group| !lint_group.is_externally_loaded)
.find(|lint_group| {
lint_group
.lints
.iter()
.find(|lint_group_lint| **lint_group_lint == lint_id)
.is_some()
})
.map(|lint_group| lint_group.name)
};
let name = lint.name_lower();
if let Level::Allow = level {
// Do not point at `#[allow(compat_lint)]` as the reason for a compatibility lint
Expand All @@ -224,7 +241,15 @@ fn explain_lint_level_source(
}
match src {
LintLevelSource::Default => {
err.note_once(format!("`#[{}({})]` on by default", level.as_str(), name));
let level_str = level.as_str();
match lint_group_name(lint) {
Some(group_name) => {
err.note_once(format!("`#[{level_str}({name})]` (part of `#[{level_str}({group_name})]`) on by default"));
}
None => {
err.note_once(format!("`#[{level_str}({name})]` on by default"));
}
}
}
LintLevelSource::CommandLine(lint_flag_val, orig_level) => {
let flag = orig_level.to_cmd_flag();
Expand Down Expand Up @@ -427,7 +452,7 @@ pub fn lint_level(
decorate(&mut err);
}

explain_lint_level_source(lint, level, src, &mut err);
explain_lint_level_source(sess, lint, level, src, &mut err);
err.emit()
}
lint_level_impl(sess, lint, level, span, Box::new(decorate))
Expand Down
21 changes: 19 additions & 2 deletions compiler/rustc_session/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ use crate::config::{
SwitchWithOptPath,
};
use crate::filesearch::FileSearch;
use crate::lint::LintId;
use crate::parse::{ParseSess, add_feature_diagnostics};
use crate::search_paths::SearchPath;
use crate::{errors, filesearch, lint};
Expand Down Expand Up @@ -139,7 +140,10 @@ pub struct CompilerIO {
pub temps_dir: Option<PathBuf>,
}

pub trait LintStoreMarker: Any + DynSync + DynSend {}
pub trait DynLintStore: Any + DynSync + DynSend {
/// Provides a way to access lint groups without depending on `rustc_lint`
fn lint_groups_iter(&self) -> Box<dyn Iterator<Item = LintGroup> + '_>;
}

/// Represents the data associated with a compilation
/// session for a single crate.
Expand All @@ -164,7 +168,7 @@ pub struct Session {
pub code_stats: CodeStats,

/// This only ever stores a `LintStore` but we don't want a dependency on that type here.
pub lint_store: Option<Arc<dyn LintStoreMarker>>,
pub lint_store: Option<Arc<dyn DynLintStore>>,

/// Cap lint level specified by a driver specifically.
pub driver_lint_caps: FxHashMap<lint::LintId, lint::Level>,
Expand Down Expand Up @@ -240,6 +244,12 @@ impl CodegenUnits {
}
}

pub struct LintGroup {
pub name: &'static str,
pub lints: Vec<LintId>,
pub is_externally_loaded: bool,
}

impl Session {
pub fn miri_unleashed_feature(&self, span: Span, feature_gate: Option<Symbol>) {
self.miri_unleashed_features.lock().push((span, feature_gate));
Expand Down Expand Up @@ -596,6 +606,13 @@ impl Session {
(&*self.target.staticlib_prefix, &*self.target.staticlib_suffix)
}
}

pub fn lint_groups_iter(&self) -> Box<dyn Iterator<Item = LintGroup> + '_> {
match self.lint_store {
Some(ref lint_store) => lint_store.lint_groups_iter(),
None => Box::new(std::iter::empty()),
}
}
}

// JUSTIFICATION: defn of the suggested wrapper fns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub(crate) fn target() -> Target {
llvm_target,
metadata: TargetMetadata {
description: Some("x86_64 Apple macOS (10.12+, Sierra+)".into()),
tier: Some(1),
tier: Some(2),
host_tools: Some(true),
std: Some(true),
},
Expand Down
4 changes: 2 additions & 2 deletions library/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,9 @@ dependencies = [
name = "std_detect"
version = "0.1.5"
dependencies = [
"alloc",
"core",
"libc",
"rustc-std-workspace-alloc",
"rustc-std-workspace-core",
]

[[package]]
Expand Down
15 changes: 12 additions & 3 deletions library/core/src/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1554,6 +1554,9 @@ pub fn min<T: Ord>(v1: T, v2: T) -> T {
///
/// Returns the first argument if the comparison determines them to be equal.
///
/// The parameter order is preserved when calling the `compare` function, i.e. `v1` is
/// always passed as the first argument and `v2` as the second.
///
/// # Examples
///
/// ```
Expand All @@ -1574,7 +1577,7 @@ pub fn min<T: Ord>(v1: T, v2: T) -> T {
#[must_use]
#[stable(feature = "cmp_min_max_by", since = "1.53.0")]
pub fn min_by<T, F: FnOnce(&T, &T) -> Ordering>(v1: T, v2: T, compare: F) -> T {
if compare(&v2, &v1).is_lt() { v2 } else { v1 }
if compare(&v1, &v2).is_le() { v1 } else { v2 }
}

/// Returns the element that gives the minimum value from the specified function.
Expand Down Expand Up @@ -1646,6 +1649,9 @@ pub fn max<T: Ord>(v1: T, v2: T) -> T {
///
/// Returns the second argument if the comparison determines them to be equal.
///
/// The parameter order is preserved when calling the `compare` function, i.e. `v1` is
/// always passed as the first argument and `v2` as the second.
///
/// # Examples
///
/// ```
Expand All @@ -1666,7 +1672,7 @@ pub fn max<T: Ord>(v1: T, v2: T) -> T {
#[must_use]
#[stable(feature = "cmp_min_max_by", since = "1.53.0")]
pub fn max_by<T, F: FnOnce(&T, &T) -> Ordering>(v1: T, v2: T, compare: F) -> T {
if compare(&v2, &v1).is_lt() { v1 } else { v2 }
if compare(&v1, &v2).is_gt() { v1 } else { v2 }
}

/// Returns the element that gives the maximum value from the specified function.
Expand Down Expand Up @@ -1745,6 +1751,9 @@ where
///
/// Returns `[v1, v2]` if the comparison determines them to be equal.
///
/// The parameter order is preserved when calling the `compare` function, i.e. `v1` is
/// always passed as the first argument and `v2` as the second.
///
/// # Examples
///
/// ```
Expand All @@ -1769,7 +1778,7 @@ pub fn minmax_by<T, F>(v1: T, v2: T, compare: F) -> [T; 2]
where
F: FnOnce(&T, &T) -> Ordering,
{
if compare(&v2, &v1).is_lt() { [v2, v1] } else { [v1, v2] }
if compare(&v1, &v2).is_le() { [v1, v2] } else { [v2, v1] }
}

/// Returns minimum and maximum values with respect to the specified key function.
Expand Down
42 changes: 42 additions & 0 deletions library/core/src/num/int_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,48 @@ macro_rules! int_impl {
self & self.wrapping_neg()
}

/// Returns the index of the highest bit set to one in `self`, or `None`
/// if `self` is `0`.
///
/// # Examples
///
/// ```
/// #![feature(int_lowest_highest_one)]
///
#[doc = concat!("assert_eq!(0x0_", stringify!($SelfT), ".highest_one(), None);")]
#[doc = concat!("assert_eq!(0x1_", stringify!($SelfT), ".highest_one(), Some(0));")]
#[doc = concat!("assert_eq!(0x10_", stringify!($SelfT), ".highest_one(), Some(4));")]
#[doc = concat!("assert_eq!(0x1f_", stringify!($SelfT), ".highest_one(), Some(4));")]
/// ```
#[unstable(feature = "int_lowest_highest_one", issue = "145203")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline(always)]
pub const fn highest_one(self) -> Option<u32> {
(self as $UnsignedT).highest_one()
}

/// Returns the index of the lowest bit set to one in `self`, or `None`
/// if `self` is `0`.
///
/// # Examples
///
/// ```
/// #![feature(int_lowest_highest_one)]
///
#[doc = concat!("assert_eq!(0x0_", stringify!($SelfT), ".lowest_one(), None);")]
#[doc = concat!("assert_eq!(0x1_", stringify!($SelfT), ".lowest_one(), Some(0));")]
#[doc = concat!("assert_eq!(0x10_", stringify!($SelfT), ".lowest_one(), Some(4));")]
#[doc = concat!("assert_eq!(0x1f_", stringify!($SelfT), ".lowest_one(), Some(0));")]
/// ```
#[unstable(feature = "int_lowest_highest_one", issue = "145203")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline(always)]
pub const fn lowest_one(self) -> Option<u32> {
(self as $UnsignedT).lowest_one()
}

/// Returns the bit pattern of `self` reinterpreted as an unsigned integer of the same size.
///
/// This produces the same result as an `as` cast, but ensures that the bit-width remains
Expand Down
48 changes: 48 additions & 0 deletions library/core/src/num/nonzero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,54 @@ macro_rules! nonzero_integer {
unsafe { NonZero::new_unchecked(n) }
}

/// Returns the index of the highest bit set to one in `self`.
///
/// # Examples
///
/// ```
/// #![feature(int_lowest_highest_one)]
///
/// # use core::num::NonZero;
/// # fn main() { test().unwrap(); }
/// # fn test() -> Option<()> {
#[doc = concat!("assert_eq!(NonZero::<", stringify!($Int), ">::new(0x1)?.highest_one(), 0);")]
#[doc = concat!("assert_eq!(NonZero::<", stringify!($Int), ">::new(0x10)?.highest_one(), 4);")]
#[doc = concat!("assert_eq!(NonZero::<", stringify!($Int), ">::new(0x1f)?.highest_one(), 4);")]
/// # Some(())
/// # }
/// ```
#[unstable(feature = "int_lowest_highest_one", issue = "145203")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline(always)]
pub const fn highest_one(self) -> u32 {
Self::BITS - 1 - self.leading_zeros()
}

/// Returns the index of the lowest bit set to one in `self`.
///
/// # Examples
///
/// ```
/// #![feature(int_lowest_highest_one)]
///
/// # use core::num::NonZero;
/// # fn main() { test().unwrap(); }
/// # fn test() -> Option<()> {
#[doc = concat!("assert_eq!(NonZero::<", stringify!($Int), ">::new(0x1)?.lowest_one(), 0);")]
#[doc = concat!("assert_eq!(NonZero::<", stringify!($Int), ">::new(0x10)?.lowest_one(), 4);")]
#[doc = concat!("assert_eq!(NonZero::<", stringify!($Int), ">::new(0x1f)?.lowest_one(), 0);")]
/// # Some(())
/// # }
/// ```
#[unstable(feature = "int_lowest_highest_one", issue = "145203")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline(always)]
pub const fn lowest_one(self) -> u32 {
self.trailing_zeros()
}

/// Returns the number of ones in the binary representation of `self`.
///
/// # Examples
Expand Down
48 changes: 48 additions & 0 deletions library/core/src/num/uint_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,54 @@ macro_rules! uint_impl {
self & self.wrapping_neg()
}

/// Returns the index of the highest bit set to one in `self`, or `None`
/// if `self` is `0`.
///
/// # Examples
///
/// ```
/// #![feature(int_lowest_highest_one)]
///
#[doc = concat!("assert_eq!(0x0_", stringify!($SelfT), ".highest_one(), None);")]
#[doc = concat!("assert_eq!(0x1_", stringify!($SelfT), ".highest_one(), Some(0));")]
#[doc = concat!("assert_eq!(0x10_", stringify!($SelfT), ".highest_one(), Some(4));")]
#[doc = concat!("assert_eq!(0x1f_", stringify!($SelfT), ".highest_one(), Some(4));")]
/// ```
#[unstable(feature = "int_lowest_highest_one", issue = "145203")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline(always)]
pub const fn highest_one(self) -> Option<u32> {
match NonZero::new(self) {
Some(v) => Some(v.highest_one()),
None => None,
}
}

/// Returns the index of the lowest bit set to one in `self`, or `None`
/// if `self` is `0`.
///
/// # Examples
///
/// ```
/// #![feature(int_lowest_highest_one)]
///
#[doc = concat!("assert_eq!(0x0_", stringify!($SelfT), ".lowest_one(), None);")]
#[doc = concat!("assert_eq!(0x1_", stringify!($SelfT), ".lowest_one(), Some(0));")]
#[doc = concat!("assert_eq!(0x10_", stringify!($SelfT), ".lowest_one(), Some(4));")]
#[doc = concat!("assert_eq!(0x1f_", stringify!($SelfT), ".lowest_one(), Some(0));")]
/// ```
#[unstable(feature = "int_lowest_highest_one", issue = "145203")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline(always)]
pub const fn lowest_one(self) -> Option<u32> {
match NonZero::new(self) {
Some(v) => Some(v.lowest_one()),
None => None,
}
}

/// Returns the bit pattern of `self` reinterpreted as a signed integer of the same size.
///
/// This produces the same result as an `as` cast, but ensures that the bit-width remains
Expand Down
1 change: 1 addition & 0 deletions library/coretests/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
#![feature(generic_assert_internals)]
#![feature(hasher_prefixfree_extras)]
#![feature(hashmap_internals)]
#![feature(int_lowest_highest_one)]
#![feature(int_roundings)]
#![feature(ip)]
#![feature(is_ascii_octdigit)]
Expand Down
Loading
Loading