File tree 2 files changed +7
-3
lines changed
compiler/rustc_typeck/src
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 {
2277
2277
let array_ty = tcx. mk_ty ( ty:: Array ( self . ast_ty_to_ty ( & ty) , length) ) ;
2278
2278
self . normalize_ty ( ast_ty. span , array_ty)
2279
2279
}
2280
- hir:: TyKind :: Typeof ( ref _e ) => {
2280
+ hir:: TyKind :: Typeof ( ref e ) => {
2281
2281
tcx. sess . emit_err ( TypeofReservedKeywordUsed { span : ast_ty. span } ) ;
2282
- tcx. ty_error ( )
2282
+ tcx. type_of ( e . hir_id . owner )
2283
2283
}
2284
2284
hir:: TyKind :: Infer => {
2285
2285
// 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<'_> {
417
417
let parent_node = tcx. hir ( ) . get ( tcx. hir ( ) . get_parent_node ( hir_id) ) ;
418
418
match parent_node {
419
419
Node :: Ty ( & Ty { kind : TyKind :: Array ( _, ref constant) , .. } )
420
- | Node :: Ty ( & Ty { kind : TyKind :: Typeof ( ref constant) , .. } )
421
420
| Node :: Expr ( & Expr { kind : ExprKind :: Repeat ( _, ref constant) , .. } )
422
421
if constant. hir_id == hir_id =>
423
422
{
424
423
tcx. types . usize
425
424
}
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
+ }
426
430
427
431
Node :: Expr ( & Expr { kind : ExprKind :: ConstBlock ( ref anon_const) , .. } )
428
432
if anon_const. hir_id == hir_id =>
You can’t perform that action at this time.
0 commit comments