Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/coding-guidelines/breaking-change-rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ Breaking Change Rules

* Changing a `struct` type to a `ref struct` type and vice versa

* Adding a new `ref` field to a type

* Changing the underlying type of an enum

This is a compile-time and behavioral breaking change as well as a binary breaking change which can make attribute arguments unparsable.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ protected override bool NeedsRecursiveLayout(TypeDesc fieldType)
return false;
}

// Valuetypes with GC references and byref-like types need to be checked for overlaps and alignment
return ((MetadataType)fieldType).ContainsGCPointers || fieldType.IsByRefLike;
// Valuetypes with GC references or byrefs need to be checked for overlaps and alignment
var metadataType = ((MetadataType)fieldType);
return metadataType.ContainsGCPointers || metadataType.ContainsByRefs;
}

private void ThrowFieldLayoutError(int offset)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ public override bool ComputeContainsByRefs(DefType type)

TypeDesc fieldType = field.FieldType;
if (fieldType.IsByRef
|| ((fieldType is DefType df) && df.ContainsByRefs))
|| (fieldType.IsByRefLike && ((DefType)fieldType).ContainsByRefs))
{
return true;
}
Expand Down
Loading