Skip to content

Rollup of 8 pull requests #141824

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
May 31, 2025
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
31ee840
Add ui test func-pointer-issue-140491
xizheyin May 8, 2025
d43c2e7
distcheck: document what distcheck is intended to exercise
jieyouxu May 27, 2025
f8887aa
Reorder fields in `hir::ItemKind` variants.
nnethercote May 28, 2025
aa3009d
Reorder hir fn stuff.
nnethercote May 29, 2025
ca1c67a
Update `compiler-builtins` to 0.1.160
tgross35 May 6, 2025
17352e6
Note ref expr being cast when encounter NonScalar cast error
xizheyin May 9, 2025
7e9aee7
Enable non-leaf Frame Pointers for mingw-w64 Arm64 Windows
mati865 May 15, 2025
98961cd
Fix incorrect comment
mati865 Apr 27, 2025
7eea11b
Fix C++ standard library name for *-windows-gnullvm targets
mati865 May 6, 2025
885184a
Shared libLLVM linking is officially supported with MinGW and Clang
mati865 May 6, 2025
3cba746
std: note that `std::str::from_utf8*` functions are aliases to `std::…
xizheyin May 17, 2025
afc6424
cleaned up some tests
Kivooeo May 30, 2025
05debb0
Rollup merge of #140787 - xizheyin:issue-140491, r=nnethercote
matthiaskrgr May 31, 2025
a2bf37e
Rollup merge of #141112 - xizheyin:issue-141079, r=Mark-Simulacrum
matthiaskrgr May 31, 2025
ec39208
Rollup merge of #141646 - jieyouxu:distcheck, r=Mark-Simulacrum
matthiaskrgr May 31, 2025
387170c
Rollup merge of #141740 - nnethercote:hir-ItemKind-field-order, r=fee…
matthiaskrgr May 31, 2025
282c665
Rollup merge of #141793 - Kivooeo:test-reform, r=jieyouxu
matthiaskrgr May 31, 2025
04641b1
Rollup merge of #141805 - tgross35:update-builtins, r=tgross35
matthiaskrgr May 31, 2025
0254c67
Rollup merge of #141815 - mati865:mingw-aarch64-frame-pointers, r=wor…
matthiaskrgr May 31, 2025
23cc24e
Rollup merge of #141819 - mati865:windows-gnullvm-host-fixes, r=jieyouxu
matthiaskrgr May 31, 2025
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
2 changes: 1 addition & 1 deletion compiler/rustc_ast_lowering/src/index.rs
Original file line number Diff line number Diff line change
@@ -164,7 +164,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
fn visit_item(&mut self, i: &'hir Item<'hir>) {
debug_assert_eq!(i.owner_id, self.owner);
self.with_parent(i.hir_id(), |this| {
if let ItemKind::Struct(_, struct_def, _) = &i.kind {
if let ItemKind::Struct(_, _, struct_def) = &i.kind {
// If this is a tuple or unit-like struct, register the constructor.
if let Some(ctor_hir_id) = struct_def.ctor_hir_id() {
this.insert(i.span, ctor_hir_id, Node::Ctor(struct_def));
14 changes: 7 additions & 7 deletions compiler/rustc_ast_lowering/src/item.rs
Original file line number Diff line number Diff line change
@@ -180,7 +180,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
let (ty, body_id) =
self.lower_const_item(t, span, e.as_deref(), ImplTraitPosition::StaticTy);
self.lower_define_opaque(hir_id, define_opaque);
hir::ItemKind::Static(ident, ty, *m, body_id)
hir::ItemKind::Static(*m, ident, ty, body_id)
}
ItemKind::Const(box ast::ConstItem {
ident,
@@ -200,7 +200,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
},
);
self.lower_define_opaque(hir_id, &define_opaque);
hir::ItemKind::Const(ident, ty, generics, body_id)
hir::ItemKind::Const(ident, generics, ty, body_id)
}
ItemKind::Fn(box Fn {
sig: FnSig { decl, header, span: fn_sig_span },
@@ -304,7 +304,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
),
},
);
hir::ItemKind::TyAlias(ident, ty, generics)
hir::ItemKind::TyAlias(ident, generics, ty)
}
ItemKind::Enum(ident, generics, enum_definition) => {
let ident = self.lower_ident(*ident);
@@ -318,7 +318,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
)
},
);
hir::ItemKind::Enum(ident, hir::EnumDef { variants }, generics)
hir::ItemKind::Enum(ident, generics, hir::EnumDef { variants })
}
ItemKind::Struct(ident, generics, struct_def) => {
let ident = self.lower_ident(*ident);
@@ -328,7 +328,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
ImplTraitContext::Disallowed(ImplTraitPosition::Generic),
|this| this.lower_variant_data(hir_id, struct_def),
);
hir::ItemKind::Struct(ident, struct_def, generics)
hir::ItemKind::Struct(ident, generics, struct_def)
}
ItemKind::Union(ident, generics, vdata) => {
let ident = self.lower_ident(*ident);
@@ -338,7 +338,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
ImplTraitContext::Disallowed(ImplTraitPosition::Generic),
|this| this.lower_variant_data(hir_id, vdata),
);
hir::ItemKind::Union(ident, vdata, generics)
hir::ItemKind::Union(ident, generics, vdata)
}
ItemKind::Impl(box Impl {
safety,
@@ -467,8 +467,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
ItemKind::Delegation(box delegation) => {
let delegation_results = self.lower_delegation(delegation, id, false);
hir::ItemKind::Fn {
ident: delegation_results.ident,
sig: delegation_results.sig,
ident: delegation_results.ident,
generics: delegation_results.generics,
body: delegation_results.body_id,
has_body: true,
58 changes: 29 additions & 29 deletions compiler/rustc_hir/src/hir.rs
Original file line number Diff line number Diff line change
@@ -4106,11 +4106,11 @@ impl<'hir> Item<'hir> {

expect_use, (&'hir UsePath<'hir>, UseKind), ItemKind::Use(p, uk), (p, *uk);

expect_static, (Ident, &'hir Ty<'hir>, Mutability, BodyId),
ItemKind::Static(ident, ty, mutbl, body), (*ident, ty, *mutbl, *body);
expect_static, (Mutability, Ident, &'hir Ty<'hir>, BodyId),
ItemKind::Static(mutbl, ident, ty, body), (*mutbl, *ident, ty, *body);

expect_const, (Ident, &'hir Ty<'hir>, &'hir Generics<'hir>, BodyId),
ItemKind::Const(ident, ty, generics, body), (*ident, ty, generics, *body);
expect_const, (Ident, &'hir Generics<'hir>, &'hir Ty<'hir>, BodyId),
ItemKind::Const(ident, generics, ty, body), (*ident, generics, ty, *body);

expect_fn, (Ident, &FnSig<'hir>, &'hir Generics<'hir>, BodyId),
ItemKind::Fn { ident, sig, generics, body, .. }, (*ident, sig, generics, *body);
@@ -4125,17 +4125,17 @@ impl<'hir> Item<'hir> {

expect_global_asm, &'hir InlineAsm<'hir>, ItemKind::GlobalAsm { asm, .. }, asm;

expect_ty_alias, (Ident, &'hir Ty<'hir>, &'hir Generics<'hir>),
ItemKind::TyAlias(ident, ty, generics), (*ident, ty, generics);
expect_ty_alias, (Ident, &'hir Generics<'hir>, &'hir Ty<'hir>),
ItemKind::TyAlias(ident, generics, ty), (*ident, generics, ty);

expect_enum, (Ident, &EnumDef<'hir>, &'hir Generics<'hir>),
ItemKind::Enum(ident, def, generics), (*ident, def, generics);
expect_enum, (Ident, &'hir Generics<'hir>, &EnumDef<'hir>),
ItemKind::Enum(ident, generics, def), (*ident, generics, def);

expect_struct, (Ident, &VariantData<'hir>, &'hir Generics<'hir>),
ItemKind::Struct(ident, data, generics), (*ident, data, generics);
expect_struct, (Ident, &'hir Generics<'hir>, &VariantData<'hir>),
ItemKind::Struct(ident, generics, data), (*ident, generics, data);

expect_union, (Ident, &VariantData<'hir>, &'hir Generics<'hir>),
ItemKind::Union(ident, data, generics), (*ident, data, generics);
expect_union, (Ident, &'hir Generics<'hir>, &VariantData<'hir>),
ItemKind::Union(ident, generics, data), (*ident, generics, data);

expect_trait,
(
@@ -4278,13 +4278,13 @@ pub enum ItemKind<'hir> {
Use(&'hir UsePath<'hir>, UseKind),

/// A `static` item.
Static(Ident, &'hir Ty<'hir>, Mutability, BodyId),
Static(Mutability, Ident, &'hir Ty<'hir>, BodyId),
/// A `const` item.
Const(Ident, &'hir Ty<'hir>, &'hir Generics<'hir>, BodyId),
Const(Ident, &'hir Generics<'hir>, &'hir Ty<'hir>, BodyId),
/// A function declaration.
Fn {
ident: Ident,
sig: FnSig<'hir>,
ident: Ident,
generics: &'hir Generics<'hir>,
body: BodyId,
/// Whether this function actually has a body.
@@ -4309,13 +4309,13 @@ pub enum ItemKind<'hir> {
fake_body: BodyId,
},
/// A type alias, e.g., `type Foo = Bar<u8>`.
TyAlias(Ident, &'hir Ty<'hir>, &'hir Generics<'hir>),
TyAlias(Ident, &'hir Generics<'hir>, &'hir Ty<'hir>),
/// An enum definition, e.g., `enum Foo<A, B> { C<A>, D<B> }`.
Enum(Ident, EnumDef<'hir>, &'hir Generics<'hir>),
Enum(Ident, &'hir Generics<'hir>, EnumDef<'hir>),
/// A struct definition, e.g., `struct Foo<A> {x: A}`.
Struct(Ident, VariantData<'hir>, &'hir Generics<'hir>),
Struct(Ident, &'hir Generics<'hir>, VariantData<'hir>),
/// A union definition, e.g., `union Foo<A, B> {x: A, y: B}`.
Union(Ident, VariantData<'hir>, &'hir Generics<'hir>),
Union(Ident, &'hir Generics<'hir>, VariantData<'hir>),
/// A trait definition.
Trait(IsAuto, Safety, Ident, &'hir Generics<'hir>, GenericBounds<'hir>, &'hir [TraitItemRef]),
/// A trait alias.
@@ -4352,7 +4352,7 @@ impl ItemKind<'_> {
match *self {
ItemKind::ExternCrate(_, ident)
| ItemKind::Use(_, UseKind::Single(ident))
| ItemKind::Static(ident, ..)
| ItemKind::Static(_, ident, ..)
| ItemKind::Const(ident, ..)
| ItemKind::Fn { ident, .. }
| ItemKind::Macro(ident, ..)
@@ -4374,11 +4374,11 @@ impl ItemKind<'_> {
pub fn generics(&self) -> Option<&Generics<'_>> {
Some(match self {
ItemKind::Fn { generics, .. }
| ItemKind::TyAlias(_, _, generics)
| ItemKind::Const(_, _, generics, _)
| ItemKind::Enum(_, _, generics)
| ItemKind::Struct(_, _, generics)
| ItemKind::Union(_, _, generics)
| ItemKind::TyAlias(_, generics, _)
| ItemKind::Const(_, generics, _, _)
| ItemKind::Enum(_, generics, _)
| ItemKind::Struct(_, generics, _)
| ItemKind::Union(_, generics, _)
| ItemKind::Trait(_, _, _, generics, _, _)
| ItemKind::TraitAlias(_, generics, _)
| ItemKind::Impl(Impl { generics, .. }) => generics,
@@ -4802,9 +4802,9 @@ impl<'hir> Node<'hir> {
pub fn ty(self) -> Option<&'hir Ty<'hir>> {
match self {
Node::Item(it) => match it.kind {
ItemKind::TyAlias(_, ty, _)
| ItemKind::Static(_, ty, _, _)
| ItemKind::Const(_, ty, _, _) => Some(ty),
ItemKind::TyAlias(_, _, ty)
| ItemKind::Static(_, _, ty, _)
| ItemKind::Const(_, _, ty, _) => Some(ty),
ItemKind::Impl(impl_item) => Some(&impl_item.self_ty),
_ => None,
},
@@ -4824,7 +4824,7 @@ impl<'hir> Node<'hir> {

pub fn alias_ty(self) -> Option<&'hir Ty<'hir>> {
match self {
Node::Item(Item { kind: ItemKind::TyAlias(_, ty, _), .. }) => Some(ty),
Node::Item(Item { kind: ItemKind::TyAlias(_, _, ty), .. }) => Some(ty),
_ => None,
}
}
16 changes: 8 additions & 8 deletions compiler/rustc_hir/src/intravisit.rs
Original file line number Diff line number Diff line change
@@ -545,15 +545,15 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item<'v>) -> V::
UseKind::Glob | UseKind::ListStem => {}
}
}
ItemKind::Static(ident, ref typ, _, body) => {
ItemKind::Static(_, ident, ref typ, body) => {
try_visit!(visitor.visit_ident(ident));
try_visit!(visitor.visit_ty_unambig(typ));
try_visit!(visitor.visit_nested_body(body));
}
ItemKind::Const(ident, ref typ, ref generics, body) => {
ItemKind::Const(ident, ref generics, ref typ, body) => {
try_visit!(visitor.visit_ident(ident));
try_visit!(visitor.visit_ty_unambig(typ));
try_visit!(visitor.visit_generics(generics));
try_visit!(visitor.visit_ty_unambig(typ));
try_visit!(visitor.visit_nested_body(body));
}
ItemKind::Fn { ident, sig, generics, body: body_id, .. } => {
@@ -583,12 +583,12 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item<'v>) -> V::
// typeck results set correctly.
try_visit!(visitor.visit_nested_body(fake_body));
}
ItemKind::TyAlias(ident, ref ty, ref generics) => {
ItemKind::TyAlias(ident, ref generics, ref ty) => {
try_visit!(visitor.visit_ident(ident));
try_visit!(visitor.visit_ty_unambig(ty));
try_visit!(visitor.visit_generics(generics));
try_visit!(visitor.visit_ty_unambig(ty));
}
ItemKind::Enum(ident, ref enum_definition, ref generics) => {
ItemKind::Enum(ident, ref generics, ref enum_definition) => {
try_visit!(visitor.visit_ident(ident));
try_visit!(visitor.visit_generics(generics));
try_visit!(visitor.visit_enum_def(enum_definition));
@@ -609,8 +609,8 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item<'v>) -> V::
try_visit!(visitor.visit_ty_unambig(self_ty));
walk_list!(visitor, visit_impl_item_ref, *items);
}
ItemKind::Struct(ident, ref struct_definition, ref generics)
| ItemKind::Union(ident, ref struct_definition, ref generics) => {
ItemKind::Struct(ident, ref generics, ref struct_definition)
| ItemKind::Union(ident, ref generics, ref struct_definition) => {
try_visit!(visitor.visit_ident(ident));
try_visit!(visitor.visit_generics(generics));
try_visit!(visitor.visit_variant_data(struct_definition));
22 changes: 10 additions & 12 deletions compiler/rustc_hir_analysis/src/check/wfcheck.rs
Original file line number Diff line number Diff line change
@@ -297,32 +297,30 @@ fn check_item<'tcx>(tcx: TyCtxt<'tcx>, item: &'tcx hir::Item<'tcx>) -> Result<()
hir::ItemKind::Fn { ident, sig, .. } => {
check_item_fn(tcx, def_id, ident, item.span, sig.decl)
}
hir::ItemKind::Static(_, ty, ..) => {
hir::ItemKind::Static(_, _, ty, _) => {
check_static_item(tcx, def_id, ty.span, UnsizedHandling::Forbid)
}
hir::ItemKind::Const(_, ty, ..) => check_const_item(tcx, def_id, ty.span, item.span),
hir::ItemKind::Struct(_, _, hir_generics) => {
hir::ItemKind::Const(_, _, ty, _) => check_const_item(tcx, def_id, ty.span, item.span),
hir::ItemKind::Struct(_, generics, _) => {
let res = check_type_defn(tcx, item, false);
check_variances_for_type_defn(tcx, item, hir_generics);
check_variances_for_type_defn(tcx, item, generics);
res
}
hir::ItemKind::Union(_, _, hir_generics) => {
hir::ItemKind::Union(_, generics, _) => {
let res = check_type_defn(tcx, item, true);
check_variances_for_type_defn(tcx, item, hir_generics);
check_variances_for_type_defn(tcx, item, generics);
res
}
hir::ItemKind::Enum(_, _, hir_generics) => {
hir::ItemKind::Enum(_, generics, _) => {
let res = check_type_defn(tcx, item, true);
check_variances_for_type_defn(tcx, item, hir_generics);
check_variances_for_type_defn(tcx, item, generics);
res
}
hir::ItemKind::Trait(..) => check_trait(tcx, item),
hir::ItemKind::TraitAlias(..) => check_trait(tcx, item),
// `ForeignItem`s are handled separately.
hir::ItemKind::ForeignMod { .. } => Ok(()),
hir::ItemKind::TyAlias(_, hir_ty, hir_generics)
if tcx.type_alias_is_lazy(item.owner_id) =>
{
hir::ItemKind::TyAlias(_, generics, hir_ty) if tcx.type_alias_is_lazy(item.owner_id) => {
let res = enter_wf_checking_ctxt(tcx, item.span, def_id, |wfcx| {
let ty = tcx.type_of(def_id).instantiate_identity();
let item_ty =
@@ -335,7 +333,7 @@ fn check_item<'tcx>(tcx: TyCtxt<'tcx>, item: &'tcx hir::Item<'tcx>) -> Result<()
check_where_clauses(wfcx, item.span, def_id);
Ok(())
});
check_variances_for_type_defn(tcx, item, hir_generics);
check_variances_for_type_defn(tcx, item, generics);
res
}
_ => Ok(()),
22 changes: 11 additions & 11 deletions compiler/rustc_hir_analysis/src/collect.rs
Original file line number Diff line number Diff line change
@@ -248,13 +248,13 @@ fn reject_placeholder_type_signatures_in_item<'tcx>(
item: &'tcx hir::Item<'tcx>,
) {
let (generics, suggest) = match &item.kind {
hir::ItemKind::Union(_, _, generics)
| hir::ItemKind::Enum(_, _, generics)
hir::ItemKind::Union(_, generics, _)
| hir::ItemKind::Enum(_, generics, _)
| hir::ItemKind::TraitAlias(_, generics, _)
| hir::ItemKind::Trait(_, _, _, generics, ..)
| hir::ItemKind::Impl(hir::Impl { generics, .. })
| hir::ItemKind::Struct(_, _, generics) => (generics, true),
hir::ItemKind::TyAlias(_, _, generics) => (generics, false),
| hir::ItemKind::Struct(_, generics, _) => (generics, true),
hir::ItemKind::TyAlias(_, generics, _) => (generics, false),
// `static`, `fn` and `const` are handled elsewhere to suggest appropriate type.
_ => return,
};
@@ -470,9 +470,9 @@ impl<'tcx> HirTyLowerer<'tcx> for ItemCtxt<'tcx> {
.tcx
.hir_expect_item(self.tcx.hir_get_parent_item(self.hir_id()).def_id);
match &item.kind {
hir::ItemKind::Enum(_, _, generics)
| hir::ItemKind::Struct(_, _, generics)
| hir::ItemKind::Union(_, _, generics) => {
hir::ItemKind::Enum(_, generics, _)
| hir::ItemKind::Struct(_, generics, _)
| hir::ItemKind::Union(_, generics, _) => {
let lt_name = get_new_lifetime_name(self.tcx, poly_trait_ref, generics);
let (lt_sp, sugg) = match generics.params {
[] => (generics.span, format!("<{lt_name}>")),
@@ -740,7 +740,7 @@ fn lower_item(tcx: TyCtxt<'_>, item_id: hir::ItemId) {
tcx.at(it.span).explicit_super_predicates_of(def_id);
tcx.ensure_ok().predicates_of(def_id);
}
hir::ItemKind::Struct(_, struct_def, _) | hir::ItemKind::Union(_, struct_def, _) => {
hir::ItemKind::Struct(_, _, struct_def) | hir::ItemKind::Union(_, _, struct_def) => {
tcx.ensure_ok().generics_of(def_id);
tcx.ensure_ok().type_of(def_id);
tcx.ensure_ok().predicates_of(def_id);
@@ -762,7 +762,7 @@ fn lower_item(tcx: TyCtxt<'_>, item_id: hir::ItemId) {
tcx.ensure_ok().predicates_of(def_id);
}

hir::ItemKind::Static(_, ty, ..) | hir::ItemKind::Const(_, ty, ..) => {
hir::ItemKind::Static(_, _, ty, _) | hir::ItemKind::Const(_, _, ty, _) => {
tcx.ensure_ok().generics_of(def_id);
tcx.ensure_ok().type_of(def_id);
tcx.ensure_ok().predicates_of(def_id);
@@ -1093,7 +1093,7 @@ fn adt_def(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::AdtDef<'_> {

let repr = tcx.repr_options_of_def(def_id);
let (kind, variants) = match &item.kind {
ItemKind::Enum(_, def, _) => {
ItemKind::Enum(_, _, def) => {
let mut distance_from_explicit = 0;
let variants = def
.variants
@@ -1121,7 +1121,7 @@ fn adt_def(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::AdtDef<'_> {

(AdtKind::Enum, variants)
}
ItemKind::Struct(ident, def, _) | ItemKind::Union(ident, def, _) => {
ItemKind::Struct(ident, _, def) | ItemKind::Union(ident, _, def) => {
let adt_kind = match item.kind {
ItemKind::Struct(..) => AdtKind::Struct,
_ => AdtKind::Union,
10 changes: 5 additions & 5 deletions compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs
Original file line number Diff line number Diff line change
@@ -634,11 +634,11 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
// These sorts of items have no lifetime parameters at all.
intravisit::walk_item(self, item);
}
hir::ItemKind::TyAlias(_, _, generics)
| hir::ItemKind::Const(_, _, generics, _)
| hir::ItemKind::Enum(_, _, generics)
| hir::ItemKind::Struct(_, _, generics)
| hir::ItemKind::Union(_, _, generics)
hir::ItemKind::TyAlias(_, generics, _)
| hir::ItemKind::Const(_, generics, _, _)
| hir::ItemKind::Enum(_, generics, _)
| hir::ItemKind::Struct(_, generics, _)
| hir::ItemKind::Union(_, generics, _)
| hir::ItemKind::Trait(_, _, _, generics, ..)
| hir::ItemKind::TraitAlias(_, generics, ..)
| hir::ItemKind::Impl(&hir::Impl { generics, .. }) => {
Loading