@@ -122,7 +122,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
122122 }
123123
124124 // We want to emit an error if the const is not structurally resolveable as otherwise
125- // we can find up conservatively proving `Copy` which may infer the repeat expr count
125+ // we can wind up conservatively proving `Copy` which may infer the repeat expr count
126126 // to something that never required `Copy` in the first place.
127127 let count = self
128128 . structurally_resolve_const ( element. span , self . normalize ( element. span , count) ) ;
@@ -171,14 +171,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
171171
172172 for ( element, element_ty, count) in deferred_repeat_expr_checks {
173173 match count. kind ( ) {
174- ty:: ConstKind :: Value ( val)
175- if val. try_to_target_usize ( self . tcx ) . is_none_or ( |count| count > 1 ) =>
176- {
177- enforce_copy_bound ( element, element_ty)
174+ ty:: ConstKind :: Value ( val) => {
175+ if val. try_to_target_usize ( self . tcx ) . is_none_or ( |count| count > 1 ) {
176+ enforce_copy_bound ( element, element_ty)
177+ } else {
178+ // If the length is 0 or 1 we don't actually copy the element, we either don't create it
179+ // or we just use the one value.
180+ }
178181 }
179- // If the length is 0 or 1 we don't actually copy the element, we either don't create it
180- // or we just use the one value.
181- ty:: ConstKind :: Value ( _) => ( ) ,
182182
183183 // If the length is a generic parameter or some rigid alias then conservatively
184184 // require `element_ty: Copy` as it may wind up being `>1` after monomorphization.
0 commit comments