`SkipLocalsInit` is an unsafe operation, but does not give warning FS0009
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 131
Description
Applying the attribute [`SkipLocalsInitAttribute`](https://learn.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.skiplocalsinitattribute?view=net-8.0) is an unsafe operation, but does not raise the FS0009 warning.
### Repro steps
```f#
type Rain() =
[]
member _.ItPours(?msg: string) =
let message= defaultArg mname "absent"
$"Message: {message}"
```
### Expected behavior
According to the docs, this is an [unsafe operation](https://learn.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.skiplocalsinitattribute?view=net-8.0#remarks).
F# issues the FS0009 warning for unsafe operations (like `fixed` and using `nativeptr` and the like). This warning should be thrown when using `SkipLocalsInit` as well.
This is akin to using the `unsafe` keyword in C#, which is indeed required for this attribute.
### Actual behavior
The warning is not thrown.
### Related information
* Original implementation: #11267, by @kerams, perhaps you know whether there was a decision here?
* Original suggestion: https://github.com/fsharp/fslang-suggestions/issues/990
* RFC: not found
The suggestion does not mention the term `unsafe`, but @dsyme [mentioned](https://github.com/fsharp/fslang-suggestions/issues/990#issuecomment-800341854)
> It's also in the realm of a "allow generation of unverifiable code for performance reasons" feature
which further cements that this is unsafe and that FS0009 should be shown here.
Since this is just a warning, I hope this can be added to F# still, without being considered a backward compatibility issue.
Contributor guide
Assessment
This issue has not been assessed yet.