diff options
| author | Pavel Grigorenko <GrigorenkoPV@ya.ru> | 2025-06-14 20:54:30 +0300 |
|---|---|---|
| committer | Pavel Grigorenko <GrigorenkoPV@ya.ru> | 2025-06-21 21:52:25 +0300 |
| commit | d86d3f3742caad06488a1bf1d7eb045606f95cdd (patch) | |
| tree | 2c8a6826591544088abdec67b19f3a8aa010ebf3 /compiler/rustc_hir_analysis/src/check/check.rs | |
| parent | ea34650916887b5075812d0f11c1d3209e7f94ab (diff) | |
| download | rust-d86d3f3742caad06488a1bf1d7eb045606f95cdd.tar.gz rust-d86d3f3742caad06488a1bf1d7eb045606f95cdd.zip | |
Port `#[rustc_pub_transparent]` to the new attribute system
Diffstat (limited to 'compiler/rustc_hir_analysis/src/check/check.rs')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/check/check.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs index 32fec0604c0..752cc2eff97 100644 --- a/compiler/rustc_hir_analysis/src/check/check.rs +++ b/compiler/rustc_hir_analysis/src/check/check.rs @@ -2,6 +2,7 @@ use std::cell::LazyCell; use std::ops::ControlFlow; use rustc_abi::FieldIdx; +use rustc_attr_data_structures::AttributeKind; use rustc_attr_data_structures::ReprAttr::ReprPacked; use rustc_data_structures::unord::{UnordMap, UnordSet}; use rustc_errors::codes::*; @@ -1384,7 +1385,11 @@ pub(super) fn check_transparent<'tcx>(tcx: TyCtxt<'tcx>, adt: ty::AdtDef<'tcx>) ty::Tuple(list) => list.iter().try_for_each(|t| check_non_exhaustive(tcx, t)), ty::Array(ty, _) => check_non_exhaustive(tcx, *ty), ty::Adt(def, args) => { - if !def.did().is_local() && !tcx.has_attr(def.did(), sym::rustc_pub_transparent) + if !def.did().is_local() + && !attrs::find_attr!( + tcx.get_all_attrs(def.did()), + AttributeKind::PubTransparent(_) + ) { let non_exhaustive = def.is_variant_list_non_exhaustive() || def |
