Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
6f81506
Update neovim instructions for neovim 0.11+
erfanio Mar 31, 2026
69345f6
Fix GPU target notification group links
apiraino Apr 3, 2026
314c14a
Address code review comments
erfanio Apr 6, 2026
0026340
Use skip_comments to strip comments
erfanio Apr 6, 2026
d477368
Use double quotes consistently
erfanio Apr 6, 2026
8d96fa0
Merge rust-analyzer settings instead of overwriting
erfanio Apr 6, 2026
2455931
Fix link to hir::Crate in lowering.md
reddevilmidzy Apr 10, 2026
dbe3144
Merge pull request rust-lang/rustc-dev-guide#2829 from reddevilmidzy/hir
reddevilmidzy Apr 10, 2026
20c9f54
Document precision considerations of `Duration`-float methods
cuviper Apr 10, 2026
d72b0e7
implementing-new-features.md: update parameters to `declare_features!`
DanielEScherzer Apr 12, 2026
d928b2b
Merge pull request rust-lang/rustc-dev-guide#2821 from apiraino/fix-n…
reddevilmidzy Apr 13, 2026
269feca
Document quoting for `@bors squash msg=`
reddevilmidzy Apr 13, 2026
5273a4c
Merge pull request rust-lang/rustc-dev-guide#2831 from reddevilmidzy/…
reddevilmidzy Apr 13, 2026
9ddab4d
Prepare for merging from rust-lang/rust
invalid-email-address Apr 13, 2026
401da23
Merge ref '14196dbfa3eb' from rust-lang/rust
invalid-email-address Apr 13, 2026
d7b595c
Merge pull request #2832 from rust-lang/rustc-pull
tshepang Apr 13, 2026
c315ef2
show instead of explain
tshepang Apr 13, 2026
c092fa7
Merge pull request rust-lang/rustc-dev-guide#2833 from rust-lang/tshe…
reddevilmidzy Apr 13, 2026
2a152e1
Prepare for merging from rust-lang/rust
invalid-email-address Apr 13, 2026
5b3b085
Merge ref '17584a181979' from rust-lang/rust
invalid-email-address Apr 13, 2026
d40530b
Merge pull request #2834 from rust-lang/rustc-pull
tshepang Apr 13, 2026
a43992e
Merge pull request rust/rustc-dev-guide#2814 from erfanio/main
reddevilmidzy Apr 17, 2026
72b21f4
Update link for Rust reference documentation
reddevilmidzy Apr 17, 2026
e2bb6fc
Merge pull request rust-lang/rustc-dev-guide#2836 from reddevilmidzy/rr
reddevilmidzy Apr 17, 2026
873d2f6
effects.md: update const trait syntax
DanielEScherzer Apr 17, 2026
872a1c3
Merge pull request #2838 from DanielEScherzer/patch-1
fmease Apr 17, 2026
de48fc6
rustdoc: fix a few spots where emit isn't respected
notriddle Apr 16, 2026
c5e1f60
Clarifications and instructions - nightly
amanjeev Apr 18, 2026
9faee77
Typo in crate name
amanjeev Apr 18, 2026
369969a
PR review: use better command
amanjeev Apr 18, 2026
2720e65
Merge pull request #2839 from rust-lang/aj/rustc-internals-docs-clarity
amanjeev Apr 19, 2026
f6f98eb
Prepare for merging from rust-lang/rust
invalid-email-address Apr 20, 2026
3b694e5
Merge ref 'e22c616e4e87' from rust-lang/rust
invalid-email-address Apr 20, 2026
f527595
Merge pull request #2840 from rust-lang/rustc-pull
tshepang Apr 20, 2026
ae92374
Prepare for merging from rust-lang/rust
invalid-email-address Apr 20, 2026
5a7193d
Merge ref 'd12e1e12ae6f' from rust-lang/rust
invalid-email-address Apr 20, 2026
02e975b
Merge pull request #2841 from rust-lang/rustc-pull
tshepang Apr 20, 2026
0add85c
Remove `nodes_in_current_session` field and related assertions
Zoxc Mar 24, 2026
babfcd8
Prepare for merging from rust-lang/rust
invalid-email-address Apr 21, 2026
6fe2465
Merge ref '84c119007247' from rust-lang/rust
invalid-email-address Apr 21, 2026
2d2894c
Merge pull request #2842 from rust-lang/rustc-pull
tshepang Apr 21, 2026
0c97aba
Merge pull request rust-lang/rustc-dev-guide#2830 from DanielEScherze…
reddevilmidzy Apr 21, 2026
9af3d2c
document public dashboard (again)
marcoieni Apr 21, 2026
c971109
Merge pull request #2843 from marcoieni/document-public-dashboard--again
marcoieni Apr 21, 2026
6f511f1
Mentions rustc-docs for rustc_private
amanjeev Apr 21, 2026
af3e34b
Stop creating ctor def ids for unions and move the ctor def id creati…
oli-obk Apr 20, 2026
797e68f
Move variant ctor creation into the brg
oli-obk Apr 20, 2026
209a2a6
delegation macros are never handled in the def collector
oli-obk Apr 20, 2026
af03b49
Handle MacCall items directly in the def collector
oli-obk Apr 20, 2026
3070ce9
Immediately feed visibility on DefId creation
oli-obk Apr 20, 2026
0169aae
va_arg: fix potential misaligned load
folkertdev Feb 13, 2026
45f98b9
va_arg: remove unused argument
folkertdev Feb 13, 2026
b906873
Add constness & asyncness
cijiugechu Apr 22, 2026
2f864a9
Split `Metadata` trait into `MetaBlob` and `MetaDecoder`.
nnethercote Apr 21, 2026
be52e75
Simplify one `MetaBlob` impl.
nnethercote Apr 21, 2026
f0ebd66
Remove unused `tcx` params.
nnethercote Apr 21, 2026
f9566d6
Merge pull request #2844 from rust-lang/aj/rustc-internals-docs-clarity
tshepang Apr 22, 2026
5149a31
change `llvm.ptrmask` argument to `isize`
folkertdev Apr 21, 2026
3bb7d7d
Prepare for merging from rust-lang/rust
invalid-email-address Apr 22, 2026
95f4108
Merge ref 'cf1817bc6ecd' from rust-lang/rust
invalid-email-address Apr 22, 2026
abb0d9a
Merge pull request #2845 from rust-lang/rustc-pull
tshepang Apr 22, 2026
24b1634
BinOpAssign always returns unit
oli-obk Apr 22, 2026
248cfe7
sembr src/rustc-driver/external-rustc-drivers.md
tshepang Apr 22, 2026
5f0877e
whitespace
tshepang Apr 22, 2026
4d31601
title case
tshepang Apr 22, 2026
0be2aa6
sembr src/tests/ci.md
tshepang Apr 22, 2026
6ff11cf
make sentence feel more complete
tshepang Apr 22, 2026
a3a2992
sembr src/tests/compiletest.md
tshepang Apr 22, 2026
3be0e76
Update a very outdated comment
oli-obk Apr 22, 2026
c392def
sembr src/stability.md
tshepang Apr 22, 2026
8d75f0c
add on_unmatch_args
chenyukang Apr 19, 2026
e704d0f
improve stability.md
tshepang Apr 22, 2026
14dd4b2
sembr src/hir/lowering.md
tshepang Apr 22, 2026
dc675c7
improve hir/lowering.md
tshepang Apr 22, 2026
78b3073
sembr src/coherence.md
tshepang Apr 22, 2026
ca75ba2
improve coherence.md
tshepang Apr 22, 2026
f7f7989
sembr src/name-resolution.md
tshepang Apr 22, 2026
a39bff7
reflow
tshepang Apr 22, 2026
85ffe92
Merge pull request #2846 from rust-lang/tshepang/sembr
tshepang Apr 22, 2026
5ad7363
Rollup merge of #154794 - chenyukang:yukang-fix-152494-incomplete-mac…
JonathanBrouwer Apr 22, 2026
d7bb378
Rollup merge of #155133 - cuviper:duration_fp_docs, r=the8472
JonathanBrouwer Apr 22, 2026
8bade03
Rollup merge of #154283 - Zoxc:rem-nodes_in_current_session, r=nnethe…
JonathanBrouwer Apr 22, 2026
dcde112
Rollup merge of #155374 - notriddle:non-static-dep-info, r=fmease
JonathanBrouwer Apr 22, 2026
5e48418
Rollup merge of #155587 - oli-obk:feed-visibility-no-hash, r=petroche…
JonathanBrouwer Apr 22, 2026
e9972d9
Rollup merge of #155622 - folkertdev:va-arg-llvm-fixes, r=tgross35
JonathanBrouwer Apr 22, 2026
b0d794f
Rollup merge of #155629 - cijiugechu:fn_constness, r=makai410
JonathanBrouwer Apr 22, 2026
6f6e6bb
Rollup merge of #155632 - nnethercote:split-Metadata, r=mejrs
JonathanBrouwer Apr 22, 2026
c4b5ea9
Rollup merge of #155639 - oli-obk:builtin-binop-const, r=nnethercote
JonathanBrouwer Apr 22, 2026
e94e3cc
Rollup merge of #155647 - tshepang:rdg-sync, r=tshepang
JonathanBrouwer Apr 22, 2026
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
10 changes: 9 additions & 1 deletion compiler/rustc_attr_parsing/src/attributes/diagnostic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub(crate) mod on_const;
pub(crate) mod on_move;
pub(crate) mod on_unimplemented;
pub(crate) mod on_unknown;
pub(crate) mod on_unmatch_args;

#[derive(Copy, Clone)]
pub(crate) enum Mode {
Expand All @@ -38,6 +39,8 @@ pub(crate) enum Mode {
DiagnosticOnMove,
/// `#[diagnostic::on_unknown]`
DiagnosticOnUnknown,
/// `#[diagnostic::on_unmatch_args]`
DiagnosticOnUnmatchArgs,
}

impl Mode {
Expand All @@ -48,6 +51,7 @@ impl Mode {
Self::DiagnosticOnConst => "diagnostic::on_const",
Self::DiagnosticOnMove => "diagnostic::on_move",
Self::DiagnosticOnUnknown => "diagnostic::on_unknown",
Self::DiagnosticOnUnmatchArgs => "diagnostic::on_unmatch_args",
}
}

Expand All @@ -62,6 +66,7 @@ impl Mode {
Self::DiagnosticOnConst => DEFAULT,
Self::DiagnosticOnMove => DEFAULT,
Self::DiagnosticOnUnknown => DEFAULT,
Self::DiagnosticOnUnmatchArgs => DEFAULT,
}
}

Expand All @@ -75,6 +80,7 @@ impl Mode {
Self::DiagnosticOnConst => DEFAULT,
Self::DiagnosticOnMove => DEFAULT,
Self::DiagnosticOnUnknown => DEFAULT,
Self::DiagnosticOnUnmatchArgs => DEFAULT,
}
}
}
Expand Down Expand Up @@ -398,7 +404,9 @@ fn parse_arg(
Position::ArgumentNamed(name) => match (mode, Symbol::intern(name)) {
// Only `#[rustc_on_unimplemented]` can use these
(Mode::RustcOnUnimplemented { .. }, sym::ItemContext) => FormatArg::ItemContext,
(Mode::RustcOnUnimplemented { .. }, sym::This) => FormatArg::This,
(Mode::RustcOnUnimplemented { .. } | Mode::DiagnosticOnUnmatchArgs, sym::This) => {
FormatArg::This
}
(Mode::RustcOnUnimplemented { .. }, sym::Trait) => FormatArg::Trait,
// Any attribute can use these
(_, kw::SelfUpper) => FormatArg::SelfUpper,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
use rustc_errors::Diagnostic;
use rustc_hir::attrs::diagnostic::Directive;
use rustc_session::lint::builtin::MISPLACED_DIAGNOSTIC_ATTRIBUTES;

use crate::attributes::diagnostic::*;
use crate::attributes::prelude::*;
use crate::errors::DiagnosticOnUnmatchArgsOnlyForMacros;

#[derive(Default)]
pub(crate) struct OnUnmatchArgsParser {
span: Option<Span>,
directive: Option<(Span, Directive)>,
}

impl<S: Stage> AttributeParser<S> for OnUnmatchArgsParser {
const ATTRIBUTES: AcceptMapping<Self, S> = &[(
&[sym::diagnostic, sym::on_unmatch_args],
template!(List: &[r#"/*opt*/ message = "...", /*opt*/ label = "...", /*opt*/ note = "...""#]),
|this, cx, args| {
if !cx.features().diagnostic_on_unmatch_args() {
return;
}

let span = cx.attr_span;
this.span = Some(span);

if !matches!(cx.target, Target::MacroDef) {
cx.emit_dyn_lint(
MISPLACED_DIAGNOSTIC_ATTRIBUTES,
move |dcx, level| DiagnosticOnUnmatchArgsOnlyForMacros.into_diag(dcx, level),
span,
);
return;
}

let mode = Mode::DiagnosticOnUnmatchArgs;
let Some(items) = parse_list(cx, args, mode) else { return };

let Some(directive) = parse_directive_items(cx, mode, items.mixed(), true) else {
return;
};
merge_directives(cx, &mut this.directive, (span, directive));
},
)];

const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(ALL_TARGETS);

fn finalize(self, _cx: &FinalizeContext<'_, '_, S>) -> Option<AttributeKind> {
if let Some(span) = self.span {
Some(AttributeKind::OnUnmatchArgs {
span,
directive: self.directive.map(|d| Box::new(d.1)),
})
} else {
None
}
}
}
2 changes: 2 additions & 0 deletions compiler/rustc_attr_parsing/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ use crate::attributes::diagnostic::on_const::*;
use crate::attributes::diagnostic::on_move::*;
use crate::attributes::diagnostic::on_unimplemented::*;
use crate::attributes::diagnostic::on_unknown::*;
use crate::attributes::diagnostic::on_unmatch_args::*;
use crate::attributes::doc::*;
use crate::attributes::dummy::*;
use crate::attributes::inline::*;
Expand Down Expand Up @@ -159,6 +160,7 @@ attribute_parsers!(
OnMoveParser,
OnUnimplementedParser,
OnUnknownParser,
OnUnmatchArgsParser,
RustcAlignParser,
RustcAlignStaticParser,
RustcCguTestAttributeParser,
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_attr_parsing/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,10 @@ pub(crate) struct DiagnosticOnUnknownOnlyForImports {
pub target_span: Span,
}

#[derive(Diagnostic)]
#[diag("`#[diagnostic::on_unmatch_args]` can only be applied to macro definitions")]
pub(crate) struct DiagnosticOnUnmatchArgsOnlyForMacros;

#[derive(Diagnostic)]
#[diag("`#[diagnostic::do_not_recommend]` can only be placed on trait implementations")]
pub(crate) struct IncorrectDoNotRecommendLocation {
Expand Down
29 changes: 13 additions & 16 deletions compiler/rustc_codegen_llvm/src/va_arg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf, TyAndLayout};
use rustc_target::spec::{Arch, Env, LlvmAbi, RustcAbi};

use crate::builder::Builder;
use crate::llvm::{Type, Value};
use crate::llvm::Value;
use crate::type_of::LayoutLlvmExt;

fn round_up_to_alignment<'ll>(
Expand All @@ -27,13 +27,14 @@ fn round_pointer_up_to_alignment<'ll>(
bx: &mut Builder<'_, 'll, '_>,
addr: &'ll Value,
align: Align,
ptr_ty: &'ll Type,
) -> &'ll Value {
let ptr = bx.inbounds_ptradd(addr, bx.const_i32(align.bytes() as i32 - 1));
let pointer_width = bx.tcx().sess.target.pointer_width;
let mask = align.bytes().wrapping_neg() & (u64::MAX >> (64 - pointer_width));
bx.call_intrinsic(
"llvm.ptrmask",
&[ptr_ty, bx.type_i32()],
&[ptr, bx.const_int(bx.isize_ty, -(align.bytes() as isize) as i64)],
&[bx.type_ptr(), bx.type_isize()],
&[ptr, bx.const_usize(mask)],
)
}

Expand All @@ -53,7 +54,7 @@ fn emit_direct_ptr_va_arg<'ll, 'tcx>(
let ptr = bx.load(va_list_ty, va_list_addr, ptr_align_abi);

let (addr, addr_align) = if allow_higher_align && align > slot_size {
(round_pointer_up_to_alignment(bx, ptr, align, bx.type_ptr()), align)
(round_pointer_up_to_alignment(bx, ptr, align), align)
} else {
(ptr, slot_size)
};
Expand All @@ -69,7 +70,8 @@ fn emit_direct_ptr_va_arg<'ll, 'tcx>(
{
let adjusted_size = bx.cx().const_i32((slot_size.bytes() - size.bytes()) as i32);
let adjusted = bx.inbounds_ptradd(addr, adjusted_size);
(adjusted, addr_align)
// We're in the middle of a slot now, so use the type's alignment, not the slot's.
(adjusted, align)
} else {
(addr, addr_align)
}
Expand Down Expand Up @@ -357,12 +359,8 @@ fn emit_powerpc_va_arg<'ll, 'tcx>(

// Round up address of argument to alignment
if layout.layout.align.abi > overflow_area_align {
overflow_area = round_pointer_up_to_alignment(
bx,
overflow_area,
layout.layout.align.abi,
bx.type_ptr(),
);
overflow_area =
round_pointer_up_to_alignment(bx, overflow_area, layout.layout.align.abi);
}

let mem_addr = overflow_area;
Expand Down Expand Up @@ -827,7 +825,7 @@ fn emit_hexagon_va_arg_musl<'ll, 'tcx>(
} else {
Align::from_bytes(4).unwrap()
};
let aligned_current = round_pointer_up_to_alignment(bx, current_ptr, arg_align, bx.type_ptr());
let aligned_current = round_pointer_up_to_alignment(bx, current_ptr, arg_align);

// Calculate next pointer position (following LLVM's logic)
// Arguments <= 32 bits take 4 bytes, > 32 bits take 8 bytes
Expand All @@ -849,8 +847,7 @@ fn emit_hexagon_va_arg_musl<'ll, 'tcx>(
bx.switch_to_block(from_overflow);

// Align overflow pointer using the same alignment rules
let aligned_overflow =
round_pointer_up_to_alignment(bx, overflow_ptr, arg_align, bx.type_ptr());
let aligned_overflow = round_pointer_up_to_alignment(bx, overflow_ptr, arg_align);

let overflow_value_addr = aligned_overflow;
// Update overflow pointer - use the same size calculation
Expand Down Expand Up @@ -890,7 +887,7 @@ fn emit_hexagon_va_arg_bare_metal<'ll, 'tcx>(
let aligned_ptr = if ty_align.bytes() > 4 {
// Ensure alignment is a power of 2
debug_assert!(ty_align.bytes().is_power_of_two(), "Alignment is not power of 2!");
round_pointer_up_to_alignment(bx, current_ptr, ty_align, bx.type_ptr())
round_pointer_up_to_alignment(bx, current_ptr, ty_align)
} else {
current_ptr
};
Expand Down
30 changes: 28 additions & 2 deletions compiler/rustc_expand/src/mbe/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::borrow::Cow;
use rustc_ast::token::{self, Token};
use rustc_ast::tokenstream::TokenStream;
use rustc_errors::{Applicability, Diag, DiagCtxtHandle, DiagMessage};
use rustc_hir::attrs::diagnostic::{CustomDiagnostic, Directive, FormatArgs};
use rustc_macros::Subdiagnostic;
use rustc_parse::parser::{Parser, Recovery, token_descr};
use rustc_session::parse::ParseSess;
Expand Down Expand Up @@ -32,6 +33,7 @@ pub(super) fn failed_to_match_macro(
args: FailedMacro<'_>,
body: &TokenStream,
rules: &[MacroRule],
on_unmatch_args: Option<&Directive>,
) -> (Span, ErrorGuaranteed) {
debug!("failed to match macro");
let def_head_span = if !def_span.is_dummy() && !psess.source_map().is_imported(def_span) {
Expand Down Expand Up @@ -72,9 +74,30 @@ pub(super) fn failed_to_match_macro(
};

let span = token.span.substitute_dummy(sp);
let CustomDiagnostic {
message: custom_message, label: custom_label, notes: custom_notes, ..
} = {
let macro_name = name.to_string();
on_unmatch_args
.map(|directive| {
directive.eval(
None,
&FormatArgs {
this: macro_name.clone(),
this_sugared: macro_name,
item_context: "macro invocation",
generic_args: Vec::new(),
},
)
})
.unwrap_or_default()
};

let mut err = psess.dcx().struct_span_err(span, parse_failure_msg(&token, None));
err.span_label(span, label);
let mut err = match custom_message {
Some(message) => psess.dcx().struct_span_err(span, message),
None => psess.dcx().struct_span_err(span, parse_failure_msg(&token, None)),
};
err.span_label(span, custom_label.unwrap_or_else(|| label.to_string()));
if !def_head_span.is_dummy() {
err.span_label(def_head_span, "when calling this macro");
}
Expand All @@ -86,6 +109,9 @@ pub(super) fn failed_to_match_macro(
} else {
err.note(format!("while trying to match {remaining_matcher}"));
}
for note in custom_notes {
err.note(note);
}

if let MatcherLoc::Token { token: expected_token } = &remaining_matcher
&& (matches!(expected_token.kind, token::OpenInvisible(_))
Expand Down
Loading
Loading