Skip to content

Rollup of 9 pull requests #145074

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

Merged
merged 43 commits into from
Aug 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
ed50029
ci: Switch to nightly rustfmt
tgross35 Jul 21, 2025
08bca4d
ci: Add native PowerPC64LE and s390x jobs
tgross35 Jul 23, 2025
fcc7824
ci: Update to the latest ubuntu:25.04 Docker images
tgross35 Jul 24, 2025
95c4263
symcheck: Switch the `object` dependency from git to crates.io
tgross35 Jul 24, 2025
83aea65
ci: Use a mirror for musl
tgross35 Jul 24, 2025
5c4abe9
ci: Upgrade ubuntu:25.04 for the PowerPC64LE test
tgross35 Jul 24, 2025
43c3e1b
Enable tests that were skipped on PowerPC
tgross35 Jul 24, 2025
b168793
Enable tests that were skipped on aarch64
tgross35 Jul 24, 2025
0b6c1d3
Enable skipped `f32` and `f64` multiplication tests
tgross35 Jul 24, 2025
9dad77f
Use `x86_no_sse` configuration in more places
tgross35 Jul 24, 2025
4743158
libm: Update for new warn-by-default clippy lints
tgross35 Jul 26, 2025
c061e73
Avoid inlining `floor` into `rem_pio2`
quaternic Jul 27, 2025
9c683d3
Implement `floor` and `ceil` in assembly on `i586`
folkertdev Jul 27, 2025
16cb37c
Remove `no-asm` gating when there is no alternative implementation
tgross35 Jul 25, 2025
54f6ab7
Switch to using a GH app for authenticating sync PRs
Kobzol Jul 29, 2025
54a4f86
cleanup: Trim trailing whitespace
tgross35 Jul 29, 2025
97c35d3
ci: Simplify tests for verbatim paths
tgross35 Jul 29, 2025
ab8a2e1
ci: Switch to strongly typed directives
tgross35 Jul 30, 2025
eafafc4
ci: Don't print output twice in `ci-util`
tgross35 Jul 30, 2025
c045c9b
ci: Commonize the way `PrInfo` is loaded from env
tgross35 Jul 30, 2025
4ebfdf7
ci: Add a way to run `libm` tests that would otherwise be skipped
tgross35 Jul 30, 2025
3cbd088
ci: Set pipefail before running ci-util
tgross35 Jul 30, 2025
ecf6d3c
Simplify the configuration for no-panic
tgross35 Jul 30, 2025
d2cfe48
remove feature gate
Kivooeo Aug 4, 2025
b7f5392
remove begin prefix
Kivooeo Aug 4, 2025
3b50253
compiler-builtins: plumb LSE support for aarch64 on linux
pmur Aug 4, 2025
6936bb9
Dynamically enable LSE for aarch64 rust provided intrinsics
pmur Jul 31, 2025
fbc700f
configure: Use `CARGO_CFG_*_{F16,F128}` rather than invoking rustc
tgross35 Aug 5, 2025
b1f49d8
Fix build/doc/test of error index generator
Kobzol Aug 6, 2025
56d5aab
make rustc_public types derive `Hash`
AlexanderPortland Aug 6, 2025
c65102e
doc(library): Fix Markdown in `Iterator::by_ref`.
Hywan Aug 7, 2025
4888762
Fix doc comment of File::try_lock and File::try_lock_shared
ulrichstark Aug 7, 2025
4f7a6ac
Port `#[allow_internal_unsafe]` to the new attribute system
scrabsha Aug 3, 2025
b9e6bd7
derive hash for placeholder automatically
AlexanderPortland Aug 7, 2025
a8f3686
Rollup merge of #144705 - pmur:murp/aarch64-lse, r=Amanieu
tgross35 Aug 8, 2025
8f51976
Rollup merge of #144857 - scrabsha:push-pwtyrnmqkrtr, r=jdonszelmann
tgross35 Aug 8, 2025
1d71dc4
Rollup merge of #144900 - Kivooeo:unsigned_signed_diff-stabilize, r=d…
tgross35 Aug 8, 2025
2e0e183
Rollup merge of #144903 - Kivooeo:panic_handler-is-not-begin, r=m-ou-se
tgross35 Aug 8, 2025
0a1e0c6
Rollup merge of #144974 - tgross35:update-builtins, r=tgross35
tgross35 Aug 8, 2025
1029eea
Rollup merge of #145007 - Kobzol:error-index, r=jieyouxu
tgross35 Aug 8, 2025
41b6da1
Rollup merge of #145018 - AlexanderPortland:rustc-public-hash, r=scot…
tgross35 Aug 8, 2025
3c18b6c
Rollup merge of #145045 - Hywan:doc-library-iterator-by_ref, r=Guilla…
tgross35 Aug 8, 2025
338a3e0
Rollup merge of #145046 - ulrichstark:master, r=tgross35
tgross35 Aug 8, 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
8 changes: 8 additions & 0 deletions compiler/rustc_attr_parsing/src/attributes/macro_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,11 @@ impl<S: Stage> AttributeParser<S> for MacroUseParser {
Some(AttributeKind::MacroUse { span: self.first_span?, arguments: self.state })
}
}

pub(crate) struct AllowInternalUnsafeParser;

impl<S: Stage> NoArgsAttributeParser<S> for AllowInternalUnsafeParser {
const PATH: &[Symbol] = &[sym::allow_internal_unsafe];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Ignore;
const CREATE: fn(Span) -> AttributeKind = |span| AttributeKind::AllowInternalUnsafe(span);
}
5 changes: 4 additions & 1 deletion compiler/rustc_attr_parsing/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ use crate::attributes::lint_helpers::{
AsPtrParser, AutomaticallyDerivedParser, PassByValueParser, PubTransparentParser,
};
use crate::attributes::loop_match::{ConstContinueParser, LoopMatchParser};
use crate::attributes::macro_attrs::{MacroEscapeParser, MacroUseParser};
use crate::attributes::macro_attrs::{
AllowInternalUnsafeParser, MacroEscapeParser, MacroUseParser,
};
use crate::attributes::must_use::MustUseParser;
use crate::attributes::no_implicit_prelude::NoImplicitPreludeParser;
use crate::attributes::non_exhaustive::NonExhaustiveParser;
Expand Down Expand Up @@ -178,6 +180,7 @@ attribute_parsers!(
Single<SkipDuringMethodDispatchParser>,
Single<TransparencyParser>,
Single<WithoutArgs<AllowIncoherentImplParser>>,
Single<WithoutArgs<AllowInternalUnsafeParser>>,
Single<WithoutArgs<AsPtrParser>>,
Single<WithoutArgs<AutomaticallyDerivedParser>>,
Single<WithoutArgs<CoherenceIsCoreParser>>,
Expand Down
5 changes: 1 addition & 4 deletions compiler/rustc_expand/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -905,10 +905,7 @@ impl SyntaxExtension {
find_attr!(attrs, AttributeKind::AllowInternalUnstable(i, _) => i)
.map(|i| i.as_slice())
.unwrap_or_default();
// FIXME(jdonszelman): allow_internal_unsafe isn't yet new-style
// let allow_internal_unsafe = find_attr!(attrs, AttributeKind::AllowInternalUnsafe);
let allow_internal_unsafe =
ast::attr::find_by_name(attrs, sym::allow_internal_unsafe).is_some();
let allow_internal_unsafe = find_attr!(attrs, AttributeKind::AllowInternalUnsafe(_));

let local_inner_macros = ast::attr::find_by_name(attrs, sym::macro_export)
.and_then(|macro_export| macro_export.meta_item_list())
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_hir/src/attrs/data_structures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,9 @@ pub enum AttributeKind {
/// Represents `#[rustc_allow_incoherent_impl]`.
AllowIncoherentImpl(Span),

/// Represents `#[allow_internal_unsafe]`.
AllowInternalUnsafe(Span),

/// Represents `#[allow_internal_unstable]`.
AllowInternalUnstable(ThinVec<(Symbol, Span)>, Span),

Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_hir/src/attrs/encode_cross_crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ impl AttributeKind {
Align { .. } => No,
AllowConstFnUnstable(..) => No,
AllowIncoherentImpl(..) => No,
AllowInternalUnsafe(..) => Yes,
AllowInternalUnstable(..) => Yes,
AsPtr(..) => Yes,
AutomaticallyDerived(..) => Yes,
Expand Down
13 changes: 12 additions & 1 deletion compiler/rustc_lint/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@
//! [`crate::late_lint_methods!`] invocation in `lib.rs`.

use std::fmt::Write;
use std::slice;

use ast::token::TokenKind;
use rustc_abi::BackendRepr;
use rustc_ast::tokenstream::{TokenStream, TokenTree};
use rustc_ast::visit::{FnCtxt, FnKind};
use rustc_ast::{self as ast, *};
use rustc_ast_pretty::pprust::expr_to_string;
use rustc_attr_parsing::AttributeParser;
use rustc_errors::{Applicability, LintDiagnostic};
use rustc_feature::GateIssue;
use rustc_hir as hir;
Expand Down Expand Up @@ -249,7 +251,16 @@ impl UnsafeCode {

impl EarlyLintPass for UnsafeCode {
fn check_attribute(&mut self, cx: &EarlyContext<'_>, attr: &ast::Attribute) {
if attr.has_name(sym::allow_internal_unsafe) {
if AttributeParser::parse_limited(
cx.builder.sess(),
slice::from_ref(attr),
sym::allow_internal_unsafe,
attr.span,
DUMMY_NODE_ID,
Some(cx.builder.features()),
)
.is_some()
{
self.report_unsafe(cx, attr.span, BuiltinUnsafe::AllowInternalUnsafe);
}
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_passes/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ passes_allow_incoherent_impl =
`rustc_allow_incoherent_impl` attribute should be applied to impl items
.label = the only currently supported targets are inherent methods
passes_allow_internal_unstable =
passes_macro_only_attribute =
attribute should be applied to a macro
.label = not a macro
Expand Down
49 changes: 41 additions & 8 deletions compiler/rustc_passes/src/check_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
Attribute::Parsed(AttributeKind::ConstContinue(attr_span)) => {
self.check_const_continue(hir_id, *attr_span, target)
}
Attribute::Parsed(AttributeKind::AllowInternalUnsafe(attr_span)) => {
self.check_allow_internal_unsafe(hir_id, *attr_span, span, target, attrs)
}
Attribute::Parsed(AttributeKind::AllowInternalUnstable(_, first_span)) => {
self.check_allow_internal_unstable(hir_id, *first_span, span, target, attrs)
}
Expand Down Expand Up @@ -413,7 +416,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
// internal
| sym::prelude_import
| sym::panic_handler
| sym::allow_internal_unsafe
| sym::lang
| sym::needs_allocator
| sym::default_lib_allocator
Expand Down Expand Up @@ -2212,14 +2214,49 @@ impl<'tcx> CheckAttrVisitor<'tcx> {

/// Outputs an error for `#[allow_internal_unstable]` which can only be applied to macros.
/// (Allows proc_macro functions)
// FIXME(jdonszelmann): if possible, move to attr parsing
fn check_allow_internal_unstable(
&self,
hir_id: HirId,
attr_span: Span,
span: Span,
target: Target,
attrs: &[Attribute],
) {
self.check_macro_only_attr(
hir_id,
attr_span,
span,
target,
attrs,
"allow_internal_unstable",
)
}

/// Outputs an error for `#[allow_internal_unsafe]` which can only be applied to macros.
/// (Allows proc_macro functions)
fn check_allow_internal_unsafe(
&self,
hir_id: HirId,
attr_span: Span,
span: Span,
target: Target,
attrs: &[Attribute],
) {
self.check_macro_only_attr(hir_id, attr_span, span, target, attrs, "allow_internal_unsafe")
}

/// Outputs an error for attributes that can only be applied to macros, such as
/// `#[allow_internal_unsafe]` and `#[allow_internal_unstable]`.
/// (Allows proc_macro functions)
// FIXME(jdonszelmann): if possible, move to attr parsing
fn check_macro_only_attr(
&self,
hir_id: HirId,
attr_span: Span,
span: Span,
target: Target,
attrs: &[Attribute],
attr_name: &str,
) {
match target {
Target::Fn => {
Expand All @@ -2238,18 +2275,14 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
// erroneously allowed it and some crates used it accidentally, to be compatible
// with crates depending on them, we can't throw an error here.
Target::Field | Target::Arm => {
self.inline_attr_str_error_without_macro_def(
hir_id,
attr_span,
"allow_internal_unstable",
);
self.inline_attr_str_error_without_macro_def(hir_id, attr_span, attr_name);
return;
}
// otherwise continue out of the match
_ => {}
}

self.tcx.dcx().emit_err(errors::AllowInternalUnstable { attr_span, span });
self.tcx.dcx().emit_err(errors::MacroOnlyAttribute { attr_span, span });
}

/// Checks if the items on the `#[debugger_visualizer]` attribute are valid.
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_passes/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -643,8 +643,8 @@ pub(crate) struct UsedStatic {
}

#[derive(Diagnostic)]
#[diag(passes_allow_internal_unstable)]
pub(crate) struct AllowInternalUnstable {
#[diag(passes_macro_only_attribute)]
pub(crate) struct MacroOnlyAttribute {
#[primary_span]
pub attr_span: Span,
#[label]
Expand Down
32 changes: 16 additions & 16 deletions compiler/rustc_public/src/mir/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ impl AssertMessage {
}
}

#[derive(Copy, Clone, Debug, Eq, PartialEq, Serialize)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Serialize)]
pub enum BinOp {
Add,
AddUnchecked,
Expand Down Expand Up @@ -384,7 +384,7 @@ impl BinOp {
}
}

#[derive(Copy, Clone, Debug, Eq, PartialEq, Serialize)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Serialize)]
pub enum UnOp {
Not,
Neg,
Expand Down Expand Up @@ -490,7 +490,7 @@ pub enum StatementKind {
Nop,
}

#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize)]
pub enum Rvalue {
/// Creates a pointer with the indicated mutability to the place.
///
Expand Down Expand Up @@ -666,7 +666,7 @@ impl Rvalue {
}
}

#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize)]
pub enum AggregateKind {
Array(Ty),
Tuple,
Expand All @@ -677,14 +677,14 @@ pub enum AggregateKind {
RawPtr(Ty, Mutability),
}

#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize)]
pub enum Operand {
Copy(Place),
Move(Place),
Constant(ConstOperand),
}

#[derive(Clone, Eq, PartialEq, Serialize)]
#[derive(Clone, Eq, PartialEq, Hash, Serialize)]
pub struct Place {
pub local: Local,
/// projection out of a place (access a field, deref a pointer, etc)
Expand All @@ -697,7 +697,7 @@ impl From<Local> for Place {
}
}

#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize)]
pub struct ConstOperand {
pub span: Span,
pub user_ty: Option<UserTypeAnnotationIndex>,
Expand Down Expand Up @@ -770,7 +770,7 @@ pub enum VarDebugInfoContents {
// ProjectionElem<Local, Ty>) and user-provided type annotations (for which the projection elements
// are of type ProjectionElem<(), ()>).
// In rustc_public's IR we don't need this generality, so we just use ProjectionElem for Places.
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize)]
pub enum ProjectionElem {
/// Dereference projections (e.g. `*_1`) project to the address referenced by the base place.
Deref,
Expand Down Expand Up @@ -913,7 +913,7 @@ impl SwitchTargets {
}
}

#[derive(Copy, Clone, Debug, Eq, PartialEq, Serialize)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Serialize)]
pub enum BorrowKind {
/// Data must be immutable and is aliasable.
Shared,
Expand All @@ -940,7 +940,7 @@ impl BorrowKind {
}
}

#[derive(Copy, Clone, Debug, Eq, PartialEq, Serialize)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Serialize)]
pub enum RawPtrKind {
Mut,
Const,
Expand All @@ -958,14 +958,14 @@ impl RawPtrKind {
}
}

#[derive(Copy, Clone, Debug, Eq, PartialEq, Serialize)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Serialize)]
pub enum MutBorrowKind {
Default,
TwoPhaseBorrow,
ClosureCapture,
}

#[derive(Copy, Clone, Debug, Eq, PartialEq, Serialize)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Serialize)]
pub enum FakeBorrowKind {
/// A shared (deep) borrow. Data must be immutable and is aliasable.
Deep,
Expand All @@ -982,13 +982,13 @@ pub enum Mutability {
Mut,
}

#[derive(Copy, Clone, Debug, Eq, PartialEq, Serialize)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Serialize)]
pub enum Safety {
Safe,
Unsafe,
}

#[derive(Copy, Clone, Debug, Eq, PartialEq, Serialize)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Serialize)]
pub enum PointerCoercion {
/// Go from a fn-item type to a fn-pointer type.
ReifyFnPointer,
Expand All @@ -1015,7 +1015,7 @@ pub enum PointerCoercion {
Unsize,
}

#[derive(Copy, Clone, Debug, Eq, PartialEq, Serialize)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Serialize)]
pub enum CastKind {
// FIXME(smir-rename): rename this to PointerExposeProvenance
PointerExposeAddress,
Expand All @@ -1030,7 +1030,7 @@ pub enum CastKind {
Transmute,
}

#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize)]
pub enum NullOp {
/// Returns the size of a value of that type.
SizeOf,
Expand Down
Loading
Loading