Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
9363038
bootstrap: fix RUSTFLAGS with spaces in paths via CARGO_ENCODED_RUSTF…
Rohan-Singla Jun 18, 2026
63d3395
bootstrap: also use CARGO_ENCODED_RUSTDOCFLAGS to support spaces in…
Rohan-Singla Jun 18, 2026
386748b
⏺ bootstrap: reset CARGO_ENCODED_RUSTFLAGS in Miri test runner
Rohan-Singla Jun 18, 2026
8085cd3
bootstrap: use \x1f-delimited String for Rustflags instead of Vec<Str…
Rohan-Singla Jun 18, 2026
b4a7c3e
unset RUSTFLAGS/RUSTDOCFLAGS when setting encoded forms
Rohan-Singla Jun 21, 2026
2d10922
add regression test for cfg_eval derive reparse recovery
TaKO8Ki Jun 25, 2026
14e5371
avoid ICE when cfg_eval reparse recovers no annotatable
TaKO8Ki Jun 25, 2026
f31f522
Support DefKind::InlineConst in UnevaluatedConst
khyperia Jun 27, 2026
9aaea56
Recover deferred closure calls after errors
Dnreikronos Jun 27, 2026
a89705b
Avoid panics bubbling out to proc macros
Mark-Simulacrum Jun 22, 2026
bd938c5
Include default-stability info in rustdoc JSON.
obi1kenobi Jun 27, 2026
7f2574f
Move attribute and keyword docs from `std` to `core`
jschillem Jun 28, 2026
1a7439c
Fix `flag_if_supported` in `cc-rs` by configuring an `out_dir`
Kobzol Jun 20, 2026
f832372
Slightly refactor cc code
Kobzol Jun 20, 2026
ae0fb27
Add missing zlib library to `x86_64-gnu-distcheck`
Kobzol Jun 20, 2026
65f0657
Add `compress-debuginfo` option to bootstrap and fix debuginfo compre…
Kobzol Jun 21, 2026
10c2c9d
Enable debuginfo compression by default in dist builds
Kobzol Jun 21, 2026
cca8cd1
Use doctest attribute `ignore-wasm` instead of manual `cfg_attr`
fmease Jun 29, 2026
96f3774
Record step creation locations in bootstrap tracing DOT graph
Kobzol Jun 29, 2026
e6dc840
Add a few `#[track_caller]` annotations to make tracing locations mor…
Kobzol Jun 29, 2026
ee4ea97
Better record locations of executed steps
Kobzol Jun 29, 2026
69f0187
Avoid building rustdoc for tests without doctests
chenyukang Jun 27, 2026
c340e8a
Allow section override when using patchable-function-entries
pmur Jun 3, 2026
91a762b
Inline information of whether this segment is delegation's child segm…
aerooneqq Jun 29, 2026
7aa52a3
Rollup merge of #158073 - Rohan-Singla:fix/#158052, r=kobzol,mark-sim…
jhpratt Jun 29, 2026
4a270d7
Rollup merge of #158169 - Kobzol:fix-cc-rs-flag-if-supported, r=jieyo…
jhpratt Jun 29, 2026
2706411
Rollup merge of #158256 - Mark-Simulacrum:no-panic-pm-parsing, r=bjorn3
jhpratt Jun 29, 2026
4c2b08f
Rollup merge of #158375 - khyperia:inline-consts-in-type-system, r=Bo…
jhpratt Jun 29, 2026
230848d
Rollup merge of #158417 - TaKO8Ki:fix-cfg-eval-derive-reparse-ice, r=…
jhpratt Jun 29, 2026
f6d6cd5
Rollup merge of #158556 - aerooneqq:delegation-child-segment-perf, r=…
jhpratt Jun 29, 2026
5e4eaaa
Rollup merge of #158561 - chenyukang:yukang-fix-158299-core-tests-rus…
jhpratt Jun 29, 2026
1e18b73
Rollup merge of #158562 - Kobzol:bootstrap-tracing-step-caller, r=jie…
jhpratt Jun 29, 2026
50576bc
Rollup merge of #157445 - pmur:murp/extend-patchable, r=mejrs
jhpratt Jun 29, 2026
b73a172
Rollup merge of #158081 - Dnreikronos:trait_system/deferred_closure_r…
jhpratt Jun 29, 2026
2e0ce69
Rollup merge of #158327 - jschillem:docs-move-attributes-and-keywords…
jhpratt Jun 29, 2026
1621f46
Rollup merge of #158468 - obi1kenobi:pg/default-body-stability, r=Gui…
jhpratt Jun 29, 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
14 changes: 14 additions & 0 deletions bootstrap.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,13 @@
# FIXME(#61117): Some tests fail when this option is enabled.
#rust.debuginfo-level-tests = 0

# Compress debuginfo of Rust and C/C++ code.
# Valid options:
# - "off" or false: disable compression
# - true: compress debuginfo with the default compression method (currently zlib)
# - "zlib": compress debuginfo with zlib
#rust.compress-debuginfo = "off"

# Should rustc and the standard library be built with split debuginfo? Default
# is platform dependent.
#
Expand Down Expand Up @@ -1019,6 +1026,13 @@
# and enabling it causes issues.
#split-debuginfo = if linux || windows-gnu { off } else if windows-msvc { packed } else if apple { unpacked }

# Compress debuginfo for Rust and C/C++ code of this target.
# Valid options:
# - "off" or false: disable compression
# - true: compress debuginfo with the default compression method (currently zlib)
# - "zlib": compress debuginfo with zlib
#compress-debuginfo = "off"

# Path to the `llvm-config` binary of the installation of a custom LLVM to link
# against. Note that if this is specified we don't compile LLVM at all for this
# target.
Expand Down
7 changes: 6 additions & 1 deletion compiler/rustc_ast_lowering/src/delegation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ use rustc_span::def_id::{DefId, LocalDefId};
use rustc_span::symbol::kw;
use rustc_span::{ErrorGuaranteed, Ident, Span, Symbol};

use crate::delegation::generics::{GenericsGenerationResult, GenericsGenerationResults};
use crate::delegation::generics::{
GenericsGenerationResult, GenericsGenerationResults, GenericsPosition,
};
use crate::diagnostics::{
CycleInDelegationSignatureResolution, DelegationAttemptedBlockWithDefsDeletion,
DelegationBlockSpecifiedWhenNoParams, UnresolvedDelegationCallee,
Expand Down Expand Up @@ -505,6 +507,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
res: Res::Local(param_id),
args: None,
infer_args: false,
delegation_child_segment: false,
}));

let path = self.arena.alloc(hir::Path { span, res: Res::Local(param_id), segments });
Expand Down Expand Up @@ -714,6 +717,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
result.args_segment_id = segment.hir_id;
result.use_for_sig_inheritance = !result.generics.is_trait_impl();

segment.delegation_child_segment = result.generics.pos() == GenericsPosition::Child;

segment
}

Expand Down
12 changes: 10 additions & 2 deletions compiler/rustc_ast_lowering/src/delegation/generics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use rustc_span::{Ident, Span, sym};
use crate::LoweringContext;
use crate::diagnostics::DelegationInfersMismatch;

#[derive(Debug, Clone, Copy)]
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub(super) enum GenericsPosition {
Parent,
Child,
Expand Down Expand Up @@ -155,7 +155,7 @@ impl<'hir> DelegationGenericArgsIterator<'hir> {
impl<'hir> HirOrTyGenerics<'hir> {
pub(super) fn into_hir_generics(&mut self, ctx: &mut LoweringContext<'_, 'hir>, span: Span) {
if let HirOrTyGenerics::Ty(ty) = self {
let rename_self = matches!(ty.pos, GenericsPosition::Child);
let rename_self = ty.pos == GenericsPosition::Child;
let params = ctx.uplift_delegation_generic_params(span, &ty.data, rename_self);

*self = HirOrTyGenerics::Hir(DelegationGenerics {
Expand Down Expand Up @@ -218,6 +218,13 @@ impl<'hir> HirOrTyGenerics<'hir> {
.expect("`Self` generic param is not found while expected"),
}
}

pub(crate) fn pos(&self) -> GenericsPosition {
match self {
HirOrTyGenerics::Ty(ty) => ty.pos,
HirOrTyGenerics::Hir(hir) => hir.pos,
}
}
}

impl<'hir> GenericsGenerationResult<'hir> {
Expand Down Expand Up @@ -590,6 +597,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
ident: p.name.ident(),
infer_args: false,
res,
delegation_child_segment: false,
}]),
res,
span: p.span,
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1014,6 +1014,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
res,
args,
infer_args: args.is_none(),
delegation_child_segment: false,
}]),
})
}
Expand Down Expand Up @@ -2791,7 +2792,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
}
ExprKind::ConstBlock(anon_const) => {
let def_id = self.local_def_id(anon_const.id);
assert_eq!(DefKind::AnonConst, self.tcx.def_kind(def_id));
assert_eq!(DefKind::InlineConst, self.tcx.def_kind(def_id));
self.lower_anon_const_to_const_arg(anon_const, span)
}
_ => overly_complex_const(self),
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_ast_lowering/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
} else {
Some(generic_args.into_generic_args(self))
},
delegation_child_segment: false,
}
}

Expand Down
62 changes: 37 additions & 25 deletions compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ use rustc_span::edition::Edition::Edition2024;
use super::prelude::*;
use crate::attributes::AttributeSafety;
use crate::session_diagnostics::{
EmptyExportName, NakedFunctionIncompatibleAttribute, NullOnExport, NullOnObjcClass,
NullOnObjcSelector, ObjcClassExpectedStringLiteral, ObjcSelectorExpectedStringLiteral,
SanitizeInvalidStatic, TargetFeatureOnLangItem,
EmptyExportName, EmptySection, NakedFunctionIncompatibleAttribute, NullOnExport,
NullOnObjcClass, NullOnObjcSelector, NullOnSection, ObjcClassExpectedStringLiteral,
ObjcSelectorExpectedStringLiteral, SanitizeInvalidStatic, TargetFeatureOnLangItem,
};
use crate::target_checking::Policy::AllowSilent;

Expand Down Expand Up @@ -795,82 +795,94 @@ pub(crate) struct PatchableFunctionEntryParser;
impl SingleAttributeParser for PatchableFunctionEntryParser {
const PATH: &[Symbol] = &[sym::patchable_function_entry];
const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[Allow(Target::Fn)]);
const TEMPLATE: AttributeTemplate = template!(List: &["prefix_nops = m, entry_nops = n"]);
const TEMPLATE: AttributeTemplate =
template!(List: &["prefix_nops = m, entry_nops = n, section = \"section\""]);
const STABILITY: AttributeStability = unstable!(patchable_function_entry);

fn convert(cx: &mut AcceptContext<'_, '_>, args: &ArgParser) -> Option<AttributeKind> {
let meta_item_list = cx.expect_list(args, cx.attr_span)?;

let mut prefix = None;
let mut entry = None;
let mut section = None;

if meta_item_list.len() == 0 {
cx.adcx().expected_at_least_one_argument(meta_item_list.span);
return None;
}

let mut errored = false;

for item in meta_item_list.mixed() {
let Some((ident, value)) = cx.expect_name_value(item, item.span(), None) else {
continue;
return None;
};

let attrib_to_write = match ident.name {
sym::prefix_nops => {
// Duplicate prefixes are not allowed
if prefix.is_some() {
errored = true;
cx.adcx().duplicate_key(ident.span, sym::prefix_nops);
continue;
return None;
}
&mut prefix
}
sym::entry_nops => {
// Duplicate entries are not allowed
if entry.is_some() {
errored = true;
cx.adcx().duplicate_key(ident.span, sym::entry_nops);
continue;
return None;
}
&mut entry
}
sym::section => {
// Duplicate entries are not allowed
if section.is_some() {
cx.adcx().duplicate_key(ident.span, sym::section);
return None;
}
// Only a string type value is allowed.
let Some(value_str) = value.value_as_str() else {
cx.adcx().expect_string_literal(value);
return None;
};
// The section name does not allow null characters.
if value_str.as_str().contains('\0') {
cx.emit_err(NullOnSection { span: value.value_span });
}
// The section name is not allowed to be empty, LLVM does
// not allow them.
if value_str.is_empty() {
cx.emit_err(EmptySection { span: value.value_span });
}
section = Some(value_str);
// Integer parsing is not needed, process next item.
continue;
}
_ => {
errored = true;
cx.adcx().expected_specific_argument(
ident.span,
&[sym::prefix_nops, sym::entry_nops],
);
continue;
return None;
}
};

let rustc_ast::LitKind::Int(val, _) = value.value_as_lit().kind else {
errored = true;
cx.adcx().expected_integer_literal(value.value_span);
continue;
return None;
};

let Ok(val) = val.get().try_into() else {
errored = true;
cx.adcx().expected_integer_literal_in_range(
value.value_span,
u8::MIN as isize,
u8::MAX as isize,
);
continue;
return None;
};

*attrib_to_write = Some(val);
}

if errored {
None
} else {
Some(AttributeKind::PatchableFunctionEntry {
prefix: prefix.unwrap_or(0),
entry: entry.unwrap_or(0),
})
}
Some(AttributeKind::PatchableFunctionEntry { prefix, entry, section })
}
}
14 changes: 14 additions & 0 deletions compiler/rustc_attr_parsing/src/session_diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,13 @@ pub(crate) struct EmptyExportName {
pub span: Span,
}

#[derive(Diagnostic)]
#[diag("`section` may not be empty")]
pub(crate) struct EmptySection {
#[primary_span]
pub span: Span,
}

#[derive(Diagnostic)]
#[diag("`export_name` may not contain null characters", code = E0648)]
pub(crate) struct NullOnExport {
Expand Down Expand Up @@ -327,6 +334,13 @@ pub(crate) struct NullOnObjcSelector {
pub span: Span,
}

#[derive(Diagnostic)]
#[diag("`section` may not contain null characters", code = E0648)]
pub(crate) struct NullOnSection {
#[primary_span]
pub span: Span,
}

#[derive(Diagnostic)]
#[diag("`objc::class!` expected a string literal")]
pub(crate) struct ObjcClassExpectedStringLiteral {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/universal_regions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {

BodyOwnerKind::Const { .. } | BodyOwnerKind::Static(..) => {
match tcx.def_kind(self.mir_def) {
DefKind::InlineConst => {
DefKind::InlineConst if !tcx.is_type_system_inline_const(self.mir_def) => {
// This is required for `AscribeUserType` canonical query, which will call
// `type_of(inline_const_def_id)`. That `type_of` would inject erased lifetimes
// into borrowck, which is ICE #78174.
Expand Down
45 changes: 23 additions & 22 deletions compiler/rustc_builtin_macros/src/cfg_eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,41 +107,42 @@ impl CfgEval<'_> {
// our attribute target will correctly configure the tokens as well.
let mut parser = Parser::new(&self.0.sess.psess, orig_tokens, None);
parser.capture_cfg = true;
let res: PResult<'_, Annotatable> = try {
match annotatable {
Annotatable::Item(_) => {
let item =
parser.parse_item(ForceCollect::Yes, AllowConstBlockItems::Yes)?.unwrap();
Annotatable::Item(self.flat_map_item(item).pop().unwrap())
}
let res: PResult<'_, Option<Annotatable>> = try {
match &annotatable {
Annotatable::Item(_) => parser
.parse_item(ForceCollect::Yes, AllowConstBlockItems::Yes)?
.and_then(|item| self.flat_map_item(item).pop().map(Annotatable::Item)),
Annotatable::AssocItem(_, ctxt) => {
let item = parser.parse_trait_item(ForceCollect::Yes)?.unwrap().unwrap();
Annotatable::AssocItem(
self.flat_map_assoc_item(item, ctxt).pop().unwrap(),
ctxt,
)
parser.parse_trait_item(ForceCollect::Yes)?.flatten().and_then(|item| {
self.flat_map_assoc_item(item, *ctxt)
.pop()
.map(|item| Annotatable::AssocItem(item, *ctxt))
})
}
Annotatable::ForeignItem(_) => {
let item = parser.parse_foreign_item(ForceCollect::Yes)?.unwrap().unwrap();
Annotatable::ForeignItem(self.flat_map_foreign_item(item).pop().unwrap())
}
Annotatable::Stmt(_) => {
let stmt = parser
.parse_stmt_without_recovery(false, ForceCollect::Yes, false)?
.unwrap();
Annotatable::Stmt(Box::new(self.flat_map_stmt(stmt).pop().unwrap()))
parser.parse_foreign_item(ForceCollect::Yes)?.flatten().and_then(|item| {
self.flat_map_foreign_item(item).pop().map(Annotatable::ForeignItem)
})
}
Annotatable::Stmt(_) => parser
.parse_stmt_without_recovery(false, ForceCollect::Yes, false)?
.and_then(|stmt| {
self.flat_map_stmt(stmt).pop().map(|stmt| Annotatable::Stmt(Box::new(stmt)))
}),
Annotatable::Expr(_) => {
let mut expr = parser.parse_expr_force_collect()?;
self.visit_expr(&mut expr);
Annotatable::Expr(expr)
Some(Annotatable::Expr(expr))
}
_ => unreachable!(),
}
};

match res {
Ok(ann) => ann,
Ok(Some(ann)) => ann,
// Parser recovery may emit errors without reconstructing an annotatable.
// Keep the original node so cfg-eval stays best-effort instead of ICEing.
Ok(None) => annotatable,
Err(err) => {
err.emit();
annotatable
Expand Down
32 changes: 27 additions & 5 deletions compiler/rustc_codegen_llvm/src/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,26 @@ fn patchable_function_entry_attrs<'ll>(
attr: Option<PatchableFunctionEntry>,
) -> SmallVec<[&'ll Attribute; 2]> {
let mut attrs = SmallVec::new();
let patchable_spec = attr.unwrap_or_else(|| {
PatchableFunctionEntry::from_config(sess.opts.unstable_opts.patchable_function_entry)
});
let entry = patchable_spec.entry();
let prefix = patchable_spec.prefix();

let mut entry = sess.opts.unstable_opts.patchable_function_entry.entry();
let mut prefix = sess.opts.unstable_opts.patchable_function_entry.prefix();
let mut section = sess.opts.unstable_opts.patchable_function_entry.section();
let section_sym;

// Apply attribute specified overrides, if any.
if let Some(patchable_spec) = attr {
if let Some(sym) = patchable_spec.section() {
section_sym = sym;
section = Some(section_sym.as_str());
}
// Override the nop counts if either is present. If only one is present, the
// other count is implied to be 0.
if patchable_spec.entry().is_some() || patchable_spec.prefix().is_some() {
entry = patchable_spec.entry().unwrap_or(0);
prefix = patchable_spec.prefix().unwrap_or(0);
}
}

if entry > 0 {
attrs.push(llvm::CreateAttrStringValue(
cx.llcx,
Expand All @@ -105,6 +120,13 @@ fn patchable_function_entry_attrs<'ll>(
&format!("{}", prefix),
));
}
if let Some(section) = section {
attrs.push(llvm::CreateAttrStringValue(
cx.llcx,
"patchable-function-entry-section",
section,
));
}
attrs
}

Expand Down
Loading
Loading