about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorb-naber <bn263@gmx.de>2022-03-16 09:25:17 +0100
committerb-naber <bn263@gmx.de>2022-03-23 11:34:33 +0100
commit5e7f1380f60f1c6f5cc530827fb04d240a58ae46 (patch)
tree5c0d9f7adcded7a15440de359ce8f73169760d9f /compiler
parent9cd8bb045611347e6440baaac5660c2fa0c6cd1b (diff)
downloadrust-5e7f1380f60f1c6f5cc530827fb04d240a58ae46.tar.gz
rust-5e7f1380f60f1c6f5cc530827fb04d240a58ae46.zip
move ExprKind::Repeat arm to expr_is_poly
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_trait_selection/src/traits/const_evaluatable.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs b/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs
index d6dd018d46f..6393e576c98 100644
--- a/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs
+++ b/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs
@@ -318,8 +318,11 @@ impl<'a, 'tcx> AbstractConstBuilder<'a, 'tcx> {
             thir: &'a thir::Thir<'tcx>,
         }
 
+        use crate::rustc_middle::thir::visit::Visitor;
+        use thir::visit;
+
         impl<'a, 'tcx> IsThirPolymorphic<'a, 'tcx> {
-            fn expr_is_poly(&self, expr: &thir::Expr<'tcx>) -> bool {
+            fn expr_is_poly(&mut self, expr: &thir::Expr<'tcx>) -> bool {
                 if expr.ty.has_param_types_or_consts() {
                     return true;
                 }
@@ -327,13 +330,16 @@ impl<'a, 'tcx> AbstractConstBuilder<'a, 'tcx> {
                 match expr.kind {
                     thir::ExprKind::NamedConst { substs, .. } => substs.has_param_types_or_consts(),
                     thir::ExprKind::ConstParam { .. } => true,
+                    thir::ExprKind::Repeat { value, count } => {
+                        self.visit_expr(&self.thir()[value]);
+                        count.has_param_types_or_consts()
+                    }
                     _ => false,
                 }
             }
         }
 
-        use thir::visit;
-        impl<'a, 'tcx: 'a> visit::Visitor<'a, 'tcx> for IsThirPolymorphic<'a, 'tcx> {
+        impl<'a, 'tcx> visit::Visitor<'a, 'tcx> for IsThirPolymorphic<'a, 'tcx> {
             fn thir(&self) -> &'a thir::Thir<'tcx> {
                 &self.thir
             }
@@ -342,13 +348,7 @@ impl<'a, 'tcx> AbstractConstBuilder<'a, 'tcx> {
             fn visit_expr(&mut self, expr: &thir::Expr<'tcx>) {
                 self.is_poly |= self.expr_is_poly(expr);
                 if !self.is_poly {
-                    match expr.kind {
-                        thir::ExprKind::Repeat { value, count } => {
-                            self.visit_expr(&self.thir()[value]);
-                            self.is_poly |= count.has_param_types_or_consts();
-                        }
-                        _ => visit::walk_expr(self, expr),
-                    }
+                    visit::walk_expr(self, expr)
                 }
             }