Skip to content

Commit 9c3a213

Browse files
committed
allow field types to implement copy
1 parent eaa07b7 commit 9c3a213

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
@@ -61,6 +61,9 @@ pub fn type_allowed_to_implement_copy<'tcx>(
6161
| ty::Ref(_, _, hir::Mutability::Not)
6262
| ty::Array(..) => return Ok(()),
6363

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

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

0 commit comments

Comments
 (0)