-
Notifications
You must be signed in to change notification settings - Fork 423
Conversation
This allows compilers to mark structs as read-only.
This allows compilers to mark structs as by-ref-like (ref in C#).
The two existing types RuntimeArgumentHandle and TypedReference have always been considered like the new ref-types -- it's just that the notion as been generalized.
|
||
namespace System.Buffers | ||
{ | ||
public abstract partial class ArrayPool<T> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is ArrayPool related to Span?
@@ -260,7 +260,7 @@ public partial class KeyNotFoundException : System.SystemException, System.Runti | |||
public KeyNotFoundException(string message, System.Exception innerException) { } | |||
} | |||
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] | |||
public partial struct KeyValuePair<TKey, TValue> | |||
public readonly partial struct KeyValuePair<TKey, TValue> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't directly related to Span.
Perhaps I'm letting the PR title distract me but I see a number of changes unrelated to Span. |
@ahsonkhan @KrzysztofCwalina @stephentoub @joshfree could you please take a look at the potential .NET Standard API additions related to Span. |
See commit history. I had to add support for a couple of things. Maybe I should split the PR. The downside is that this needs more branches, but I think that's fine. |
InvalidData = 3, | ||
NeedMoreData = 2, | ||
} | ||
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this implementation details?
public System.Buffers.ReadOnlySequence<T> Slice(System.SequencePosition start, System.SequencePosition end) { throw null; } | ||
public override string ToString() { throw null; } | ||
public bool TryGet(ref System.SequencePosition position, out System.ReadOnlyMemory<T> memory, bool advance = true) { memory = default(System.ReadOnlyMemory<T>); throw null; } | ||
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
@@ -434,4 +434,47 @@ public partial class UnobservedTaskExceptionEventArgs : System.EventArgs | |||
public bool Observed { get { throw null; } } | |||
public void SetObserved() { } | |||
} | |||
[System.Runtime.CompilerServices.AsyncMethodBuilderAttribute(typeof(System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like redundant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marek-safar As I understand it, AsyncMethodBuilderAttribute
is used by the C# compiler to figure out how to generate an async
method that returns the given type (here, ValueTask
). So I think it should be included in reference assemblies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's required. The compiler uses it to determine what builder type to use for async methods that return the annotated type.
I'm going to split this PR into more reviewable chunks. |
@dotnet/nsboard