impl Copy/Clone for arrays in std, not in compiler

This commit is contained in:
bstrie 2021-06-05 17:17:35 -04:00
parent 495322d776
commit ce1143e94d
9 changed files with 30 additions and 187 deletions

View file

@ -33,7 +33,8 @@ pub fn can_type_implement_copy(
| ty::Char
| ty::RawPtr(..)
| ty::Never
| ty::Ref(_, _, hir::Mutability::Not) => return Ok(()),
| ty::Ref(_, _, hir::Mutability::Not)
| ty::Array(..) => return Ok(()),
ty::Adt(adt, substs) => (adt, substs),

View file

@ -1859,7 +1859,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
| ty::Char
| ty::RawPtr(..)
| ty::Never
| ty::Ref(_, _, hir::Mutability::Not) => {
| ty::Ref(_, _, hir::Mutability::Not)
| ty::Array(..) => {
// Implementations provided in libcore
None
}
@ -1872,11 +1873,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
| ty::Foreign(..)
| ty::Ref(_, _, hir::Mutability::Mut) => None,
ty::Array(element_ty, _) => {
// (*) binder moved here
Where(obligation.predicate.rebind(vec![element_ty]))
}
ty::Tuple(tys) => {
// (*) binder moved here
Where(obligation.predicate.rebind(tys.iter().map(|k| k.expect_ty()).collect()))