-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Closed
Copy link
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Runtime.CompilerServices
Milestone
Description
Background and motivation
The C# compiler emits a [module: RefSafetyRules(11)]
attribute to modules compiled with -langversion:11
or above, or compiled with .NET 7 or above, to indicate that the module was compiled with C#11 ref safety rules.
The RefSafetyRulesAttribute
type definition should be added to the BCL to avoid having the compiler emit the attribute definition to each module.
API Proposal
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
public sealed class RefSafetyRulesAttribute : Attribute
{
public RefSafetyRulesAttribute(int version) { Version = version; }
public int Version;
}
}
API Usage
The RefSafetyRulesAttribute
type is for compiler use only - it is not permitted in source.
Alternative Designs
No response
Risks
No response
Metadata
Metadata
Assignees
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Runtime.CompilerServices