mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 17:24:06 +00:00
Split out the Generator
case from DefKind::Closure
.
This commit is contained in:
parent
cff5b998e0
commit
d1db782dff
@ -88,6 +88,7 @@ pub enum DefKind {
|
||||
GlobalAsm,
|
||||
Impl,
|
||||
Closure,
|
||||
Generator,
|
||||
}
|
||||
|
||||
impl DefKind {
|
||||
@ -131,6 +132,7 @@ impl DefKind {
|
||||
DefKind::Field => "field",
|
||||
DefKind::Impl => "implementation",
|
||||
DefKind::Closure => "closure",
|
||||
DefKind::Generator => "generator",
|
||||
DefKind::ExternCrate => "extern crate",
|
||||
DefKind::GlobalAsm => "global assembly block",
|
||||
}
|
||||
@ -184,6 +186,7 @@ impl DefKind {
|
||||
| DefKind::LifetimeParam
|
||||
| DefKind::ExternCrate
|
||||
| DefKind::Closure
|
||||
| DefKind::Generator
|
||||
| DefKind::Use
|
||||
| DefKind::ForeignMod
|
||||
| DefKind::GlobalAsm
|
||||
|
@ -592,7 +592,7 @@ impl EntryKind {
|
||||
EntryKind::ForeignMod => DefKind::ForeignMod,
|
||||
EntryKind::GlobalAsm => DefKind::GlobalAsm,
|
||||
EntryKind::Field => DefKind::Field,
|
||||
EntryKind::Generator(_) => DefKind::Closure,
|
||||
EntryKind::Generator(_) => DefKind::Generator,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -285,7 +285,8 @@ impl<'hir> Map<'hir> {
|
||||
Node::AnonConst(_) => DefKind::AnonConst,
|
||||
Node::Field(_) => DefKind::Field,
|
||||
Node::Expr(expr) => match expr.kind {
|
||||
ExprKind::Closure { .. } => DefKind::Closure,
|
||||
ExprKind::Closure(.., None) => DefKind::Closure,
|
||||
ExprKind::Closure(.., Some(_)) => DefKind::Generator,
|
||||
_ => bug!("def_kind: unsupported node: {}", self.node_to_string(hir_id)),
|
||||
},
|
||||
Node::MacroDef(_) => DefKind::Macro(MacroKind::Bang),
|
||||
|
@ -613,8 +613,8 @@ impl EmbargoVisitor<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
// These have type privacy or are not namespaced, so are not reachable unless they're
|
||||
// public.
|
||||
// These have type privacy, so are not reachable unless they're
|
||||
// public, or are not namespaced at all.
|
||||
DefKind::AssocConst
|
||||
| DefKind::AssocTy
|
||||
| DefKind::AssocOpaqueTy
|
||||
@ -636,7 +636,8 @@ impl EmbargoVisitor<'tcx> {
|
||||
| DefKind::Field
|
||||
| DefKind::GlobalAsm
|
||||
| DefKind::Impl
|
||||
| DefKind::Closure => (),
|
||||
| DefKind::Closure
|
||||
| DefKind::Generator => (),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -771,7 +771,8 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> {
|
||||
| HirDefKind::Field
|
||||
| HirDefKind::GlobalAsm
|
||||
| HirDefKind::Impl
|
||||
| HirDefKind::Closure,
|
||||
| HirDefKind::Closure
|
||||
| HirDefKind::Generator,
|
||||
_,
|
||||
)
|
||||
| Res::PrimTy(..)
|
||||
|
Loading…
Reference in New Issue
Block a user