Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
deb901c
Use closures more consistently in `dep_graph.rs`.
nnethercote Mar 17, 2026
39f7cdb
update thin-vec
malezjaa Apr 8, 2026
b009e5f
remove try-normalize-use-tree
Shourya742 Apr 9, 2026
df98ac2
Fix rustfmt relative custom command
erfanio Apr 10, 2026
dacfa3c
fix: no complete term expressions on qualified path
A4-Tacks Apr 10, 2026
f1f6d56
fix: no imports on type anchor qualified path
A4-Tacks Apr 10, 2026
65bae63
Use create-github-app-token to get token for gen-lints
lnicola Apr 10, 2026
32c1e17
Merge pull request #22011 from lnicola/gen-lints-token
lnicola Apr 10, 2026
a816b21
Merge pull request #22002 from Shourya742/2026-04-09-remove-try-norma…
ChayimFriedman2 Apr 10, 2026
247651d
Bump create-github-app-token
lnicola Apr 10, 2026
9c7ad1a
Merge pull request #22013 from lnicola/bump-create-github-app-token
lnicola Apr 10, 2026
cdcd9b4
internal: update generated lints
workflows-rust-analyzer[bot] Apr 10, 2026
2629a77
Use last good clippy lints JSON in codegen
lnicola Apr 10, 2026
79758ac
Merge pull request #21998 from rust-lang/ci/gen-lints
lnicola Apr 10, 2026
198e4c4
Merge pull request #22010 from erfanio/rustfmt-fix
Veykril Apr 11, 2026
f9b6718
add regression test for OpenOptionsExt downstream compat
Vastargazing Apr 11, 2026
671b660
Parse `cfg_attr` and `cfg` specially
ChayimFriedman2 Apr 6, 2026
1b81c1d
Merge pull request #21965 from ChayimFriedman2/refactor-cfg-attr
ChayimFriedman2 Apr 11, 2026
fc2c72c
Make the expansion of guard metavars begin guard non-terminals
fmease Apr 12, 2026
8865266
Merge pull request #22012 from A4-Tacks/no-import-on-type-anchor-qual…
Veykril Apr 12, 2026
c0ad604
Merge pull request #22009 from A4-Tacks/no-expr-in-qualified
Veykril Apr 12, 2026
25a92d2
Add #![unstable_removed(..)] attribute to track removed features
Ozzy1423 Mar 3, 2026
ca6a851
cg_llvm: replace `sve_cast` with `simd_cast`
davidtwco Apr 10, 2026
62ffc89
cg_llvm: scalable vectors with `simd_select`
davidtwco Apr 10, 2026
791a3dc
Revert "Fix cycles during delayed lowering"
aerooneqq Apr 13, 2026
d283703
Add tests for ICEs when hir_crate_items executed before delayed lowering
aerooneqq Apr 13, 2026
51888a1
Support proper interaction of user-specified args and impl Traits
aerooneqq Apr 13, 2026
eb11900
add regression test for RTN assoc type restriction ICE
TaKO8Ki Apr 7, 2026
dbf8681
handle RTN projections in assoc type restriction diagnostics
TaKO8Ki Apr 7, 2026
205dd6f
reduce ICE reproducer
TaKO8Ki Apr 8, 2026
9339abb
move tests to associated-type-bounds/return-type-notation
TaKO8Ki Apr 13, 2026
23c6bc9
Rollup merge of #155227 - lnicola:sync-from-ra, r=lnicola
JonathanBrouwer Apr 13, 2026
d4037f7
Rollup merge of #153335 - Ozzy1423:removed-features, r=jdonszelmann
JonathanBrouwer Apr 13, 2026
7370657
Rollup merge of #154932 - TaKO8Ki:fix-152887-rtn-assoc-type-name, r=j…
JonathanBrouwer Apr 13, 2026
ab551b1
Rollup merge of #155096 - aerooneqq:delegation-user-specified-args-im…
JonathanBrouwer Apr 13, 2026
83a57ca
Rollup merge of #155106 - davidtwco:scalable-vector-more-simd-intrins…
JonathanBrouwer Apr 13, 2026
49f0536
Rollup merge of #155140 - Vastargazing:open-options-ext-test, r=jdons…
JonathanBrouwer Apr 13, 2026
49b5708
Rollup merge of #155182 - fmease:guard-exp-begins-guard, r=petrochenkov
JonathanBrouwer Apr 13, 2026
14b5df4
Rollup merge of #155226 - aerooneqq:delegation-hir-crate-items-revert…
JonathanBrouwer Apr 13, 2026
2f607ee
Rollup merge of #153997 - nnethercote:closure-consistency, r=petroche…
JonathanBrouwer Apr 13, 2026
f8a8c9e
Rollup merge of #155003 - malezjaa:update-thinvec, r=davidtwco
JonathanBrouwer Apr 13, 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
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5540,9 +5540,9 @@ dependencies = [

[[package]]
name = "thin-vec"
version = "0.2.14"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "144f754d318415ac792f9d69fc87abbbfc043ce2ef041c60f16ad828f638717d"
checksum = "da322882471314edc77fa5232c587bcb87c9df52bfd0d7d4826f8868ead61899"

[[package]]
name = "thiserror"
Expand Down
20 changes: 20 additions & 0 deletions compiler/rustc_abi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ use bitflags::bitflags;
#[cfg(feature = "nightly")]
use rustc_data_structures::stable_hasher::StableOrd;
#[cfg(feature = "nightly")]
use rustc_error_messages::{DiagArgValue, IntoDiagArg};
#[cfg(feature = "nightly")]
use rustc_errors::{Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, msg};
use rustc_hashes::Hash64;
use rustc_index::{Idx, IndexSlice, IndexVec};
Expand Down Expand Up @@ -1775,6 +1777,24 @@ impl NumScalableVectors {
}
}

#[cfg(feature = "nightly")]
impl IntoDiagArg for NumScalableVectors {
fn into_diag_arg(self, _: &mut Option<std::path::PathBuf>) -> DiagArgValue {
DiagArgValue::Str(std::borrow::Cow::Borrowed(match self.0 {
0 => panic!("`NumScalableVectors(0)` is illformed"),
1 => "one",
2 => "two",
3 => "three",
4 => "four",
5 => "five",
6 => "six",
7 => "seven",
8 => "eight",
_ => panic!("`NumScalableVectors(N)` for N>8 is illformed"),
}))
}
}

/// The way we represent values to the backend
///
/// Previously this was conflated with the "ABI" a type is given, as in the platform-specific ABI.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ rustc_macros = { path = "../rustc_macros" }
rustc_serialize = { path = "../rustc_serialize" }
rustc_span = { path = "../rustc_span" }
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
thin-vec = "0.2.12"
thin-vec = "0.2.15"
tracing = "0.1"
# tidy-alphabetical-end
2 changes: 1 addition & 1 deletion compiler/rustc_ast_lowering/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ rustc_session = { path = "../rustc_session" }
rustc_span = { path = "../rustc_span" }
rustc_target = { path = "../rustc_target" }
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
thin-vec = "0.2.12"
thin-vec = "0.2.15"
tracing = "0.1"
# tidy-alphabetical-end
1 change: 0 additions & 1 deletion compiler/rustc_ast_lowering/src/delegation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,6 @@ impl<'hir, R: ResolverAstLoweringExt<'hir>> LoweringContext<'_, 'hir, R> {
// 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.
// FIXME(fn_delegation): fix `help` in error message (see `inner-attr.stderr`)
if param_count == 0
&& let Some(block) = block
{
Expand Down
116 changes: 58 additions & 58 deletions compiler/rustc_ast_lowering/src/delegation/generics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,38 @@ use rustc_span::{Ident, Span};

use crate::{LoweringContext, ResolverAstLoweringExt};

pub(super) enum DelegationGenerics<T> {
#[derive(Clone, Copy)]
pub(super) enum DelegationGenericsKind {
/// User-specified args are present: `reuse foo::<String>;`.
UserSpecified,
/// The default case when no user-specified args are present: `reuse Trait::foo;`.
Default(T),
Default,
/// In free-to-trait reuse, when user specified args for trait `reuse Trait::<i32>::foo;`
/// in this case we need to both generate `Self` and process user args.
SelfAndUserSpecified(T),
SelfAndUserSpecified,
/// In delegations from trait impl to other entities like free functions or trait functions,
/// we want to generate a function whose generics matches generics of signature function
/// in trait.
TraitImpl(T, bool /* Has user-specified args */),
TraitImpl(bool /* Has user-specified args */),
}

pub(super) struct DelegationGenerics<T> {
generics: T,
kind: DelegationGenericsKind,
}

impl<'hir> DelegationGenerics<&'hir [ty::GenericParamDef]> {
fn default(generics: &'hir [ty::GenericParamDef]) -> Self {
DelegationGenerics { generics, kind: DelegationGenericsKind::Default }
}

fn user_specified(generics: &'hir [ty::GenericParamDef]) -> Self {
DelegationGenerics { generics, kind: DelegationGenericsKind::UserSpecified }
}

fn trait_impl(generics: &'hir [ty::GenericParamDef], user_specified: bool) -> Self {
DelegationGenerics { generics, kind: DelegationGenericsKind::TraitImpl(user_specified) }
}
}

/// Used for storing either ty generics or their uplifted HIR version. First we obtain
Expand Down Expand Up @@ -54,20 +74,19 @@ pub(super) struct GenericArgsPropagationDetails {
pub(super) use_args_in_sig_inheritance: bool,
}

impl<T> DelegationGenerics<T> {
fn args_propagation_details(&self) -> GenericArgsPropagationDetails {
impl DelegationGenericsKind {
fn args_propagation_details(self) -> GenericArgsPropagationDetails {
match self {
DelegationGenerics::UserSpecified | DelegationGenerics::SelfAndUserSpecified { .. } => {
GenericArgsPropagationDetails {
should_propagate: false,
use_args_in_sig_inheritance: true,
}
}
DelegationGenerics::TraitImpl(_, user_specified) => GenericArgsPropagationDetails {
should_propagate: !*user_specified,
DelegationGenericsKind::UserSpecified
| DelegationGenericsKind::SelfAndUserSpecified => GenericArgsPropagationDetails {
should_propagate: false,
use_args_in_sig_inheritance: true,
},
DelegationGenericsKind::TraitImpl(user_specified) => GenericArgsPropagationDetails {
should_propagate: !user_specified,
use_args_in_sig_inheritance: false,
},
DelegationGenerics::Default(_) => GenericArgsPropagationDetails {
DelegationGenericsKind::Default => GenericArgsPropagationDetails {
should_propagate: true,
use_args_in_sig_inheritance: false,
},
Expand All @@ -81,25 +100,9 @@ impl<'hir> HirOrTyGenerics<'hir> {
ctx: &mut LoweringContext<'_, 'hir, impl ResolverAstLoweringExt<'hir>>,
span: Span,
) -> &mut HirOrTyGenerics<'hir> {
if let HirOrTyGenerics::Ty(params) = self {
let mut uplift_params = |generics: &'hir [ty::GenericParamDef]| {
ctx.uplift_delegation_generic_params(span, generics)
};

let hir_generics = match params {
DelegationGenerics::UserSpecified => DelegationGenerics::UserSpecified,
DelegationGenerics::Default(params) => {
DelegationGenerics::Default(uplift_params(params))
}
DelegationGenerics::SelfAndUserSpecified(params) => {
DelegationGenerics::SelfAndUserSpecified(uplift_params(params))
}
DelegationGenerics::TraitImpl(params, user_specified) => {
DelegationGenerics::TraitImpl(uplift_params(params), *user_specified)
}
};

*self = HirOrTyGenerics::Hir(hir_generics);
if let HirOrTyGenerics::Ty(ty) = self {
let params = ctx.uplift_delegation_generic_params(span, ty.generics);
*self = HirOrTyGenerics::Hir(DelegationGenerics { generics: params, kind: ty.kind });
}

self
Expand All @@ -108,12 +111,7 @@ impl<'hir> HirOrTyGenerics<'hir> {
fn hir_generics_or_empty(&self) -> &'hir hir::Generics<'hir> {
match self {
HirOrTyGenerics::Ty(_) => hir::Generics::empty(),
HirOrTyGenerics::Hir(hir_generics) => match hir_generics {
DelegationGenerics::UserSpecified => hir::Generics::empty(),
DelegationGenerics::Default(generics)
| DelegationGenerics::SelfAndUserSpecified(generics)
| DelegationGenerics::TraitImpl(generics, _) => generics,
},
HirOrTyGenerics::Hir(hir) => hir.generics,
}
}

Expand All @@ -127,21 +125,16 @@ impl<'hir> HirOrTyGenerics<'hir> {
HirOrTyGenerics::Ty(_) => {
bug!("Attempting to get generic args before uplifting to HIR")
}
HirOrTyGenerics::Hir(hir_generics) => match hir_generics {
DelegationGenerics::UserSpecified => hir::GenericArgs::NONE,
DelegationGenerics::Default(generics)
| DelegationGenerics::SelfAndUserSpecified(generics)
| DelegationGenerics::TraitImpl(generics, _) => {
ctx.create_generics_args_from_params(generics.params, add_lifetimes, span)
}
},
HirOrTyGenerics::Hir(hir) => {
ctx.create_generics_args_from_params(hir.generics.params, add_lifetimes, span)
}
}
}

pub(super) fn args_propagation_details(&self) -> GenericArgsPropagationDetails {
match self {
HirOrTyGenerics::Ty(ty_generics) => ty_generics.args_propagation_details(),
HirOrTyGenerics::Hir(hir_generics) => hir_generics.args_propagation_details(),
HirOrTyGenerics::Ty(ty) => ty.kind.args_propagation_details(),
HirOrTyGenerics::Hir(hir) => hir.kind.args_propagation_details(),
}
}
}
Expand Down Expand Up @@ -231,9 +224,10 @@ impl<'hir, R: ResolverAstLoweringExt<'hir>> LoweringContext<'_, 'hir, R> {
if matches!(delegation_parent_kind, DefKind::Impl { of_trait: true }) {
// Considering parent generics, during signature inheritance
// we will take those args that are in trait impl header trait ref.
let parent = GenericsGenerationResult::new(DelegationGenerics::TraitImpl(&[], true));
let parent = DelegationGenerics::trait_impl(&[], true);
let parent = GenericsGenerationResult::new(parent);

let child = DelegationGenerics::TraitImpl(sig_params, child_user_specified);
let child = DelegationGenerics::trait_impl(sig_params, child_user_specified);
let child = GenericsGenerationResult::new(child);

return GenericsGenerationResults { parent, child };
Expand All @@ -257,22 +251,28 @@ impl<'hir, R: ResolverAstLoweringExt<'hir>> LoweringContext<'_, 'hir, R> {
if segments[len - 2].args.is_some() {
if generate_self {
// Take only first Self parameter, it is trait so Self must be present.
DelegationGenerics::SelfAndUserSpecified(&sig_parent_params[..1])
DelegationGenerics {
kind: DelegationGenericsKind::SelfAndUserSpecified,
generics: &sig_parent_params[..1],
}
} else {
DelegationGenerics::UserSpecified
DelegationGenerics::user_specified(&[])
}
} else {
let skip_self = usize::from(!generate_self);
DelegationGenerics::Default(&sig_parent_params[skip_self..])
DelegationGenerics::default(&sig_parent_params[skip_self..])
}
} else {
DelegationGenerics::<&'hir [ty::GenericParamDef]>::Default(&[])
DelegationGenerics::default(&[])
};

let child_generics = if child_user_specified {
DelegationGenerics::UserSpecified
let synth_params_index =
sig_params.iter().position(|p| p.kind.is_synthetic()).unwrap_or(sig_params.len());

DelegationGenerics::user_specified(&sig_params[synth_params_index..])
} else {
DelegationGenerics::Default(sig_params)
DelegationGenerics::default(sig_params)
};

GenericsGenerationResults {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast_lowering/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub(super) enum Owners<'a, 'hir> {
}

impl<'hir> Owners<'_, 'hir> {
pub(super) fn get_or_insert_mut(&mut self, def_id: LocalDefId) -> &mut hir::MaybeOwner<'hir> {
fn get_or_insert_mut(&mut self, def_id: LocalDefId) -> &mut hir::MaybeOwner<'hir> {
match self {
Owners::IndexVec(index_vec) => {
index_vec.ensure_contains_elem(def_id, || hir::MaybeOwner::Phantom)
Expand Down
27 changes: 5 additions & 22 deletions compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ use std::mem;
use std::sync::Arc;

use rustc_ast::node_id::NodeMap;
use rustc_ast::visit::AssocCtxt;
use rustc_ast::{self as ast, *};
use rustc_attr_parsing::{AttributeParser, Late, OmitDoc};
use rustc_data_structures::fingerprint::Fingerprint;
Expand Down Expand Up @@ -634,29 +633,13 @@ pub fn lower_to_hir(tcx: TyCtxt<'_>, (): ()) -> mid_hir::Crate<'_> {
let mut delayed_ids: FxIndexSet<LocalDefId> = Default::default();

for def_id in ast_index.indices() {
let delayed_owner_kind = match &ast_index[def_id] {
AstOwner::Item(Item { kind: ItemKind::Delegation(_), .. }) => {
Some(hir::DelayedOwnerKind::Item)
match &ast_index[def_id] {
AstOwner::Item(Item { kind: ItemKind::Delegation { .. }, .. })
| AstOwner::AssocItem(Item { kind: AssocItemKind::Delegation { .. }, .. }, _) => {
delayed_ids.insert(def_id);
}
AstOwner::AssocItem(Item { kind: AssocItemKind::Delegation(_), .. }, ctx) => {
Some(match ctx {
AssocCtxt::Trait => hir::DelayedOwnerKind::TraitItem,
AssocCtxt::Impl { .. } => hir::DelayedOwnerKind::ImplItem,
})
}
_ => None,
_ => lowerer.lower_node(def_id),
};

if let Some(kind) = delayed_owner_kind {
delayed_ids.insert(def_id);

let owner = lowerer.owners.get_or_insert_mut(def_id);
if let hir::MaybeOwner::Phantom = owner {
*owner = hir::MaybeOwner::Delayed(kind)
}
} else {
lowerer.lower_node(def_id);
}
}

// Don't hash unless necessary, because it's expensive.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast_passes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ rustc_macros = { path = "../rustc_macros" }
rustc_session = { path = "../rustc_session" }
rustc_span = { path = "../rustc_span" }
rustc_target = { path = "../rustc_target" }
thin-vec = "0.2.12"
thin-vec = "0.2.15"
# tidy-alphabetical-end
2 changes: 1 addition & 1 deletion compiler/rustc_ast_pretty/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ rustc_span = { path = "../rustc_span" }

[dev-dependencies]
# tidy-alphabetical-start
thin-vec = "0.2.12"
thin-vec = "0.2.15"
# tidy-alphabetical-end
2 changes: 1 addition & 1 deletion compiler/rustc_attr_parsing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ rustc_parse_format = { path = "../rustc_parse_format" }
rustc_session = { path = "../rustc_session" }
rustc_span = { path = "../rustc_span" }
rustc_target = { path = "../rustc_target" }
thin-vec = "0.2.12"
thin-vec = "0.2.15"
# tidy-alphabetical-end
Loading
Loading