diff options
| author | Luca Versari <veluca@google.com> | 2024-06-24 17:17:18 +0200 |
|---|---|---|
| committer | Luca Versari <veluca93@gmail.com> | 2024-08-28 09:54:23 +0200 |
| commit | 7eb4cfeaced28d49952e4ef54f8fe02258125854 (patch) | |
| tree | 3ce2201b99e4a8a38f9f131fada5132be4327e7d /compiler/rustc_hir/src/def.rs | |
| parent | 748c54848dc2964b7e133f945cabe5bc64079947 (diff) | |
| download | rust-7eb4cfeaced28d49952e4ef54f8fe02258125854.tar.gz rust-7eb4cfeaced28d49952e4ef54f8fe02258125854.zip | |
Implement RFC 3525.
Diffstat (limited to 'compiler/rustc_hir/src/def.rs')
| -rw-r--r-- | compiler/rustc_hir/src/def.rs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/compiler/rustc_hir/src/def.rs b/compiler/rustc_hir/src/def.rs index b329432d1e1..36e29d2dcb2 100644 --- a/compiler/rustc_hir/src/def.rs +++ b/compiler/rustc_hir/src/def.rs @@ -326,6 +326,41 @@ impl DefKind { | DefKind::ExternCrate => false, } } + + /// Whether `query struct_target_features` should be used with this definition. + pub fn has_struct_target_features(self) -> bool { + match self { + DefKind::Struct | DefKind::Union | DefKind::Enum => true, + DefKind::Fn + | DefKind::AssocFn + | DefKind::Ctor(..) + | DefKind::Closure + | DefKind::Static { .. } + | DefKind::Mod + | DefKind::Variant + | DefKind::Trait + | DefKind::TyAlias + | DefKind::ForeignTy + | DefKind::TraitAlias + | DefKind::AssocTy + | DefKind::Const + | DefKind::AssocConst + | DefKind::Macro(..) + | DefKind::Use + | DefKind::ForeignMod + | DefKind::OpaqueTy + | DefKind::Impl { .. } + | DefKind::Field + | DefKind::TyParam + | DefKind::ConstParam + | DefKind::LifetimeParam + | DefKind::AnonConst + | DefKind::InlineConst + | DefKind::SyntheticCoroutineBody + | DefKind::GlobalAsm + | DefKind::ExternCrate => false, + } + } } /// The resolution of a path or export. |
