Skip to content

Commit 847000f

Browse files
committed
allow field types to implement copy
1 parent 0e9e30a commit 847000f

File tree

1 file changed

+3
-0
lines changed
  • compiler/rustc_trait_selection/src/traits

1 file changed

+3
-0
lines changed

compiler/rustc_trait_selection/src/traits/misc.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ pub fn type_allowed_to_implement_copy<'tcx>(
6060
| ty::Ref(_, _, hir::Mutability::Not)
6161
| ty::Array(..) => return Ok(()),
6262

63+
// Field types are uninhabited and thus user-impls of `Copy` are allowed.
64+
ty::Field(..) => return Ok(()),
65+
6366
&ty::Adt(adt, args) => (adt, args),
6467

6568
_ => return Err(CopyImplementationError::NotAnAdt),

0 commit comments

Comments
 (0)