@@ -129,7 +129,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
129
129
}
130
130
131
131
// We want to emit an error if the const is not structurally resolveable as otherwise
132
- // we can find up conservatively proving `Copy` which may infer the repeat expr count
132
+ // we can wind up conservatively proving `Copy` which may infer the repeat expr count
133
133
// to something that never required `Copy` in the first place.
134
134
let count = self
135
135
. structurally_resolve_const ( element. span , self . normalize ( element. span , count) ) ;
@@ -178,14 +178,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
178
178
179
179
for ( element, element_ty, count) in deferred_repeat_expr_checks {
180
180
match count. kind ( ) {
181
- ty:: ConstKind :: Value ( val)
182
- if val. try_to_target_usize ( self . tcx ) . is_none_or ( |count| count > 1 ) =>
183
- {
184
- enforce_copy_bound ( element, element_ty)
181
+ ty:: ConstKind :: Value ( val) => {
182
+ if val. try_to_target_usize ( self . tcx ) . is_none_or ( |count| count > 1 ) {
183
+ enforce_copy_bound ( element, element_ty)
184
+ } else {
185
+ // If the length is 0 or 1 we don't actually copy the element, we either don't create it
186
+ // or we just use the one value.
187
+ }
185
188
}
186
- // If the length is 0 or 1 we don't actually copy the element, we either don't create it
187
- // or we just use the one value.
188
- ty:: ConstKind :: Value ( _) => ( ) ,
189
189
190
190
// If the length is a generic parameter or some rigid alias then conservatively
191
191
// require `element_ty: Copy` as it may wind up being `>1` after monomorphization.
0 commit comments