Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
685984a
Merge two functions always called after each other
oli-obk May 11, 2026
ed8e3ba
Remove an unnecessary generic
oli-obk May 11, 2026
31a054c
Add a dedicated method for error lifetime recording
oli-obk May 12, 2026
d8cddda
Rename and document some methods
oli-obk May 26, 2026
bf5045c
Drop an unused distinction (in diagnostics code) between anonymous an…
oli-obk May 12, 2026
c0819ff
Remove some dead code
oli-obk May 12, 2026
87f9c4f
Remove an unused field
oli-obk May 12, 2026
19a5af7
extra_lifetime_params_map can only ever contain `LifetimeRes::Fresh`,…
oli-obk May 12, 2026
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
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
fade967
Give variables passed to Omp/Offload nice names on LLVM-IR level
ZuseZ4 Apr 4, 2026
c01bfdc
Enable requesting shared-memory at kernel launch-time via offload
ZuseZ4 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
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
22ae17b
Add the `clflushopt` x86 target feature
jlpetz May 29, 2026
0980491
Add feature-gate test for `clflushopt_target_feature`
jlpetz May 29, 2026
1c3a69a
Detect `clflushopt` in `is_x86_feature_detected!`
jlpetz May 29, 2026
2c0f9de
add ABI check logic for wasm
RalfJung May 29, 2026
7767295
Remove DefPathTable, use `LocalDefId` instead of `DefIndex` where pos…
aerooneqq May 29, 2026
7d9aab6
Update target maintainer for x86_64-unknown-linux-none
rosymati May 29, 2026
15b1398
resolve: Partially convert `ambiguous_glob_imports` lint into a hard …
petrochenkov Nov 21, 2025
f6cbfd9
rustc_public: add `with_cx()` to `CompilerInterface`
makai410 May 29, 2026
650106e
ast_lowering: Simplify `resolve_pin_drop_sugar_impl_item`
petrochenkov May 29, 2026
d17ce1d
Don't pass `target` into `check_target`
JonathanBrouwer May 29, 2026
4f2faec
Move `should_emit` check
JonathanBrouwer May 29, 2026
49775fb
Rollup merge of #149195 - petrochenkov:globamberr, r=mu001999
JonathanBrouwer May 29, 2026
e6541c4
Rollup merge of #156960 - oli-obk:push-rrmqnqvwtmsq, r=tiif
JonathanBrouwer May 29, 2026
b8d9ef8
Rollup merge of #156963 - aerooneqq:defs-refactoring, r=petrochenkov
JonathanBrouwer May 29, 2026
e5f76d4
Rollup merge of #157053 - oli-obk:delegation-resolution-late, r=petro…
JonathanBrouwer May 29, 2026
0357abe
Rollup merge of #157068 - kjetilkjeka:remove-ptx-linker-flavor, r=pet…
JonathanBrouwer May 29, 2026
2ae7dbd
Rollup merge of #157076 - bjorn3:proc_macro_refactors4, r=petrochenkov
JonathanBrouwer May 29, 2026
e2df185
Rollup merge of #157106 - RalfJung:wasm-abi, r=alexcrichton
JonathanBrouwer May 29, 2026
cbc3a2e
Rollup merge of #154835 - ZuseZ4:offload-sharedmem, r=oli-obk
JonathanBrouwer May 29, 2026
71999fb
Rollup merge of #157065 - ChrisDenton:stable-path-is-empty, r=joboet
JonathanBrouwer May 29, 2026
46359a5
Rollup merge of #157088 - ariagivens:deprecated-attr-forms, r=Jonatha…
JonathanBrouwer May 29, 2026
d6201c9
Rollup merge of #157098 - jlpetz:clflushopt-target-feature, r=folkertdev
JonathanBrouwer May 29, 2026
35516e3
Rollup merge of #157103 - zetanumbers:update_failing_parallel_tests_1…
JonathanBrouwer May 29, 2026
0164b8b
Rollup merge of #157111 - rosymati:fix/linux-none-mantainer, r=joboet
JonathanBrouwer May 29, 2026
75223c5
Rollup merge of #157116 - makai410:with-tcx-refactor, r=oli-obk
JonathanBrouwer May 29, 2026
d1cd77e
Rollup merge of #157119 - petrochenkov:dropin, r=mejrs
JonathanBrouwer May 29, 2026
82471b6
Rollup merge of #157120 - JonathanBrouwer:repr-target-checking, r=mejrs
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
76 changes: 33 additions & 43 deletions compiler/rustc_ast_lowering/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1192,50 +1192,34 @@ impl<'hir> LoweringContext<'_, 'hir> {
})
}

fn resolve_pin_drop_sugar_impl_item(
fn check_pin_drop_sugar_impl_item(
&self,
i: &AssocItem,
ident: Ident,
span: Span,
) -> (Ident, Result<DefId, ErrorGuaranteed>) {
let trait_item_def_id = self
.get_partial_res(i.id)
.and_then(|r| r.expect_full_res().opt_def_id())
.ok_or_else(|| {
self.dcx().span_delayed_bug(span, "could not resolve trait item being implemented")
});

let is_pin_drop_sugar = match &i.kind {
AssocItemKind::Fn(fn_kind) => fn_kind.is_pin_drop_sugar(),
_ => false,
};
let def_id = match trait_item_def_id {
Ok(def_id) => def_id,
Err(guar) => return (ident, Err(guar)),
};
if !is_pin_drop_sugar {
return (ident, Ok(def_id));
}

let is_drop_pin_drop = self
.tcx
.lang_items()
.drop_trait()
.is_some_and(|drop_trait| self.tcx.parent(def_id) == drop_trait);
if is_drop_pin_drop {
// Associated item collection still derives the impl item's name from HIR.
return (Ident::new(sym::pin_drop, ident.span), Ok(def_id));
trait_item: Result<DefId, ErrorGuaranteed>,
) -> Ident {
if let AssocItemKind::Fn(fn_kind) = &i.kind
&& fn_kind.is_pin_drop_sugar()
{
if let Ok(trait_item) = trait_item
&& self
.tcx
.lang_items()
.drop_trait()
.is_none_or(|drop_trait| self.tcx.parent(trait_item) != drop_trait)
{
self.dcx()
.struct_span_err(
i.span,
"method `drop` with `&pin mut self` is only supported for the `Drop` trait",
)
.with_span_label(i.span, "not a `Drop::pin_drop` implementation")
.emit();
}
return Ident::new(sym::pin_drop, ident.span);
}

let guar = self
.dcx()
.struct_span_err(
i.span,
"method `drop` with `&pin mut self` is only supported for the `Drop` trait",
)
.with_span_label(i.span, "not a `Drop::pin_drop` implementation")
.emit();
(ident, Err(guar))
ident
}

fn lower_impl_item(
Expand Down Expand Up @@ -1356,8 +1340,14 @@ impl<'hir> LoweringContext<'_, 'hir> {

let span = self.lower_span(i.span);
let (effective_ident, impl_kind) = if is_in_trait_impl {
let (effective_ident, trait_item_def_id) =
self.resolve_pin_drop_sugar_impl_item(i, ident, span);
let trait_item_def_id = self
.get_partial_res(i.id)
.and_then(|r| r.expect_full_res().opt_def_id())
.ok_or_else(|| {
self.dcx()
.span_delayed_bug(span, "could not resolve trait item being implemented")
});
let effective_ident = self.check_pin_drop_sugar_impl_item(i, ident, trait_item_def_id);
(effective_ident, ImplItemImplKind::Trait { defaultness, trait_item_def_id })
} else {
(ident, ImplItemImplKind::Inherent { vis_span: self.lower_span(i.vis.span) })
Expand Down Expand Up @@ -1928,11 +1918,11 @@ impl<'hir> LoweringContext<'_, 'hir> {

// Introduce extra lifetimes if late resolution tells us to.
let extra_lifetimes = self.resolver.extra_lifetime_params(parent_node_id);
params.extend(extra_lifetimes.into_iter().filter_map(|&(ident, node_id, res)| {
params.extend(extra_lifetimes.into_iter().map(|&(ident, node_id, kind)| {
self.lifetime_res_to_generic_param(
ident,
node_id,
res,
kind,
hir::GenericParamSource::Generics,
)
}));
Expand Down
49 changes: 18 additions & 31 deletions compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ use rustc_hir::definitions::PerParentDisambiguatorState;
use rustc_hir::lints::DelayedLint;
use rustc_hir::{
self as hir, AngleBrackets, ConstArg, GenericArg, HirId, ItemLocalMap, LifetimeSource,
LifetimeSyntax, ParamName, Target, TraitCandidate, find_attr,
LifetimeSyntax, MissingLifetimeKind, ParamName, Target, TraitCandidate, find_attr,
};
use rustc_index::{Idx, IndexSlice, IndexVec};
use rustc_macros::extension;
Expand Down Expand Up @@ -310,7 +310,7 @@ impl<'tcx> ResolverAstLowering<'tcx> {
///
/// The extra lifetimes that appear from the parenthesized `Fn`-trait desugaring
/// should appear at the enclosing `PolyTraitRef`.
fn extra_lifetime_params(&self, id: NodeId) -> &[(Ident, NodeId, LifetimeRes)] {
fn extra_lifetime_params(&self, id: NodeId) -> &[(Ident, NodeId, MissingLifetimeKind)] {
self.extra_lifetime_params_map.get(&id).map_or(&[], |v| &v[..])
}

Expand Down Expand Up @@ -542,7 +542,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 @@ -948,43 +948,30 @@ impl<'hir> LoweringContext<'_, 'hir> {
&mut self,
ident: Ident,
node_id: NodeId,
res: LifetimeRes,
kind: MissingLifetimeKind,
source: hir::GenericParamSource,
) -> Option<hir::GenericParam<'hir>> {
let (name, kind) = match res {
LifetimeRes::Param { .. } => {
(hir::ParamName::Plain(ident), hir::LifetimeParamKind::Explicit)
}
LifetimeRes::Fresh { param, kind, .. } => {
// Late resolution delegates to us the creation of the `LocalDefId`.
let _def_id = self.create_def(
param,
Some(kw::UnderscoreLifetime),
DefKind::LifetimeParam,
ident.span,
);
debug!(?_def_id);
) -> hir::GenericParam<'hir> {
// Late resolution delegates to us the creation of the `LocalDefId`.
let _def_id = self.create_def(
node_id,
Some(kw::UnderscoreLifetime),
DefKind::LifetimeParam,
ident.span,
);
debug!(?_def_id);

(hir::ParamName::Fresh, hir::LifetimeParamKind::Elided(kind))
}
LifetimeRes::Static { .. } | LifetimeRes::Error(..) => return None,
res => panic!(
"Unexpected lifetime resolution {:?} for {:?} at {:?}",
res, ident, ident.span
),
};
let hir_id = self.lower_node_id(node_id);
let def_id = self.local_def_id(node_id);
Some(hir::GenericParam {
hir::GenericParam {
hir_id,
def_id,
name,
name: hir::ParamName::Fresh,
span: self.lower_span(ident.span),
pure_wrt_drop: false,
kind: hir::GenericParamKind::Lifetime { kind },
kind: hir::GenericParamKind::Lifetime { kind: hir::LifetimeParamKind::Elided(kind) },
colon_span: None,
source,
})
}
}

/// Lowers a lifetime binder that defines `generic_params`, returning the corresponding HIR
Expand All @@ -1005,7 +992,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
debug!(?extra_lifetimes);
let extra_lifetimes: Vec<_> = extra_lifetimes
.iter()
.filter_map(|&(ident, node_id, res)| {
.map(|&(ident, node_id, res)| {
self.lifetime_res_to_generic_param(
ident,
node_id,
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: 1 addition & 3 deletions compiler/rustc_attr_parsing/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,9 +412,7 @@ impl<'sess> AttributeParser<'sess> {
(accept.accept_fn)(&mut cx, &args);
finalizers.push(accept.finalizer);

if !matches!(cx.should_emit, ShouldEmit::Nothing) {
Self::check_target(&accept.allowed_targets, target, &mut cx);
}
Self::check_target(&accept.allowed_targets, &mut cx);
} else {
let attr = AttrItem {
path: attr_path.clone(),
Expand Down
Loading
Loading