Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
c8aba3e
Stabilize Path::is_empty
ChrisDenton May 28, 2026
420566f
Remove a hack introduced back when unwinding through extern "C" was UB
bjorn3 May 28, 2026
32615f2
Implement Encode and Decode for proc_macro::TokenStream wrapper type
bjorn3 May 28, 2026
8f53ae3
Remove `skip_arg` attribute from `Diagnostic` and `Subdiagnostic` pro…
GuillaumeGomez May 28, 2026
14b45f0
Remove `#[skip_arg]` references from rustc-dev-guide
GuillaumeGomez May 28, 2026
53b4acd
Remove outdated comment
bjorn3 May 28, 2026
5c56e61
Remove unused proc_macro table from crate metadata
bjorn3 May 28, 2026
bde798a
Use platform independent encoding for integers in proc-macro RPC
bjorn3 May 28, 2026
d31c731
Move handle counters to the server side
bjorn3 May 28, 2026
a1d4ad1
Suggest using NameValue syntax for malformed deprecated attribute
ariagivens May 28, 2026
9bfbf34
Suggest using since field when malformed deprecated attribute value i…
ariagivens May 28, 2026
942ac85
Eagerly resolve delegations in late resolution
oli-obk May 28, 2026
335a667
Use default field values to avoid some churn
oli-obk May 29, 2026
74ad9d3
Track `lifetime_elision_allowed` per owner, and discard fn ptr and `F…
oli-obk May 27, 2026
87c7663
Track `label_res_map` per-owner
oli-obk May 28, 2026
b69baba
Track `lifetimes_res_map` per owner
oli-obk May 28, 2026
f582193
Update reproducibly failing tests when parallel frontend is enabled
zetanumbers May 29, 2026
ec46eac
NVPTX: Remove the deprecated ptx linker flavor
kjetilkjeka May 28, 2026
7767295
Remove DefPathTable, use `LocalDefId` instead of `DefIndex` where pos…
aerooneqq May 29, 2026
b0afc00
Rollup merge of #156963 - aerooneqq:defs-refactoring, r=petrochenkov
JonathanBrouwer May 29, 2026
13725bd
Rollup merge of #157053 - oli-obk:delegation-resolution-late, r=petro…
JonathanBrouwer May 29, 2026
72a509f
Rollup merge of #157068 - kjetilkjeka:remove-ptx-linker-flavor, r=pet…
JonathanBrouwer May 29, 2026
60481a5
Rollup merge of #157076 - bjorn3:proc_macro_refactors4, r=petrochenkov
JonathanBrouwer May 29, 2026
b72bbf8
Rollup merge of #157100 - oli-obk:some_more_per_owner_things, r=petro…
JonathanBrouwer May 29, 2026
0834925
Rollup merge of #157065 - ChrisDenton:stable-path-is-empty, r=joboet
JonathanBrouwer May 29, 2026
04b6367
Rollup merge of #157070 - GuillaumeGomez:rm-skip_arg, r=JonathanBrouwer
JonathanBrouwer May 29, 2026
d35ba7f
Rollup merge of #157088 - ariagivens:deprecated-attr-forms, r=Jonatha…
JonathanBrouwer May 29, 2026
f45cd5a
Rollup merge of #157103 - zetanumbers:update_failing_parallel_tests_1…
JonathanBrouwer May 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
22 changes: 6 additions & 16 deletions compiler/rustc_ast_lowering/src/delegation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
// Delegation can be unresolved in illegal places such as function bodies in extern blocks (see #151356)
let sig_id = if let Some(delegation_info) = self.resolver.delegation_info(self.owner.def_id)
{
self.get_sig_id(delegation_info.resolution_node, span)
self.get_sig_id(delegation_info.resolution_id, span)
} else {
self.dcx().span_delayed_bug(
span,
Expand Down Expand Up @@ -230,22 +230,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
.collect::<Vec<_>>()
}

fn get_sig_id(&self, mut node_id: NodeId, span: Span) -> Result<DefId, ErrorGuaranteed> {
let mut visited: FxHashSet<NodeId> = Default::default();
fn get_sig_id(&self, mut def_id: DefId, span: Span) -> Result<DefId, ErrorGuaranteed> {
let mut visited: FxHashSet<DefId> = Default::default();
let mut path: SmallVec<[DefId; 1]> = Default::default();

loop {
visited.insert(node_id);

let Some(def_id) = self.get_resolution_id(node_id) else {
return Err(self.tcx.dcx().span_delayed_bug(
span,
format!(
"LoweringContext: couldn't resolve node {:?} in delegation item",
node_id
),
));
};
visited.insert(def_id);

path.push(def_id);

Expand All @@ -255,8 +245,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
if let Some(local_id) = def_id.as_local()
&& let Some(delegation_info) = self.resolver.delegation_info(local_id)
{
node_id = delegation_info.resolution_node;
if visited.contains(&node_id) {
def_id = delegation_info.resolution_id;
if visited.contains(&def_id) {
// We encountered a cycle in the resolution, or delegation callee refers to non-existent
// entity, in this case emit an error.
return Err(match visited.len() {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast_lowering/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1549,7 +1549,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
fn lower_loop_destination(&mut self, destination: Option<(NodeId, Label)>) -> hir::Destination {
let target_id = match destination {
Some((id, _)) => {
if let Some(loop_id) = self.resolver.get_label_res(id) {
if let Some(loop_id) = self.owner.get_label_res(id) {
let local_id = self.ident_and_label_to_local_id[&loop_id];
let loop_hir_id = HirId { owner: self.current_hir_id_owner, local_id };
Ok(loop_hir_id)
Expand Down
37 changes: 12 additions & 25 deletions compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,16 +293,6 @@ impl<'tcx> ResolverAstLowering<'tcx> {
self.import_res_map.get(&id).copied().unwrap_or_default()
}

/// Obtains resolution for a label with the given `NodeId`.
fn get_label_res(&self, id: NodeId) -> Option<NodeId> {
self.label_res_map.get(&id).copied()
}

/// Obtains resolution for a lifetime with the given `NodeId`.
fn get_lifetime_res(&self, id: NodeId) -> Option<LifetimeRes> {
self.lifetimes_res_map.get(&id).copied()
}

/// Obtain the list of lifetimes parameters to add to an item.
///
/// Extra lifetime parameters should only be added in places that can appear
Expand All @@ -321,10 +311,6 @@ impl<'tcx> ResolverAstLowering<'tcx> {
fn owner_def_id(&self, id: NodeId) -> LocalDefId {
self.owners[&id].def_id
}

fn lifetime_elision_allowed(&self, id: NodeId) -> bool {
self.lifetime_elision_allowed.contains(&id)
}
}

/// How relaxed bounds `?Trait` should be treated.
Expand Down Expand Up @@ -542,7 +528,7 @@ pub fn lower_to_hir(tcx: TyCtxt<'_>, (): ()) -> mid_hir::Crate<'_> {
let ast_index = index_crate(&resolver, &krate);
let mut owners = IndexVec::from_fn_n(
|_| hir::MaybeOwner::Phantom,
tcx.definitions_untracked().def_index_count(),
tcx.definitions_untracked().num_definitions(),
);

let mut lowerer = item::ItemLowerer {
Expand Down Expand Up @@ -1625,7 +1611,7 @@ impl<'hir> LoweringContext<'_, 'hir> {

None => {
let id = if let Some(LifetimeRes::ElidedAnchor { start, end }) =
self.resolver.get_lifetime_res(t.id)
self.owner.get_lifetime_res(t.id)
{
assert_eq!(start.plus(1), end);
start
Expand Down Expand Up @@ -1866,7 +1852,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
_ => hir::ImplicitSelfKind::None,
}
}))
.set_lifetime_elision_allowed(self.resolver.lifetime_elision_allowed(fn_node_id))
.set_lifetime_elision_allowed(
self.owner.id == fn_node_id && self.owner.lifetime_elision_allowed,
)
.set_c_variadic(c_variadic);

self.arena.alloc(hir::FnDecl { inputs, output, fn_decl_kind })
Expand Down Expand Up @@ -2032,7 +2020,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
source: LifetimeSource,
syntax: LifetimeSyntax,
) -> &'hir hir::Lifetime {
let res = if let Some(res) = self.resolver.get_lifetime_res(id) {
let res = if let Some(res) = self.owner.get_lifetime_res(id) {
match res {
LifetimeRes::Param { param, .. } => hir::LifetimeKind::Param(param),
LifetimeRes::Fresh { param, .. } => {
Expand Down Expand Up @@ -2118,13 +2106,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
// AST resolution emitted an error on those parameters, so we lower them using
// `ParamName::Error`.
let ident = self.lower_ident(param.ident);
let param_name = if let Some(LifetimeRes::Error(..)) =
self.resolver.get_lifetime_res(param.id)
{
ParamName::Error(ident)
} else {
ParamName::Plain(ident)
};
let param_name =
if let Some(LifetimeRes::Error(..)) = self.owner.get_lifetime_res(param.id) {
ParamName::Error(ident)
} else {
ParamName::Plain(ident)
};
let kind =
hir::GenericParamKind::Lifetime { kind: hir::LifetimeParamKind::Explicit };

Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_ast_lowering/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use super::errors::{
};
use super::{
AllowReturnTypeNotation, GenericArgsCtor, GenericArgsMode, ImplTraitContext, ImplTraitPosition,
LifetimeRes, LoweringContext, ParamMode, ResolverAstLoweringExt,
LifetimeRes, LoweringContext, ParamMode,
};

impl<'hir> LoweringContext<'_, 'hir> {
Expand Down Expand Up @@ -422,7 +422,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
segment_ident_span: Span,
generic_args: &mut GenericArgsCtor<'hir>,
) {
let (start, end) = match self.resolver.get_lifetime_res(segment_id) {
let (start, end) = match self.owner.get_lifetime_res(segment_id) {
Some(LifetimeRes::ElidedAnchor { start, end }) => (start, end),
None => return,
Some(res) => {
Expand Down
60 changes: 50 additions & 10 deletions compiler/rustc_attr_parsing/src/attributes/deprecation.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use rustc_ast::LitKind;
use rustc_hir::attrs::{DeprecatedSince, Deprecation};
use rustc_hir::{RustcVersion, VERSION_PLACEHOLDER};

Expand Down Expand Up @@ -76,6 +77,38 @@ impl SingleAttributeParser for DeprecatedParser {
// ok
}
ArgParser::List(list) => {
// If the argument list contains a single string literal:
// check whether it may be a version and suggest since field
// otherwise, suggest using NameValue syntax
if let Some(elem) = list.as_single()
&& let Some(lit) = elem.as_lit()
&& let LitKind::Str(text, _) = lit.kind
{
let mut adcx = cx.adcx();

match parse_since(text, true) {
DeprecatedSince::Future | DeprecatedSince::RustcVersion(_) => {
adcx.push_suggestion(
String::from("try specifying a deprecated since version"),
elem.span(),
format!("since = {}", lit.kind),
);
}
_ => {
if let Some(span) = args.span() {
adcx.push_suggestion(
String::from("try using `=` instead"),
span,
format!(" = {}", lit.kind),
);
}
}
};

adcx.expected_not_literal(elem.span());
return None;
}

for param in list.mixed() {
let Some(param) = param.meta_item() else {
cx.adcx().expected_not_literal(param.span());
Expand Down Expand Up @@ -133,18 +166,11 @@ impl SingleAttributeParser for DeprecatedParser {
}

let since = if let Some(since) = since {
if since.as_str() == "TBD" {
DeprecatedSince::Future
} else if !is_rustc {
DeprecatedSince::NonStandard(since)
} else if since.as_str() == VERSION_PLACEHOLDER {
DeprecatedSince::RustcVersion(RustcVersion::CURRENT)
} else if let Some(version) = parse_version(since) {
DeprecatedSince::RustcVersion(version)
} else {
let since = parse_since(since, is_rustc);
if matches!(since, DeprecatedSince::Err) {
cx.emit_err(InvalidSince { span: cx.attr_span });
DeprecatedSince::Err
}
since
} else if is_rustc {
cx.emit_err(MissingSince { span: cx.attr_span });
DeprecatedSince::Err
Expand All @@ -163,3 +189,17 @@ impl SingleAttributeParser for DeprecatedParser {
})
}
}

fn parse_since(since: Symbol, is_rustc: bool) -> DeprecatedSince {
if since.as_str() == "TBD" {
DeprecatedSince::Future
} else if !is_rustc {
DeprecatedSince::NonStandard(since)
} else if since.as_str() == VERSION_PLACEHOLDER {
DeprecatedSince::RustcVersion(RustcVersion::CURRENT)
} else if let Some(version) = parse_version(since) {
DeprecatedSince::RustcVersion(version)
} else {
DeprecatedSince::Err
}
}
4 changes: 0 additions & 4 deletions compiler/rustc_codegen_ssa/src/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1530,7 +1530,6 @@ pub fn linker_and_flavor(sess: &Session) -> (PathBuf, LinkerFlavor) {
}
LinkerFlavor::Bpf => "bpf-linker",
LinkerFlavor::Llbc => "llvm-bitcode-linker",
LinkerFlavor::Ptx => "rust-ptx-linker",
}),
flavor,
)),
Expand Down Expand Up @@ -1571,7 +1570,6 @@ pub fn linker_and_flavor(sess: &Session) -> (PathBuf, LinkerFlavor) {
let linker_flavor = match sess.opts.cg.linker_flavor {
// The linker flavors that are non-target specific can be directly translated to LinkerFlavor
Some(LinkerFlavorCli::Llbc) => Some(LinkerFlavor::Llbc),
Some(LinkerFlavorCli::Ptx) => Some(LinkerFlavor::Ptx),
// The linker flavors that corresponds to targets needs logic that keeps the base LinkerFlavor
linker_flavor => {
linker_flavor.map(|flavor| sess.target.linker_flavor.with_cli_hints(flavor))
Expand Down Expand Up @@ -2764,8 +2762,6 @@ fn add_order_independent_options(
if crate_info.target_features.len() > 0 {
cmd.link_arg(&format!("--target-feature={}", &crate_info.target_features.join(",")));
}
} else if flavor == LinkerFlavor::Ptx {
cmd.link_args(&["--fallback-arch", &crate_info.target_cpu]);
} else if flavor == LinkerFlavor::Bpf {
cmd.link_args(&["--cpu", &crate_info.target_cpu]);
if let Some(feat) = [sess.opts.cg.target_feature.as_str(), &sess.target.options.features]
Expand Down
79 changes: 0 additions & 79 deletions compiler/rustc_codegen_ssa/src/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ pub(crate) fn get_linker<'a>(
LinkerFlavor::EmCc => Box::new(EmLinker { cmd, sess }) as Box<dyn Linker>,
LinkerFlavor::Bpf => Box::new(BpfLinker { cmd, sess }) as Box<dyn Linker>,
LinkerFlavor::Llbc => Box::new(LlbcLinker { cmd, sess }) as Box<dyn Linker>,
LinkerFlavor::Ptx => Box::new(PtxLinker { cmd, sess }) as Box<dyn Linker>,
}
}

Expand Down Expand Up @@ -283,7 +282,6 @@ generate_arg_methods! {
L4Bender<'_>
AixLinker<'_>
LlbcLinker<'_>
PtxLinker<'_>
BpfLinker<'_>
dyn Linker + '_
}
Expand Down Expand Up @@ -1920,83 +1918,6 @@ pub(crate) fn linked_symbols(
symbols
}

/// Much simplified and explicit CLI for the NVPTX linker. The linker operates
/// with bitcode and uses LLVM backend to generate a PTX assembly.
struct PtxLinker<'a> {
cmd: Command,
sess: &'a Session,
}

impl<'a> Linker for PtxLinker<'a> {
fn cmd(&mut self) -> &mut Command {
&mut self.cmd
}

fn set_output_kind(
&mut self,
_output_kind: LinkOutputKind,
_crate_type: CrateType,
_out_filename: &Path,
) {
}

fn link_staticlib_by_name(&mut self, _name: &str, _verbatim: bool, _whole_archive: bool) {
panic!("staticlibs not supported")
}

fn link_staticlib_by_path(&mut self, path: &Path, _whole_archive: bool) {
self.link_arg("--rlib").link_arg(path);
}

fn debuginfo(&mut self, _strip: Strip, _: &[PathBuf]) {
self.link_arg("--debug");
}

fn add_object(&mut self, path: &Path) {
self.link_arg("--bitcode").link_arg(path);
}

fn optimize(&mut self) {
match self.sess.lto() {
Lto::Thin | Lto::Fat | Lto::ThinLocal => {
self.link_arg("-Olto");
}

Lto::No => {}
}
}

fn full_relro(&mut self) {}

fn partial_relro(&mut self) {}

fn no_relro(&mut self) {}

fn gc_sections(&mut self, _keep_metadata: bool) {}

fn pgo_gen(&mut self) {}

fn no_crt_objects(&mut self) {}

fn no_default_libraries(&mut self) {}

fn control_flow_guard(&mut self) {}

fn ehcont_guard(&mut self) {}

fn export_symbols(
&mut self,
_tmpdir: &Path,
_crate_type: CrateType,
_symbols: &[(String, SymbolExportKind)],
) {
}

fn windows_subsystem(&mut self, _subsystem: WindowsSubsystemKind) {}

fn linker_plugin_lto(&mut self) {}
}

/// The `self-contained` LLVM bitcode linker
struct LlbcLinker<'a> {
cmd: Command,
Expand Down
9 changes: 4 additions & 5 deletions compiler/rustc_const_eval/src/const_eval/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -844,14 +844,13 @@ impl<'tcx> interpret::Machine<'tcx> for CompileTimeMachine<'tcx> {
// current number of evaluated terminators is a power of 2. The latter gives us a cheap
// way to implement exponential backoff.
let span = ecx.cur_span();
let mut warn =
ecx.tcx.dcx().create_warn(LongRunningWarn { span, item_span: ecx.tcx.span });
// We store a unique number in `force_duplicate` to evade `-Z deduplicate-diagnostics`.
// `new_steps` is guaranteed to be unique because `ecx.machine.num_evaluated_steps` is
// always increasing.
ecx.tcx.dcx().emit_warn(LongRunningWarn {
span,
item_span: ecx.tcx.span,
force_duplicate: new_steps,
});
warn.arg("force_duplicate", new_steps);
warn.emit();
}
}

Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_const_eval/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,6 @@ pub(crate) struct LongRunningWarn {
pub span: Span,
#[help("the constant being evaluated")]
pub item_span: Span,
// Used for evading `-Z deduplicate-diagnostics`.
pub force_duplicate: usize,
}

#[derive(Subdiagnostic)]
Expand Down
Loading
Loading