| @@ -440,6 +440,43 @@ impl DefKind { |
|
|
| 440 |
440 |
| DefKind::ExternCrate => false, |
| 441 |
441 |
} |
| 442 |
442 |
} |
|
443 |
+ |
|
444 |
+/// Returns `true` if `self` is a kind of definition that does not have its own |
|
445 |
+ /// type-checking context, i.e. closure, coroutine or inline const. |
|
446 |
+ #[inline] |
|
447 |
+pub fn is_typeck_child(self) -> bool { |
|
448 |
+match self { |
|
449 |
+DefKind::Closure | DefKind::InlineConst |
|
450 |
+DefKind::Mod |
|
451 |
+ | DefKind::Struct |
|
452 |
+ | DefKind::Union |
|
453 |
+ | DefKind::Enum |
|
454 |
+ | DefKind::Variant |
|
455 |
+ | DefKind::Trait |
|
456 |
+ | DefKind::TyAlias |
|
457 |
+ | DefKind::ForeignTy |
|
458 |
+ | DefKind::TraitAlias |
|
459 |
+ | DefKind::AssocTy |
|
460 |
+ | DefKind::TyParam |
|
461 |
+ | DefKind::Fn |
|
462 |
+ | DefKind::Const |
|
463 |
+ | DefKind::ConstParam |
|
464 |
+ | DefKind::Static { .. } |
|
465 |
+ | DefKind::Ctor(_, _) |
|
466 |
+ | DefKind::AssocFn |
|
467 |
+ | DefKind::AssocConst |
|
468 |
+ | DefKind::Macro(_) |
|
469 |
+ | DefKind::ExternCrate |
|
470 |
+ | DefKind::Use |
|
471 |
+ | DefKind::ForeignMod |
|
472 |
+ | DefKind::AnonConst |
|
473 |
+ | DefKind::OpaqueTy |
|
474 |
+ | DefKind::Field |
|
475 |
+ | DefKind::LifetimeParam |
|
476 |
+ | DefKind::GlobalAsm |
|
477 |
+ | DefKind::Impl { .. } => false, |
|
478 |
+} |
|
479 |
+} |
| 443 |
480 |
} |
| 444 |
481 |
|
| 445 |
482 |
/// The resolution of a path or export. |