Skip to content

Commit 641f624

Browse files
committed
Tell the compiler that VBuffer is scoped to Create call
This prevents errors CS9077 and CS8347 which are raised where the compiler cannot determine if the reference parameter destination is leaked.
1 parent 22dab8a commit 641f624

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Microsoft.ML.DataView/VBufferEditor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public static class VBufferEditor
2020
/// of this passed in object, and so whatever <see cref="VBuffer{T}"/> was passed in as this parameter should not be used again, since its
2121
/// underlying buffers are being potentially reused.</param>
2222
public static VBufferEditor<T> CreateFromBuffer<T>(
23-
ref VBuffer<T> destination)
23+
scoped ref VBuffer<T> destination)
2424
{
2525
return destination.GetEditor();
2626
}
@@ -53,7 +53,7 @@ public static VBufferEditor<T> CreateFromBuffer<T>(
5353
/// True means to ensure the Indices buffer is available, even if the buffer will be dense.
5454
/// </param>
5555
public static VBufferEditor<T> Create<T>(
56-
ref VBuffer<T> destination,
56+
scoped ref VBuffer<T> destination,
5757
int newLogicalLength,
5858
int? valuesCount = null,
5959
int? maxValuesCapacity = null,

0 commit comments

Comments
 (0)