-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Unsafe evolution: implement compat mode #81701
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: features/UnsafeEvolution
Are you sure you want to change the base?
Unsafe evolution: implement compat mode #81701
Conversation
src/Compilers/CSharp/Portable/Symbols/Metadata/PE/PEMethodSymbol.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Symbols/Metadata/PE/PEPropertySymbol.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Symbols/FunctionPointers/FunctionPointerMethodSymbol.cs
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Symbols/Synthesized/Records/SynthesizedRecordPropertySymbol.cs
Show resolved
Hide resolved
| return IsDeclaredRequiresUnsafe ? CallerUnsafeMode.Explicit : CallerUnsafeMode.None; | ||
| } | ||
|
|
||
| return this.HasParameterContainingPointerType() || ReturnType.ContainsPointerOrFunctionPointer() |
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.
Can a pointer appear elsewhere in the signature? For instance, where T : I<int*[]>
Comment also applies to PEPropertySymbol: E.extension<T>(T).Property (with constraint like above) or (I saw that second example is already covered) may be scenariosE.extension(int*[]).Property
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.
I'm not sure that should be considered caller-unsafe in the compat mode, because calling such method wouldn't be considered unsafe previously either. Similarly we were discussing extern unsafe rule (I will add you to the chat.) @333fred thoughts?
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.
I've updated the speclet: dotnet/csharplang#9883
Will add tests for this too depending on what we decide (doesn't have to be a final decision of course).
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.
Feels like we shouldn't do that. If the substituted type has a pointer in it, then it'll get marked as unsafe.
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.
I've updated the speclet: dotnet/csharplang#9883
Turns out the PR was stuck in GitHub UI, I've force-pushed to it and it should now be at the commit I was talking about.
src/Compilers/CSharp/Portable/Symbols/Source/LocalFunctionOrSourceMemberMethodSymbol.cs
Outdated
Show resolved
Hide resolved
jcouv
left a comment
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.
Done with review pass (commit 3)
jcouv
left a comment
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.
Done with review pass (commit 4). Only open question about unsafe constraints remains
|
@AlekseyTs for a second review if you are available, thanks |
Test plan: #81207
Follow up on #81581 (i.e., still only for methods and properties).
Implements this speclet section: https://github.com/dotnet/csharplang/blob/80f7e032a3131f1d9c2c6822b8a03cf56eeda005/proposals/unsafe-evolution.md#compat-mode