File tree Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -440,6 +440,13 @@ 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
+ matches ! ( self , DefKind :: Closure | DefKind :: InlineConst | DefKind :: SyntheticCoroutineBody )
449
+ }
443
450
}
444
451
445
452
/// The resolution of a path or export.
Original file line number Diff line number Diff line change @@ -238,7 +238,8 @@ pub fn check_crate(tcx: TyCtxt<'_>) {
238
238
_ => ( ) ,
239
239
}
240
240
// Skip `AnonConst`s because we feed their `type_of`.
241
- if !matches ! ( def_kind, DefKind :: AnonConst ) {
241
+ // Also skip items for which typeck forwards to parent typeck.
242
+ if !( matches ! ( def_kind, DefKind :: AnonConst ) || def_kind. is_typeck_child ( ) ) {
242
243
tcx. ensure_ok ( ) . typeck ( item_def_id) ;
243
244
}
244
245
// Ensure we generate the new `DefId` before finishing `check_crate`.
Original file line number Diff line number Diff line change @@ -609,10 +609,7 @@ impl<'tcx> TyCtxt<'tcx> {
609
609
/// Returns `true` if `def_id` refers to a definition that does not have its own
610
610
/// type-checking context, i.e. closure, coroutine or inline const.
611
611
pub fn is_typeck_child ( self , def_id : DefId ) -> bool {
612
- matches ! (
613
- self . def_kind( def_id) ,
614
- DefKind :: Closure | DefKind :: InlineConst | DefKind :: SyntheticCoroutineBody
615
- )
612
+ self . def_kind ( def_id) . is_typeck_child ( )
616
613
}
617
614
618
615
/// Returns `true` if `def_id` refers to a trait (i.e., `trait Foo { ... }`).
You can’t perform that action at this time.
0 commit comments