Unsafe evolution: warn for using the attribute under legacy rules and some cleanup#82456
Open
jjonescz wants to merge 12 commits intodotnet:features/UnsafeEvolutionfrom
Open
Unsafe evolution: warn for using the attribute under legacy rules and some cleanup#82456jjonescz wants to merge 12 commits intodotnet:features/UnsafeEvolutionfrom
jjonescz wants to merge 12 commits intodotnet:features/UnsafeEvolutionfrom
Conversation
It still makes sense to have unsafe blocks around all pointers, hence we don't hint to enable the updated memory safety rules in the legacy errors.
It's not relevant since we use an attribute now.
jcouv
reviewed
Feb 20, 2026
|
|
||
| | Warning ID | Description | | ||
| |------------|-------------| | ||
| | CS9508 | [RequiresUnsafeAttribute is only valid under the updated memory safety rules](https://github.com/dotnet/csharplang/issues/9704) | |
Member
jcouv
reviewed
Feb 21, 2026
| return MessageID.IDS_FeatureUnsafeEvolution.GetFeatureAvailabilityDiagnosticInfo(this.Compilation); | ||
| } | ||
|
|
||
| // PROTOTYPE: Update the error message to hint that one can enable updated memory safety rules. |
jcouv
reviewed
Feb 21, 2026
| diagnostics.Add(ErrorCode.ERR_PartialMemberReadOnlyDifference, implementation.GetFirstLocation()); | ||
| } | ||
|
|
||
| // PROTOTYPE: Update and test this for unsafe evolution. |
jcouv
reviewed
Feb 21, 2026
| break; | ||
| case ErrorCode.WRN_RequiresUnsafeAttributeLegacyRules: | ||
| // These are the warnings introduced with the warning "wave" shipped with dotnet 11 and C# 15. | ||
| Assert.Equal(11, ErrorFacts.GetWarningLevel(errorCode)); |
Member
There was a problem hiding this comment.
nit: not related to this PR, but it may be good to have a comment at the bottom of this test indicating that the warning wave doc should be updated
jcouv
reviewed
Feb 21, 2026
Member
jcouv
left a comment
There was a problem hiding this comment.
Done with review pass (commit 12). Only minor comments/questions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test plan: #81207
Related speclet update: dotnet/csharplang#9999
Commits should be mostly self-contained.