@@ -318,22 +318,28 @@ impl<'a, 'tcx> AbstractConstBuilder<'a, 'tcx> {
318
318
thir : & ' a thir:: Thir < ' tcx > ,
319
319
}
320
320
321
+ use crate :: rustc_middle:: thir:: visit:: Visitor ;
322
+ use thir:: visit;
323
+
321
324
impl < ' a , ' tcx > IsThirPolymorphic < ' a , ' tcx > {
322
- fn expr_is_poly ( & self , expr : & thir:: Expr < ' tcx > ) -> bool {
325
+ fn expr_is_poly ( & mut self , expr : & thir:: Expr < ' tcx > ) -> bool {
323
326
if expr. ty . has_param_types_or_consts ( ) {
324
327
return true ;
325
328
}
326
329
327
330
match expr. kind {
328
331
thir:: ExprKind :: NamedConst { substs, .. } => substs. has_param_types_or_consts ( ) ,
329
332
thir:: ExprKind :: ConstParam { .. } => true ,
333
+ thir:: ExprKind :: Repeat { value, count } => {
334
+ self . visit_expr ( & self . thir ( ) [ value] ) ;
335
+ count. has_param_types_or_consts ( )
336
+ }
330
337
_ => false ,
331
338
}
332
339
}
333
340
}
334
341
335
- use thir:: visit;
336
- impl < ' a , ' tcx : ' a > visit:: Visitor < ' a , ' tcx > for IsThirPolymorphic < ' a , ' tcx > {
342
+ impl < ' a , ' tcx > visit:: Visitor < ' a , ' tcx > for IsThirPolymorphic < ' a , ' tcx > {
337
343
fn thir ( & self ) -> & ' a thir:: Thir < ' tcx > {
338
344
& self . thir
339
345
}
@@ -342,13 +348,7 @@ impl<'a, 'tcx> AbstractConstBuilder<'a, 'tcx> {
342
348
fn visit_expr ( & mut self , expr : & thir:: Expr < ' tcx > ) {
343
349
self . is_poly |= self . expr_is_poly ( expr) ;
344
350
if !self . is_poly {
345
- match expr. kind {
346
- thir:: ExprKind :: Repeat { value, count } => {
347
- self . visit_expr ( & self . thir ( ) [ value] ) ;
348
- self . is_poly |= count. has_param_types_or_consts ( ) ;
349
- }
350
- _ => visit:: walk_expr ( self , expr) ,
351
- }
351
+ visit:: walk_expr ( self , expr)
352
352
}
353
353
}
354
354
0 commit comments