Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
e7d56c6
Add functions to `GrowableBitSet`.
Jarcho Jan 15, 2026
9729bb2
Add macro matcher for `guard` fragment specifier
SpriteOvO Mar 11, 2026
a197752
Add kernel-hwaddress sanitizer
Darksonn Feb 24, 2026
e41bbfa
Explain why __hwasan_tls is present in LLVM codegen
Darksonn Mar 6, 2026
ec03f4e
Adjust lifetime markers comment
Darksonn Mar 16, 2026
c679e3d
Simplify tests and fix test tidy issue
Darksonn Mar 17, 2026
adacd90
move many `ui/macros` tests from `run-` to `check-pass`
cyrgani Mar 19, 2026
9ce6863
merge `die-macro` tests into `panic-macro-basic.rs`
cyrgani Mar 19, 2026
ad79aa7
merge many repetitive `classes-*` tests
cyrgani Mar 20, 2026
0941e18
reformat merged files
cyrgani Mar 20, 2026
0486281
delete some tests that lost their meaning
cyrgani Mar 20, 2026
98a1441
merge several `tuple-struct-*` tests
cyrgani Mar 20, 2026
ff524fd
move many tests from `run-pass` to `check-pass`
cyrgani Mar 20, 2026
9677d7a
debuginfo: emit DW_TAG_call_site entries
resrever Mar 20, 2026
1223441
Constify `NonNull::with_exposed_provenance`
airblast-dev Mar 22, 2026
2e30fef
move statics test files out of tests/ui/issues
danieljofficial Mar 23, 2026
c0e6c76
interpret: when passing an argument fails, point at that argument
RalfJung Mar 23, 2026
af6324a
Fix typo in doc comment for `char::to_titlecase`
Jules-Bertholet Mar 24, 2026
5f68044
miri recursive checking: only check one layer deep
RalfJung Mar 23, 2026
422906d
Do not check for LEAK & KERNELHWADDRESS because they are incompatible
Darksonn Mar 24, 2026
4d86840
Document kernel-hwaddress in Unstable Book
Darksonn Mar 24, 2026
283d705
Update LLVM to 22.1.2
dianqk Mar 24, 2026
62ba3c1
Move ui/issues tests to relevant subdirectories
kyleecodes Mar 25, 2026
8ab0c4c
Remove unused `Erasable` impls.
nnethercote Mar 25, 2026
833bf3c
Sort `impl_erasable_*` macro calls.
nnethercote Mar 25, 2026
2899321
Avoid unnecessary qualification of `ErrorGuaranteed`.
nnethercote Mar 25, 2026
2fde4f4
Adjust some `Erasable` impls.
nnethercote Mar 25, 2026
efd36a4
Avoid 'static in `Erasable` impls.
nnethercote Mar 25, 2026
dce1805
Use `impl_erasable_for_simple_types!` more, and rename it.
nnethercote Mar 25, 2026
4f03262
Use `impl_erasable_for_types_with_no_type_params!` even more.
nnethercote Mar 25, 2026
735c3e4
Add const type ICE test
aerooneqq Mar 25, 2026
86aac98
install-template.sh: Optimize by using Bourne shell builtins.
he32 Mar 25, 2026
7cb28c9
fromrangeiter-overflow-checks: accept optional `signext` for argument
heiher Mar 25, 2026
11a338d
Fix nested zero-args delegation ICE
aerooneqq Mar 25, 2026
bca30d4
add issue link comments and bless
danieljofficial Mar 23, 2026
c2383b5
Don't propagate synthetic params, remove lifetime hacks
aerooneqq Mar 25, 2026
2a543ac
Moved and rename issue-50411 to tests/ui/mir/inliner-double-elaborate
aryannrd Mar 25, 2026
988633d
re-enable enzyme/autodiff builds on dist-aarch64-apple
ZuseZ4 Mar 25, 2026
01795c3
Init self_decl with a correct vis
mu001999 Mar 24, 2026
0cd8de3
Rollup merge of #153049 - Darksonn:kasan-sw-tags, r=fmease
JonathanBrouwer Mar 25, 2026
6e3c174
Rollup merge of #153702 - SpriteOvO:guard-matcher, r=davidtwco
JonathanBrouwer Mar 25, 2026
2f16030
Rollup merge of #154200 - resrever:enable-dwarf-call-sites, r=dingxia…
JonathanBrouwer Mar 25, 2026
27f9b7c
Rollup merge of #154263 - RalfJung:interpret-arg-passing-spans, r=oli…
JonathanBrouwer Mar 25, 2026
b5e4b4c
Rollup merge of #154269 - RalfJung:miri-recursive-shallow, r=saethlin
JonathanBrouwer Mar 25, 2026
85ddb8e
Rollup merge of #154313 - mu001999-contrib:fix/154295, r=petrochenkov
JonathanBrouwer Mar 25, 2026
d0fcb41
Rollup merge of #154344 - dianqk:update-llvm, r=nikic
JonathanBrouwer Mar 25, 2026
908fae7
Rollup merge of #154348 - ZuseZ4:autodiff-apple, r=Kobzol
JonathanBrouwer Mar 25, 2026
8dfc5ed
Rollup merge of #154351 - nnethercote:overhaul-Erasable-impls, r=petr…
JonathanBrouwer Mar 25, 2026
1459172
Rollup merge of #154363 - aerooneqq:nested-delegations, r=petrochenkov
JonathanBrouwer Mar 25, 2026
c13e9ec
Rollup merge of #154364 - aerooneqq:delegation-generics-small-fixes, …
JonathanBrouwer Mar 25, 2026
9974931
Rollup merge of #151148 - Jarcho:gbit_set, r=davidtwco
JonathanBrouwer Mar 25, 2026
047dee4
Rollup merge of #154090 - danieljofficial:move-tests-statics, r=Kivooeo
JonathanBrouwer Mar 25, 2026
a376772
Rollup merge of #154112 - cyrgani:macros-folder, r=Kivooeo
JonathanBrouwer Mar 25, 2026
7381bbb
Rollup merge of #154131 - cyrgani:structs-enums, r=Kivooeo
JonathanBrouwer Mar 25, 2026
4783d35
Rollup merge of #154216 - airblast-dev:main, r=tgross35
JonathanBrouwer Mar 25, 2026
8ae423e
Rollup merge of #154230 - aryannrd:issue-50411, r=Kivooeo
JonathanBrouwer Mar 25, 2026
4b9e655
Rollup merge of #154233 - kyleecodes:tests/reorg-ui-issues, r=Kivooeo
JonathanBrouwer Mar 25, 2026
bd919a0
Rollup merge of #154288 - Jules-Bertholet:patch-2, r=JohnTitor
JonathanBrouwer Mar 25, 2026
4e44345
Rollup merge of #154355 - aerooneqq:const-types-ices, r=petrochenkov
JonathanBrouwer Mar 25, 2026
796d52f
Rollup merge of #154358 - he32:installer-perf-fix-2, r=jieyouxu
JonathanBrouwer Mar 25, 2026
c026640
Rollup merge of #154360 - heiher:fromrangeiter-overflow-checks, r=jie…
JonathanBrouwer Mar 25, 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
16 changes: 14 additions & 2 deletions compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ pub enum PatKind {
Never,

/// A guard pattern (e.g., `x if guard(x)`).
Guard(Box<Pat>, Box<Expr>),
Guard(Box<Pat>, Box<Guard>),

/// Parentheses in patterns used for grouping (i.e., `(PAT)`).
Paren(Box<Pat>),
Expand Down Expand Up @@ -1346,7 +1346,7 @@ pub struct Arm {
/// Match arm pattern, e.g. `10` in `match foo { 10 => {}, _ => {} }`.
pub pat: Box<Pat>,
/// Match arm guard, e.g. `n > 10` in `match foo { n if n > 10 => {}, _ => {} }`.
pub guard: Option<Box<Expr>>,
pub guard: Option<Box<Guard>>,
/// Match arm body. Omitted if the pattern is a never pattern.
pub body: Option<Box<Expr>>,
pub span: Span,
Expand Down Expand Up @@ -3954,6 +3954,18 @@ impl ConstBlockItem {
pub const IDENT: Ident = Ident { name: kw::Underscore, span: DUMMY_SP };
}

#[derive(Clone, Encodable, Decodable, Debug, Walkable)]
pub struct Guard {
pub cond: Expr,
pub span_with_leading_if: Span,
}

impl Guard {
pub fn span(&self) -> Span {
self.cond.span
}
}

// Adding a new variant? Please update `test_item` in `tests/ui/macros/stringify.rs`.
#[derive(Clone, Encodable, Decodable, Debug)]
pub enum ItemKind {
Expand Down
5 changes: 5 additions & 0 deletions compiler/rustc_ast/src/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ pub enum MetaVarKind {
},
Path,
Vis,
Guard,
TT,
}

Expand All @@ -114,6 +115,7 @@ impl fmt::Display for MetaVarKind {
MetaVarKind::Meta { .. } => sym::meta,
MetaVarKind::Path => sym::path,
MetaVarKind::Vis => sym::vis,
MetaVarKind::Guard => sym::guard,
MetaVarKind::TT => sym::tt,
};
write!(f, "{sym}")
Expand Down Expand Up @@ -1124,6 +1126,7 @@ pub enum NonterminalKind {
Meta,
Path,
Vis,
Guard,
TT,
}

Expand Down Expand Up @@ -1161,6 +1164,7 @@ impl NonterminalKind {
sym::meta => NonterminalKind::Meta,
sym::path => NonterminalKind::Path,
sym::vis => NonterminalKind::Vis,
sym::guard => NonterminalKind::Guard,
sym::tt => NonterminalKind::TT,
_ => return None,
})
Expand All @@ -1182,6 +1186,7 @@ impl NonterminalKind {
NonterminalKind::Meta => sym::meta,
NonterminalKind::Path => sym::path,
NonterminalKind::Vis => sym::vis,
NonterminalKind::Guard => sym::guard,
NonterminalKind::TT => sym::tt,
}
}
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_ast/src/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ macro_rules! common_visitor_and_walkers {
FormatArguments,
FormatPlaceholder,
GenericParamKind,
Guard,
Impl,
ImplPolarity,
Inline,
Expand Down
11 changes: 11 additions & 0 deletions compiler/rustc_ast_lowering/src/delegation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,17 @@ impl<'hir, R: ResolverAstLoweringExt<'hir>> LoweringContext<'_, 'hir, R> {
args.push(arg);
}

// If we have no params in signature function but user still wrote some code in
// delegation body, then add this code as first arg, eventually an error will be shown,
// also nested delegations may need to access information about this code (#154332),
// so it is better to leave this code as opposed to bodies of extern functions,
// which are completely erased from existence.
if param_count == 0
&& let Some(block) = block
{
args.push(this.lower_target_expr(&block));
}

let final_expr = this.finalize_body_lowering(delegation, args, generics, span);

(this.arena.alloc_from_iter(parameters), final_expr)
Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_ast_lowering/src/delegation/generics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,6 @@ impl<'hir, R: ResolverAstLoweringExt<'hir>> LoweringContext<'_, 'hir, R> {
// HACK: for now we generate predicates such that all lifetimes are early bound,
// we can not not generate early-bound lifetimes, but we can't know which of them
// are late-bound at this level of compilation.
// FIXME(fn_delegation): proper support for late bound lifetimes.
let predicates =
self.arena.alloc_from_iter(params.iter().filter_map(|p| {
p.is_lifetime().then(|| self.generate_lifetime_predicate(p, span))
Expand Down Expand Up @@ -391,7 +390,7 @@ impl<'hir, R: ResolverAstLoweringExt<'hir>> LoweringContext<'_, 'hir, R> {
self.arena.alloc(hir::GenericArgs {
args: self.arena.alloc_from_iter(params.iter().filter_map(|p| {
// Skip self generic arg, we do not need to propagate it.
if p.name.ident().name == kw::SelfUpper {
if p.name.ident().name == kw::SelfUpper || p.is_impl_trait() {
return None;
}

Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_ast_lowering/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ impl<'hir, R: ResolverAstLoweringExt<'hir>> LoweringContext<'_, 'hir, R> {

fn lower_arm(&mut self, arm: &Arm) -> hir::Arm<'hir> {
let pat = self.lower_pat(&arm.pat);
let guard = arm.guard.as_ref().map(|cond| self.lower_expr(cond));
let guard = arm.guard.as_ref().map(|guard| self.lower_expr(&guard.cond));
let hir_id = self.next_id();
let span = self.lower_span(arm.span);
self.lower_attrs(hir_id, &arm.attrs, arm.span, Target::Arm);
Expand All @@ -663,7 +663,7 @@ impl<'hir, R: ResolverAstLoweringExt<'hir>> LoweringContext<'_, 'hir, R> {
} else if let Some(body) = &arm.body {
self.dcx().emit_err(NeverPatternWithBody { span: body.span });
} else if let Some(g) = &arm.guard {
self.dcx().emit_err(NeverPatternWithGuard { span: g.span });
self.dcx().emit_err(NeverPatternWithGuard { span: g.span() });
}

// We add a fake `loop {}` arm body so that it typecks to `!`. The mir lowering of never
Expand Down
7 changes: 5 additions & 2 deletions compiler/rustc_ast_lowering/src/pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,11 @@ impl<'hir, R: ResolverAstLoweringExt<'hir>> LoweringContext<'_, 'hir, R> {
self.lower_range_end(end, e2.is_some()),
);
}
PatKind::Guard(inner, cond) => {
break hir::PatKind::Guard(self.lower_pat(inner), self.lower_expr(cond));
PatKind::Guard(inner, guard) => {
break hir::PatKind::Guard(
self.lower_pat(inner),
self.lower_expr(&guard.cond),
);
}
PatKind::Slice(pats) => break self.lower_pat_slice(pats),
PatKind::Rest => {
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_ast_pretty/src/pprust/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1943,12 +1943,12 @@ impl<'a> State<'a> {
self.print_expr(e, FixupContext::default());
}
}
PatKind::Guard(subpat, condition) => {
PatKind::Guard(subpat, guard) => {
self.popen();
self.print_pat(subpat);
self.space();
self.word_space("if");
self.print_expr(condition, FixupContext::default());
self.print_expr(&guard.cond, FixupContext::default());
self.pclose();
}
PatKind::Slice(elts) => {
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_ast_pretty/src/pprust/state/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -891,9 +891,9 @@ impl<'a> State<'a> {
self.print_outer_attributes(&arm.attrs);
self.print_pat(&arm.pat);
self.space();
if let Some(e) = &arm.guard {
if let Some(guard) = &arm.guard {
self.word_space("if");
self.print_expr(e, FixupContext::default());
self.print_expr(&guard.cond, FixupContext::default());
self.space();
}

Expand Down
6 changes: 5 additions & 1 deletion compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,7 @@ impl<S: Stage> SingleAttributeParser<S> for SanitizeParser {
r#"kernel_address = "on|off""#,
r#"cfi = "on|off""#,
r#"hwaddress = "on|off""#,
r#"kernel_hwaddress = "on|off""#,
r#"kcfi = "on|off""#,
r#"memory = "on|off""#,
r#"memtag = "on|off""#,
Expand Down Expand Up @@ -648,7 +649,9 @@ impl<S: Stage> SingleAttributeParser<S> for SanitizeParser {
Some(sym::memtag) => apply(SanitizerSet::MEMTAG),
Some(sym::shadow_call_stack) => apply(SanitizerSet::SHADOWCALLSTACK),
Some(sym::thread) => apply(SanitizerSet::THREAD),
Some(sym::hwaddress) => apply(SanitizerSet::HWADDRESS),
Some(sym::hwaddress) | Some(sym::kernel_hwaddress) => {
apply(SanitizerSet::HWADDRESS | SanitizerSet::KERNELHWADDRESS)
}
Some(sym::realtime) => match value.value_as_str() {
Some(sym::nonblocking) => rtsan = Some(RtsanSetting::Nonblocking),
Some(sym::blocking) => rtsan = Some(RtsanSetting::Blocking),
Expand All @@ -673,6 +676,7 @@ impl<S: Stage> SingleAttributeParser<S> for SanitizeParser {
sym::shadow_call_stack,
sym::thread,
sym::hwaddress,
sym::kernel_hwaddress,
sym::realtime,
],
);
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_codegen_llvm/src/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ pub(crate) fn sanitize_attrs<'ll, 'tcx>(
if enabled.contains(SanitizerSet::THREAD) {
attrs.push(llvm::AttributeKind::SanitizeThread.create_attr(cx.llcx));
}
if enabled.contains(SanitizerSet::HWADDRESS) {
if enabled.contains(SanitizerSet::HWADDRESS) || enabled.contains(SanitizerSet::KERNELHWADDRESS)
{
attrs.push(llvm::AttributeKind::SanitizeHWAddress.create_attr(cx.llcx));
}
if enabled.contains(SanitizerSet::SHADOWCALLSTACK) {
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_codegen_llvm/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,10 @@ pub(crate) unsafe fn llvm_optimize(
sanitize_kernel_address_recover: config
.sanitizer_recover
.contains(SanitizerSet::KERNELADDRESS),
sanitize_kernel_hwaddress: config.sanitizer.contains(SanitizerSet::KERNELHWADDRESS),
sanitize_kernel_hwaddress_recover: config
.sanitizer_recover
.contains(SanitizerSet::KERNELHWADDRESS),
})
} else {
None
Expand Down
8 changes: 6 additions & 2 deletions compiler/rustc_codegen_llvm/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,14 @@ pub(crate) fn visibility_to_llvm(linkage: Visibility) -> llvm::Visibility {
}

pub(crate) fn set_variable_sanitizer_attrs(llval: &Value, attrs: &CodegenFnAttrs) {
if attrs.sanitizers.disabled.contains(SanitizerSet::ADDRESS) {
if attrs.sanitizers.disabled.contains(SanitizerSet::ADDRESS)
|| attrs.sanitizers.disabled.contains(SanitizerSet::KERNELADDRESS)
{
unsafe { llvm::LLVMRustSetNoSanitizeAddress(llval) };
}
if attrs.sanitizers.disabled.contains(SanitizerSet::HWADDRESS) {
if attrs.sanitizers.disabled.contains(SanitizerSet::HWADDRESS)
|| attrs.sanitizers.disabled.contains(SanitizerSet::KERNELHWADDRESS)
{
unsafe { llvm::LLVMRustSetNoSanitizeHWAddress(llval) };
}
}
7 changes: 5 additions & 2 deletions compiler/rustc_codegen_llvm/src/debuginfo/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ impl<'ll, 'tcx> DebugInfoCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
// FIXME(eddyb) does this need to be separate from `loc.line` for some reason?
let scope_line = loc.line;

let mut flags = DIFlags::FlagPrototyped;
let mut flags = DIFlags::FlagPrototyped | DIFlags::FlagAllCallsDescribed;

if fn_abi.ret.layout.is_uninhabited() {
flags |= DIFlags::FlagNoReturn;
Expand All @@ -494,6 +494,9 @@ impl<'ll, 'tcx> DebugInfoCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
// LLVM LTO can't unify type definitions when a child DIE is a full subprogram definition.
// When we use this `decl` below, the subprogram definition gets created at the CU level
// with a DW_AT_specification pointing back to the type's declaration.
// FlagAllCallsDescribed cannot appear on the method declaration DIE
// because it has no body, which LLVM's verifier rejects.
let decl_flags = flags & !DIFlags::FlagAllCallsDescribed;
let decl = is_method.then(|| unsafe {
llvm::LLVMRustDIBuilderCreateMethod(
DIB(self),
Expand All @@ -505,7 +508,7 @@ impl<'ll, 'tcx> DebugInfoCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
file_metadata,
loc.line,
function_type_metadata,
flags,
decl_flags,
spflags & !DISPFlags::SPFlagDefinition,
template_parameters,
)
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_codegen_llvm/src/llvm/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,8 @@ pub(crate) struct SanitizerOptions {
pub sanitize_hwaddress_recover: bool,
pub sanitize_kernel_address: bool,
pub sanitize_kernel_address_recover: bool,
pub sanitize_kernel_hwaddress: bool,
pub sanitize_kernel_hwaddress_recover: bool,
}

/// LLVMRustRelocModel
Expand Down Expand Up @@ -779,6 +781,7 @@ pub(crate) mod debuginfo {
const FlagNonTrivial = (1 << 26);
const FlagBigEndian = (1 << 27);
const FlagLittleEndian = (1 << 28);
const FlagAllCallsDescribed = (1 << 29);
}
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_const_eval/src/const_eval/eval_queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ fn eval_body_using_ecx<'tcx, R: InterpretationResult<'tcx>>(
&ret.clone().into(),
ReturnContinuation::Stop { cleanup: false },
)?;
ecx.storage_live_for_always_live_locals()?;
ecx.push_stack_frame_done()?;

// The main interpreter loop.
while ecx.step()? {
Expand Down
Loading
Loading