diff options
| author | Noah Lev <camelidcamel@gmail.com> | 2021-08-19 20:30:33 -0700 |
|---|---|---|
| committer | Noah Lev <camelidcamel@gmail.com> | 2021-08-27 14:50:51 -0700 |
| commit | cd0fc444fb0edb4df0bd8091706d3819313a9df4 (patch) | |
| tree | a27934154a2d45e254f98fca1c13aa3bac3ea79d /compiler/rustc_query_impl/src/util.rs | |
| parent | 2f48bfa88c1c742ed058fc8af096d8cedc138434 (diff) | |
| download | rust-cd0fc444fb0edb4df0bd8091706d3819313a9df4.tar.gz rust-cd0fc444fb0edb4df0bd8091706d3819313a9df4.zip | |
Note that type aliases cannot be recursive
Diffstat (limited to 'compiler/rustc_query_impl/src/util.rs')
| -rw-r--r-- | compiler/rustc_query_impl/src/util.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/compiler/rustc_query_impl/src/util.rs b/compiler/rustc_query_impl/src/util.rs new file mode 100644 index 00000000000..517c107b5d9 --- /dev/null +++ b/compiler/rustc_query_impl/src/util.rs @@ -0,0 +1,18 @@ +use rustc_hir::def::DefKind; +use rustc_query_system::query::SimpleDefKind; + +/// Convert a [`DefKind`] to a [`SimpleDefKind`]. +/// +/// *See [`SimpleDefKind`]'s docs for more information.* +pub(crate) fn def_kind_to_simple_def_kind(def_kind: DefKind) -> SimpleDefKind { + match def_kind { + DefKind::Struct => SimpleDefKind::Struct, + DefKind::Enum => SimpleDefKind::Enum, + DefKind::Union => SimpleDefKind::Union, + DefKind::Trait => SimpleDefKind::Trait, + DefKind::TyAlias => SimpleDefKind::TyAlias, + DefKind::TraitAlias => SimpleDefKind::TraitAlias, + + _ => SimpleDefKind::Other, + } +} |
