Auto merge of #155209 - JonathanBrouwer:attr_cleanup2, r=jdonszelmann

Post-attribute ports cleanup pt. 1 (again)

This is a re-implementation of most (but not all) of https://github.com/rust-lang/rust/pull/154808

The code is the same as in that PR, other than a few changes, I'll leave comments where I changed things.
I did re-implement most of the commits rather than cherry-picking, so it's probably good to check the entire diff regardless

r? @jdonszelmann
This commit is contained in:
bors
2026-04-14 08:59:40 +00:00
2 changed files with 2 additions and 3 deletions
+1 -1
View File
@@ -145,7 +145,7 @@ fn check_fn(
def_id: LocalDefId,
) {
#[allow(deprecated)]
if !cx.tcx.has_attr(def_id, sym::test) {
if !cx.tcx.get_attrs(def_id, sym::test).next().is_some() {
let expr = if kind.asyncness().is_async() {
match get_async_fn_body(cx.tcx, body) {
Some(b) => b,
+1 -2
View File
@@ -2400,8 +2400,7 @@ pub fn is_hir_ty_cfg_dependant(cx: &LateContext<'_>, ty: &hir::Ty<'_>) -> bool {
if let TyKind::Path(QPath::Resolved(_, path)) = ty.kind
&& let Res::Def(_, def_id) = path.res
{
#[allow(deprecated)]
return cx.tcx.has_attr(def_id, sym::cfg) || cx.tcx.has_attr(def_id, sym::cfg_attr);
return find_attr!(cx.tcx, def_id, CfgTrace(..) | CfgAttrTrace);
}
false
}