Auto merge of #143526 - matthiaskrgr:rollup-pm69g5v, r=matthiaskrgr

Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#143252 (Rewrite empty attribute lint for new attribute parser)
 - rust-lang/rust#143492 (Use `object` crate from crates.io to fix windows build error)
 - rust-lang/rust#143514 (Organize macro tests a bit more)
 - rust-lang/rust#143518 (rustc_builtin_macros: Make sure registered attributes stay sorted)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2025-07-06 16:56:16 +00:00
commit de031bbcb1
72 changed files with 231 additions and 219 deletions

View file

@ -784,7 +784,7 @@ impl Item {
// don't want it it `Item::attrs`.
hir::Attribute::Parsed(AttributeKind::Deprecation { .. }) => None,
// We have separate pretty-printing logic for `#[repr(..)]` attributes.
hir::Attribute::Parsed(AttributeKind::Repr(..)) => None,
hir::Attribute::Parsed(AttributeKind::Repr { .. }) => None,
// target_feature is special-cased because cargo-semver-checks uses it
hir::Attribute::Parsed(AttributeKind::TargetFeature(features, _)) => {
let mut output = String::new();

View file

@ -266,7 +266,7 @@ impl<'tcx> LateLintPass<'tcx> for ArbitrarySourceItemOrdering {
.tcx
.hir_attrs(item.hir_id())
.iter()
.any(|attr| matches!(attr, Attribute::Parsed(AttributeKind::Repr(..))))
.any(|attr| matches!(attr, Attribute::Parsed(AttributeKind::Repr{ .. })))
{
// Do not lint items with a `#[repr]` attribute as their layout may be imposed by an external API.
return;

View file

@ -9,7 +9,7 @@ use clippy_utils::msrvs::{self, Msrv};
use super::REPR_PACKED_WITHOUT_ABI;
pub(super) fn check(cx: &LateContext<'_>, item_span: Span, attrs: &[Attribute], msrv: Msrv) {
if let Some(reprs) = find_attr!(attrs, AttributeKind::Repr(r) => r) {
if let Some(reprs) = find_attr!(attrs, AttributeKind::Repr { reprs, .. } => reprs) {
let packed_span = reprs
.iter()
.find(|(r, _)| matches!(r, ReprAttr::ReprPacked(..)))

View file

@ -99,5 +99,5 @@ fn is_zst<'tcx>(cx: &LateContext<'tcx>, field: &FieldDef, args: ty::GenericArgsR
fn has_c_repr_attr(cx: &LateContext<'_>, hir_id: HirId) -> bool {
let attrs = cx.tcx.hir_attrs(hir_id);
find_attr!(attrs, AttributeKind::Repr(r) if r.iter().any(|(x, _)| *x == ReprAttr::ReprC))
find_attr!(attrs, AttributeKind::Repr { reprs, .. } if reprs.iter().any(|(x, _)| *x == ReprAttr::ReprC))
}

View file

@ -1761,7 +1761,7 @@ pub fn has_attr(attrs: &[hir::Attribute], symbol: Symbol) -> bool {
}
pub fn has_repr_attr(cx: &LateContext<'_>, hir_id: HirId) -> bool {
find_attr!(cx.tcx.hir_attrs(hir_id), AttributeKind::Repr(..))
find_attr!(cx.tcx.hir_attrs(hir_id), AttributeKind::Repr { .. })
}
pub fn any_parent_has_attr(tcx: TyCtxt<'_>, node: HirId, symbol: Symbol) -> bool {