Skip to content

[RCS1231] On ref struct #1725

Description

@Ted-Jin-Lab

This is my code

public readonly ref struct RefStruct;

public static class Methods
{
    public static void Main()
    {
        var item = new RefStruct();
        item = DoSomething(item);
    }

    public static RefStruct DoSomething(RefStruct @struct)
    {
        return @struct;
    }
}

And it'll give me an warning about RCS1231: Make parameter ref read-only. Yeah, I opened that warning for me.
But in this case, it shouldn't be added with in, or it'll give me another warning about Cannot return local variable 'item' by reference because it is not a 'ref' variable.

Is that possible to add an option about if it should work on ref struct?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions