File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
compiler/rustc_mir_transform/src Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -78,20 +78,20 @@ impl<'tcx> InstSimplifyContext<'_, 'tcx> {
7878 /// GVN can also do this optimization, but GVN is only run at mir-opt-level 2 so having this in
7979 /// InstSimplify helps unoptimized builds.
8080 fn simplify_repeated_aggregate ( & self , rvalue : & mut Rvalue < ' tcx > ) {
81- let Rvalue :: Aggregate ( box AggregateKind :: Array ( _) , fields) = rvalue else {
81+ let Rvalue :: Aggregate ( box AggregateKind :: Array ( _) , fields) = & * rvalue else {
8282 return ;
8383 } ;
8484 if fields. len ( ) < 5 {
8585 return ;
8686 }
87- let first = & fields[ rustc_abi :: FieldIdx :: ZERO ] ;
87+ let ( first, rest ) = fields[ .. ] . split_first ( ) . unwrap ( ) ;
8888 let Operand :: Constant ( first) = first else {
8989 return ;
9090 } ;
9191 let Ok ( first_val) = first. const_ . eval ( self . tcx , self . typing_env , first. span ) else {
9292 return ;
9393 } ;
94- if fields . iter ( ) . all ( |field| {
94+ if rest . iter ( ) . all ( |field| {
9595 let Operand :: Constant ( field) = field else {
9696 return false ;
9797 } ;
You can’t perform that action at this time.
0 commit comments