Skip to content

Commit

Permalink
intro(exporter): DefKind
Browse files Browse the repository at this point in the history
  • Loading branch information
W95Psp committed Dec 18, 2024
1 parent 3d4aa89 commit 4420eb7
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 4 deletions.
50 changes: 47 additions & 3 deletions frontend/exporter/src/types/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl<S> SInto<S, Mutability> for hir::Mutability {

/// Reflects [`hir::def::CtorKind`]
#[derive_group(Serializers)]
#[derive(AdtInto, Clone, Debug, JsonSchema)]
#[derive(AdtInto, JsonSchema, Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
#[args(<S>, from: hir::def::CtorKind, state: S as _s)]
pub enum CtorKind {
Fn,
Expand All @@ -71,7 +71,7 @@ pub enum CtorKind {

/// Reflects [`hir::def::CtorOf`]
#[derive_group(Serializers)]
#[derive(AdtInto, Clone, Debug, JsonSchema)]
#[derive(AdtInto, JsonSchema, Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
#[args(<S>, from: hir::def::CtorOf, state: S as _s)]
pub enum CtorOf {
Struct,
Expand Down Expand Up @@ -1177,7 +1177,51 @@ pub enum AttrKind {
DocComment(CommentKind, Symbol),
}

sinto_todo!(rustc_hir::def, DefKind);
/// Reflects [`rustc_hir::def::DefKind`]
#[derive(AdtInto)]
#[args(<S>, from: rustc_hir::def::DefKind, state: S as tcx)]
#[derive_group(Serializers)]
#[derive(Debug, JsonSchema, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub enum DefKind {
Mod,
Struct,
Union,
Enum,
Variant,
Trait,
TyAlias,
ForeignTy,
TraitAlias,
AssocTy,
TyParam,
Fn,
Const,
ConstParam,
Static {
safety: Safety,
mutability: Mutability,
nested: bool,
},
Ctor(CtorOf, CtorKind),
AssocFn,
AssocConst,
Macro(MacroKind),
ExternCrate,
Use,
ForeignMod,
AnonConst,
InlineConst,
OpaqueTy,
Field,
LifetimeParam,
GlobalAsm,
Impl {
of_trait: bool,
},
Closure,
SyntheticCoroutineBody,
}

sinto_todo!(rustc_hir, GenericArgs<'a> as HirGenericArgs);
sinto_todo!(rustc_hir, InlineAsm<'a>);
sinto_todo!(rustc_hir, MissingLifetimeKind);
Expand Down
2 changes: 1 addition & 1 deletion frontend/exporter/src/types/span.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub enum AstPass {

/// Reflects [`rustc_span::hygiene::MacroKind`]
#[derive_group(Serializers)]
#[derive(AdtInto, Clone, Debug, JsonSchema)]
#[derive(AdtInto, JsonSchema, Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
#[args(<S>, from: rustc_span::hygiene::MacroKind, state: S as _s)]
pub enum MacroKind {
Bang,
Expand Down

0 comments on commit 4420eb7

Please sign in to comment.