Report an error when an unannotated interface member is implemented with an [UnscopedRef] member, such as S1.GetRef() and S2.GetRef() below.
using System.Diagnostics.CodeAnalysis;
interface I<T>
{
ref T GetRef();
}
struct S1 : I<int>
{
private int _f;
[UnscopedRef] public ref int GetRef() => ref _f;
}
struct S2 : I<int>
{
private int _f;
[UnscopedRef] ref int I<int>.GetRef() => ref _f;
}
See dotnet/csharplang#6337 (comment).