Change DefKind::Static
to a struct variant
This commit is contained in:
parent
12e2846514
commit
9816915954
47 changed files with 90 additions and 86 deletions
|
@ -75,7 +75,10 @@ pub enum DefKind {
|
|||
Const,
|
||||
/// Constant generic parameter: `struct Foo<const N: usize> { ... }`
|
||||
ConstParam,
|
||||
Static(ast::Mutability),
|
||||
Static {
|
||||
/// Whether it's a `static mut` or just a `static`.
|
||||
mt: ast::Mutability,
|
||||
},
|
||||
/// Refers to the struct or enum variant's constructor.
|
||||
///
|
||||
/// The reason `Ctor` exists in addition to [`DefKind::Struct`] and
|
||||
|
@ -136,7 +139,7 @@ impl DefKind {
|
|||
DefKind::Fn => "function",
|
||||
DefKind::Mod if def_id.is_crate_root() && !def_id.is_local() => "crate",
|
||||
DefKind::Mod => "module",
|
||||
DefKind::Static(..) => "static",
|
||||
DefKind::Static { .. } => "static",
|
||||
DefKind::Enum => "enum",
|
||||
DefKind::Variant => "variant",
|
||||
DefKind::Ctor(CtorOf::Variant, CtorKind::Fn) => "tuple variant",
|
||||
|
@ -209,7 +212,7 @@ impl DefKind {
|
|||
DefKind::Fn
|
||||
| DefKind::Const
|
||||
| DefKind::ConstParam
|
||||
| DefKind::Static(..)
|
||||
| DefKind::Static { .. }
|
||||
| DefKind::Ctor(..)
|
||||
| DefKind::AssocFn
|
||||
| DefKind::AssocConst => Some(Namespace::ValueNS),
|
||||
|
@ -248,7 +251,7 @@ impl DefKind {
|
|||
DefKind::Fn
|
||||
| DefKind::Const
|
||||
| DefKind::ConstParam
|
||||
| DefKind::Static(..)
|
||||
| DefKind::Static { .. }
|
||||
| DefKind::AssocFn
|
||||
| DefKind::AssocConst
|
||||
| DefKind::Field => DefPathData::ValueNs(name),
|
||||
|
@ -278,7 +281,7 @@ impl DefKind {
|
|||
| DefKind::AssocFn
|
||||
| DefKind::Ctor(..)
|
||||
| DefKind::Closure
|
||||
| DefKind::Static(_) => true,
|
||||
| DefKind::Static { .. } => true,
|
||||
DefKind::Mod
|
||||
| DefKind::Struct
|
||||
| DefKind::Union
|
||||
|
|
|
@ -1616,7 +1616,7 @@ impl Expr<'_> {
|
|||
pub fn is_place_expr(&self, mut allow_projections_from: impl FnMut(&Self) -> bool) -> bool {
|
||||
match self.kind {
|
||||
ExprKind::Path(QPath::Resolved(_, ref path)) => {
|
||||
matches!(path.res, Res::Local(..) | Res::Def(DefKind::Static(_), _) | Res::Err)
|
||||
matches!(path.res, Res::Local(..) | Res::Def(DefKind::Static { .. }, _) | Res::Err)
|
||||
}
|
||||
|
||||
// Type ascription inherits its place expression kind from its
|
||||
|
|
|
@ -107,7 +107,7 @@ impl Target {
|
|||
match item.kind {
|
||||
ItemKind::ExternCrate(..) => Target::ExternCrate,
|
||||
ItemKind::Use(..) => Target::Use,
|
||||
ItemKind::Static(..) => Target::Static,
|
||||
ItemKind::Static { .. } => Target::Static,
|
||||
ItemKind::Const(..) => Target::Const,
|
||||
ItemKind::Fn(..) => Target::Fn,
|
||||
ItemKind::Macro(..) => Target::MacroDef,
|
||||
|
@ -130,7 +130,7 @@ impl Target {
|
|||
match def_kind {
|
||||
DefKind::ExternCrate => Target::ExternCrate,
|
||||
DefKind::Use => Target::Use,
|
||||
DefKind::Static(..) => Target::Static,
|
||||
DefKind::Static { .. } => Target::Static,
|
||||
DefKind::Const => Target::Const,
|
||||
DefKind::Fn => Target::Fn,
|
||||
DefKind::Macro(..) => Target::MacroDef,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue