@@ -345,7 +345,11 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
345
345
}
346
346
347
347
// Avoid creating a temporary
348
- ExprKind :: VarRef { .. } | ExprKind :: SelfRef | ExprKind :: StaticRef { .. } => {
348
+ ExprKind :: VarRef { .. } |
349
+ ExprKind :: SelfRef |
350
+ ExprKind :: StaticRef { .. } |
351
+ ExprKind :: PlaceTypeAscription { .. } |
352
+ ExprKind :: ValueTypeAscription { .. } => {
349
353
debug_assert ! ( Category :: of( & expr. kind) == Some ( Category :: Place ) ) ;
350
354
351
355
let place = unpack ! ( block = this. as_place( block, expr) ) ;
@@ -391,11 +395,16 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
391
395
| ExprKind :: Adt { .. }
392
396
| ExprKind :: Closure { .. }
393
397
| ExprKind :: Literal { .. }
394
- | ExprKind :: Yield { .. }
395
- | ExprKind :: PlaceTypeAscription { .. }
396
- | ExprKind :: ValueTypeAscription { .. } => {
398
+ | ExprKind :: Yield { .. } => {
397
399
debug_assert ! ( match Category :: of( & expr. kind) . unwrap( ) {
400
+ // should be handled above
398
401
Category :: Rvalue ( RvalueFunc :: Into ) => false ,
402
+
403
+ // must be handled above or else we get an
404
+ // infinite loop in the builder; see
405
+ // e.g. `ExprKind::VarRef` above
406
+ Category :: Place => false ,
407
+
399
408
_ => true ,
400
409
} ) ;
401
410
0 commit comments