diff options
| author | bors <bors@rust-lang.org> | 2021-09-01 03:43:37 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-09-01 03:43:37 +0000 |
| commit | c4f26b15e37101c54829efab456922a53e3103ad (patch) | |
| tree | ce7caaa6f4446a1faa1414554ef0f1715847a4f9 /compiler/rustc_query_impl/src/util.rs | |
| parent | c2a408840ad18f74280805535f0b7193528ff3df (diff) | |
| parent | d96234bed72e1935d8ab9a0c7a7e70027c86ad77 (diff) | |
| download | rust-c4f26b15e37101c54829efab456922a53e3103ad.tar.gz rust-c4f26b15e37101c54829efab456922a53e3103ad.zip | |
Auto merge of #88121 - camelid:better-recursive-alias-error, r=estebank
Improve errors for recursive type aliases Fixes #17539.
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, + } +} |
