@@ -122,7 +122,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
122
122
}
123
123
124
124
// 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
126
126
// to something that never required `Copy` in the first place.
127
127
let count = self
128
128
. structurally_resolve_const ( element. span , self . normalize ( element. span , count) ) ;
@@ -171,14 +171,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
171
171
172
172
for ( element, element_ty, count) in deferred_repeat_expr_checks {
173
173
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
+ }
178
181
}
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 ( _) => ( ) ,
182
182
183
183
// If the length is a generic parameter or some rigid alias then conservatively
184
184
// require `element_ty: Copy` as it may wind up being `>1` after monomorphization.
0 commit comments