File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
compiler/rustc_typeck/src Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -2277,9 +2277,9 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
22772277 let array_ty = tcx. mk_ty ( ty:: Array ( self . ast_ty_to_ty ( & ty) , length) ) ;
22782278 self . normalize_ty ( ast_ty. span , array_ty)
22792279 }
2280- hir:: TyKind :: Typeof ( ref _e ) => {
2280+ hir:: TyKind :: Typeof ( ref e ) => {
22812281 tcx. sess . emit_err ( TypeofReservedKeywordUsed { span : ast_ty. span } ) ;
2282- tcx. ty_error ( )
2282+ tcx. type_of ( e . hir_id . owner )
22832283 }
22842284 hir:: TyKind :: Infer => {
22852285 // Infer also appears as the type of arguments or return
Original file line number Diff line number Diff line change @@ -417,12 +417,16 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> {
417417 let parent_node = tcx. hir ( ) . get ( tcx. hir ( ) . get_parent_node ( hir_id) ) ;
418418 match parent_node {
419419 Node :: Ty ( & Ty { kind : TyKind :: Array ( _, ref constant) , .. } )
420- | Node :: Ty ( & Ty { kind : TyKind :: Typeof ( ref constant) , .. } )
421420 | Node :: Expr ( & Expr { kind : ExprKind :: Repeat ( _, ref constant) , .. } )
422421 if constant. hir_id == hir_id =>
423422 {
424423 tcx. types . usize
425424 }
425+ Node :: Ty ( & Ty { kind : TyKind :: Typeof ( ref constant) , .. } )
426+ if constant. hir_id == hir_id =>
427+ {
428+ tcx. typeck ( def_id) . node_type ( constant. hir_id )
429+ }
426430
427431 Node :: Expr ( & Expr { kind : ExprKind :: ConstBlock ( ref anon_const) , .. } )
428432 if anon_const. hir_id == hir_id =>
You can’t perform that action at this time.
0 commit comments