From 38a317b2dfed8fc790a527500d16f20911560bc4 Mon Sep 17 00:00:00 2001 From: khyperia <953151+khyperia@users.noreply.github.com> Date: Wed, 23 Sep 2026 10:50:17 +0000 Subject: [PATCH 1/6] rename direct_const_arg! to gca! Co-authored-by: Boxy --- src/expr.rs | 2 +- src/types.rs | 2 +- src/utils.rs | 2 +- tests/source/direct_const_arg.rs | 15 --------------- tests/source/gca.rs | 17 +++++++++++++++++ tests/target/direct_const_arg.rs | 15 --------------- tests/target/gca.rs | 17 +++++++++++++++++ 7 files changed, 37 insertions(+), 33 deletions(-) delete mode 100644 tests/source/direct_const_arg.rs create mode 100644 tests/source/gca.rs delete mode 100644 tests/target/direct_const_arg.rs create mode 100644 tests/target/gca.rs diff --git a/src/expr.rs b/src/expr.rs index f0e56ffb8ea..48f17fb0fd1 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -430,7 +430,7 @@ pub(crate) fn format_expr( | ast::ExprKind::IncludedBytes(..) | ast::ExprKind::OffsetOf(..) | ast::ExprKind::UnsafeBinderCast(..) - | ast::ExprKind::DirectConstArg(..) => { + | ast::ExprKind::GcaMacro(..) => { // These don't normally occur in the AST because macros aren't expanded. However, // rustfmt tries to parse macro arguments when formatting macros, so it's not totally // impossible for rustfmt to come across one of these nodes when formatting a file. diff --git a/src/types.rs b/src/types.rs index e2c92e58062..d119cd50c84 100644 --- a/src/types.rs +++ b/src/types.rs @@ -1043,7 +1043,7 @@ impl Rewrite for ast::Ty { result.push_str(&rewrite); Ok(result) } - ast::TyKind::Pat(..) | ast::TyKind::View(..) | ast::TyKind::DirectConstArg(..) => { + ast::TyKind::Pat(..) | ast::TyKind::View(..) | ast::TyKind::GcaMacro(..) => { // These don't normally occur in the AST because macros aren't expanded. However, // rustfmt tries to parse macro arguments when formatting macros, so it's not // totally impossible for rustfmt to come across these nodes when formatting a file. diff --git a/src/utils.rs b/src/utils.rs index 6f9fa7ff702..f7933ac52f7 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -562,7 +562,7 @@ pub(crate) fn is_block_expr(context: &RewriteContext<'_>, expr: &ast::Expr, repr | ast::ExprKind::Unary(_, ref expr) | ast::ExprKind::Try(ref expr) | ast::ExprKind::Yield(YieldKind::Prefix(Some(ref expr))) - | ast::ExprKind::DirectConstArg(ref expr) => is_block_expr(context, expr, repr), + | ast::ExprKind::GcaMacro(ref expr) => is_block_expr(context, expr, repr), ast::ExprKind::Closure(ref closure) => is_block_expr(context, &closure.body, repr), // This can only be a string lit ast::ExprKind::Lit(_) => { diff --git a/tests/source/direct_const_arg.rs b/tests/source/direct_const_arg.rs deleted file mode 100644 index 6486d782cc1..00000000000 --- a/tests/source/direct_const_arg.rs +++ /dev/null @@ -1,15 +0,0 @@ -// direct_const_arg! is a built-in macro relevant to min_generic_const_args; its contents should be -// formatted as if its contents were passed through unchanged (the macro changes the semantics of -// the contained expression, the syntax is unchanged) - -#![feature(min_generic_const_args)] - -trait Trait { - #[rustc_always_gca] - const TYPE_CONST: usize; -} - -struct S; - -fn parsed_as_expr_kind(_: S<{ core::direct_const_arg!( T :: TYPE_CONST ) }>) {} -fn parsed_as_ty_kind(_: S< core::direct_const_arg!( T :: TYPE_CONST ) >) {} diff --git a/tests/source/gca.rs b/tests/source/gca.rs new file mode 100644 index 00000000000..ab394c21b8b --- /dev/null +++ b/tests/source/gca.rs @@ -0,0 +1,17 @@ +// gca! is a built-in macro relevant to min_generic_const_args; its contents should be formatted as +// if its contents were passed through unchanged (the macro changes the semantics of the contained +// expression, the syntax is unchanged) + +#![feature(min_generic_const_args)] + +use std::gca; + +trait Trait { + #[rustc_always_gca] + const TYPE_CONST: usize; +} + +struct S; + +fn parsed_as_expr_kind(_: S<{ gca!( T :: TYPE_CONST ) }>) {} +fn parsed_as_ty_kind(_: S< gca!( T :: TYPE_CONST ) >) {} diff --git a/tests/target/direct_const_arg.rs b/tests/target/direct_const_arg.rs deleted file mode 100644 index 94a6c864b78..00000000000 --- a/tests/target/direct_const_arg.rs +++ /dev/null @@ -1,15 +0,0 @@ -// direct_const_arg! is a built-in macro relevant to min_generic_const_args; its contents should be -// formatted as if its contents were passed through unchanged (the macro changes the semantics of -// the contained expression, the syntax is unchanged) - -#![feature(min_generic_const_args)] - -trait Trait { - #[rustc_always_gca] - const TYPE_CONST: usize; -} - -struct S; - -fn parsed_as_expr_kind(_: S<{ core::direct_const_arg!(T::TYPE_CONST) }>) {} -fn parsed_as_ty_kind(_: S) {} diff --git a/tests/target/gca.rs b/tests/target/gca.rs new file mode 100644 index 00000000000..8110bb0d2c8 --- /dev/null +++ b/tests/target/gca.rs @@ -0,0 +1,17 @@ +// gca! is a built-in macro relevant to min_generic_const_args; its contents should be formatted as +// if its contents were passed through unchanged (the macro changes the semantics of the contained +// expression, the syntax is unchanged) + +#![feature(min_generic_const_args)] + +use std::gca; + +trait Trait { + #[rustc_always_gca] + const TYPE_CONST: usize; +} + +struct S; + +fn parsed_as_expr_kind(_: S<{ gca!(T::TYPE_CONST) }>) {} +fn parsed_as_ty_kind(_: S) {} From 0cd2f569e3b68874b6ffb77b143bedca1548a938 Mon Sep 17 00:00:00 2001 From: khyperia <953151+khyperia@users.noreply.github.com> Date: Fri, 25 Sep 2026 13:04:03 +0200 Subject: [PATCH 2/6] rename GCA features --- tests/source/gca.rs | 4 ++-- tests/target/gca.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/source/gca.rs b/tests/source/gca.rs index ab394c21b8b..0c63def9691 100644 --- a/tests/source/gca.rs +++ b/tests/source/gca.rs @@ -1,8 +1,8 @@ -// gca! is a built-in macro relevant to min_generic_const_args; its contents should be formatted as +// gca! is a built-in macro relevant to gca_min_const_items; its contents should be formatted as // if its contents were passed through unchanged (the macro changes the semantics of the contained // expression, the syntax is unchanged) -#![feature(min_generic_const_args)] +#![feature(gca_min_const_items)] use std::gca; diff --git a/tests/target/gca.rs b/tests/target/gca.rs index 8110bb0d2c8..db8936ed64c 100644 --- a/tests/target/gca.rs +++ b/tests/target/gca.rs @@ -1,8 +1,8 @@ -// gca! is a built-in macro relevant to min_generic_const_args; its contents should be formatted as +// gca! is a built-in macro relevant to gca_min_const_items; its contents should be formatted as // if its contents were passed through unchanged (the macro changes the semantics of the contained // expression, the syntax is unchanged) -#![feature(min_generic_const_args)] +#![feature(gca_min_const_items)] use std::gca; From 7c9e6bbc3a0d51ae04d7d47452a62267d3466d77 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 22 Sep 2026 10:24:58 +1000 Subject: [PATCH 3/6] Merge `ForceWarning`/`Allow`/`Expect` into `Warning` Because they're all just special cases of warnings. This requires introducing a new `Option` field to `Warning` that describes the special case behaviour; the `DiagInner::lint_id` field also gets merged in. Specific nice things about this: - Removes some unreachable match arms for `Allow`/`Expect`. - Removes the hacky upgrading of `Allow`/`Expect` to `Warning` in `emit_future_breakage_report`. - The types now have structure that used to be maintained by comments and assertions. E.g. it's now impossible to not have a `lint_id` for an `expect` lint. (I always found the `DiagInner::lint_id` field confusing; it's clearer now.) - There's a nice comment on `EmissionOverride` summarizing all the different cases. - A little less code overall. --- src/parse/session.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/parse/session.rs b/src/parse/session.rs index 83a77e73cb7..c61b43492ce 100644 --- a/src/parse/session.rs +++ b/src/parse/session.rs @@ -418,7 +418,7 @@ mod tests { Some(ignore_list), ); let span = MultiSpan::from_span(mk_sp(BytePos(0), BytePos(1))); - let non_fatal_diagnostic = build_diagnostic(DiagnosticLevel::Warning, Some(span)); + let non_fatal_diagnostic = build_diagnostic(DiagnosticLevel::Warning(None), Some(span)); emitter.emit_diagnostic(non_fatal_diagnostic); assert_eq!(num_emitted_errors.load(Ordering::Acquire), 0); assert_eq!(can_reset_errors.load(Ordering::Acquire), true); @@ -439,7 +439,7 @@ mod tests { None, ); let span = MultiSpan::from_span(mk_sp(BytePos(0), BytePos(1))); - let non_fatal_diagnostic = build_diagnostic(DiagnosticLevel::Warning, Some(span)); + let non_fatal_diagnostic = build_diagnostic(DiagnosticLevel::Warning(None), Some(span)); emitter.emit_diagnostic(non_fatal_diagnostic); assert_eq!(num_emitted_errors.load(Ordering::Acquire), 1); assert_eq!(can_reset_errors.load(Ordering::Acquire), false); @@ -467,8 +467,8 @@ mod tests { ); let bar_span = MultiSpan::from_span(mk_sp(BytePos(0), BytePos(1))); let foo_span = MultiSpan::from_span(mk_sp(BytePos(21), BytePos(22))); - let bar_diagnostic = build_diagnostic(DiagnosticLevel::Warning, Some(bar_span)); - let foo_diagnostic = build_diagnostic(DiagnosticLevel::Warning, Some(foo_span)); + let bar_diagnostic = build_diagnostic(DiagnosticLevel::Warning(None), Some(bar_span)); + let foo_diagnostic = build_diagnostic(DiagnosticLevel::Warning(None), Some(foo_span)); let fatal_diagnostic = build_diagnostic(DiagnosticLevel::Fatal, None); emitter.emit_diagnostic(bar_diagnostic); emitter.emit_diagnostic(foo_diagnostic); From c0686fd19ec9471c27a8fb0826ef0c56df0d9655 Mon Sep 17 00:00:00 2001 From: cyrgani Date: Sun, 27 Sep 2026 21:34:33 +0000 Subject: [PATCH 4/6] remove `ast::MutTy` --- src/types.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/types.rs b/src/types.rs index d119cd50c84..fcf8321f189 100644 --- a/src/types.rs +++ b/src/types.rs @@ -821,17 +821,17 @@ impl Rewrite for ast::Ty { } Ok(format!("{prefix}{res}")) } - ast::TyKind::Ptr(ref mt) => { - let prefix = match mt.mutbl { + ast::TyKind::Ptr(ref ty, mutbl) => { + let prefix = match mutbl { Mutability::Mut => "*mut ", Mutability::Not => "*const ", }; - rewrite_unary_prefix(context, prefix, &*mt.ty, shape) + rewrite_unary_prefix(context, prefix, &*ty, shape) } - ast::TyKind::Ref(ref lifetime, ref mt) - | ast::TyKind::PinnedRef(ref lifetime, ref mt) => { - let mut_str = format_mutability(mt.mutbl); + ast::TyKind::Ref(ref lifetime, ref ty, mutbl) + | ast::TyKind::PinnedRef(ref lifetime, ref ty, mutbl) => { + let mut_str = format_mutability(mutbl); let mut_len = mut_str.len(); let mut result = String::with_capacity(128); result.push('&'); @@ -866,12 +866,12 @@ impl Rewrite for ast::Ty { if let ast::TyKind::PinnedRef(..) = self.kind { result.push_str("pin "); - if ast::Mutability::Not == mt.mutbl { + if ast::Mutability::Not == mutbl { result.push_str("const "); } } - if ast::Mutability::Mut == mt.mutbl { + if ast::Mutability::Mut == mutbl { let mut_hi = context.snippet_provider.span_after(self.span(), "mut"); let before_mut_span = mk_sp(cmnt_lo, mut_hi - BytePos::from_usize(3)); if contains_comment(context.snippet(before_mut_span)) { @@ -889,12 +889,12 @@ impl Rewrite for ast::Ty { cmnt_lo = mut_hi; } - let before_ty_span = mk_sp(cmnt_lo, mt.ty.span.lo()); + let before_ty_span = mk_sp(cmnt_lo, ty.span.lo()); if contains_comment(context.snippet(before_ty_span)) { result = combine_strs_with_missing_comments( context, result.trim_end(), - &mt.ty.rewrite_result(context, shape)?, + &ty.rewrite_result(context, shape)?, before_ty_span, shape, true, @@ -905,7 +905,7 @@ impl Rewrite for ast::Ty { .width .checked_sub(used_width) .max_width_error(shape.width, self.span())?; - let ty_str = mt.ty.rewrite_result( + let ty_str = ty.rewrite_result( context, Shape::legacy(budget, shape.indent + used_width), )?; @@ -1333,9 +1333,9 @@ pub(crate) fn can_be_overflowed_type( ) -> bool { match ty.kind { ast::TyKind::Tup(..) => context.use_block_indent() && len == 1, - ast::TyKind::Ref(_, ref mutty) - | ast::TyKind::PinnedRef(_, ref mutty) - | ast::TyKind::Ptr(ref mutty) => can_be_overflowed_type(context, &*mutty.ty, len), + ast::TyKind::Ref(_, ref ty, _) + | ast::TyKind::PinnedRef(_, ref ty, _) + | ast::TyKind::Ptr(ref ty, _) => can_be_overflowed_type(context, &*ty, len), _ => false, } } From ec4737e9badd2e092c4315f76e2d82cb3ee3ce89 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Wed, 30 Sep 2026 17:07:09 -0500 Subject: [PATCH 5/6] intrinsics: Rename `abort` to `abort_immediate` The semantics of `intrinsics::abort()` are closer to what we have unstably as `abort_immediate()` than to `process::abort()` or `libc::abort()`. Rename it to make more clear that the intrinsic is more of an intentional crash with platform-specific behavior than what `libc::abort()` tries to be (i.e. raising `SIGABRT`). --- tests/source/match.rs | 2 +- tests/target/match.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/source/match.rs b/tests/source/match.rs index d1d8d7f2c36..c171244271f 100644 --- a/tests/source/match.rs +++ b/tests/source/match.rs @@ -240,7 +240,7 @@ fn issue383() { fn issue507() { match 1 { - 1 => unsafe { std::intrinsics::abort() }, + 1 => unsafe { std::intrinsics::abort_immediate() }, _ => (), } } diff --git a/tests/target/match.rs b/tests/target/match.rs index 0e7815a814d..f751aea547a 100644 --- a/tests/target/match.rs +++ b/tests/target/match.rs @@ -249,7 +249,7 @@ fn issue383() { fn issue507() { match 1 { - 1 => unsafe { std::intrinsics::abort() }, + 1 => unsafe { std::intrinsics::abort_immediate() }, _ => (), } } From 517142560b18f78c07089913d61808405bfa130e Mon Sep 17 00:00:00 2001 From: Yacin Tmimi Date: Mon, 5 Oct 2026 12:40:51 -0400 Subject: [PATCH 6/6] Prepare for merging from rust-lang/rust This updates the rust-toolchain.toml file to nightly-2026-10-05 (28221559263a3976766cf305940e80e30cf9ba8a). --- rust-toolchain.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 0d019291608..05c048743fe 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2026-09-23" +channel = "nightly-2026-10-05" components = ["llvm-tools", "rustc-dev"]