Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disallow ref field to ref struct #62186

Merged
merged 1 commit into from
Jun 29, 2022
Merged

Conversation

cston
Copy link
Member

@cston cston commented Jun 28, 2022

Disallow ref fields of ref struct type, to simplify escape analysis.

Relates to test plan #59194

@cston cston requested a review from a team as a code owner June 28, 2022 16:42
@cston cston requested review from jaredpar, RikkiGibson, AlekseyTs and a team and removed request for a team June 28, 2022 16:44
@jcouv jcouv added the Bug label Jun 28, 2022
@jcouv jcouv added this to the 17.4 milestone Jun 28, 2022
@RikkiGibson RikkiGibson self-assigned this Jun 28, 2022
@cston cston changed the base branch from main to release/dev17.3 June 28, 2022 22:12
@RikkiGibson RikkiGibson modified the milestones: 17.4, 17.3 Jun 28, 2022
.class public sealed R2 extends [mscorlib]System.ValueType
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.IsByRefLikeAttribute::.ctor() = (01 00 00 00)
.field public valuetype R1& F
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated: do we give a use-site error when a non-ref struct contains a ref field?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we give a use-site error when a non-ref struct contains a ref field?

No, we're not reporting a use-site error for use of such a field currently. There is an item in the test plan, and I'll add this in a follow-up PR.

@AlekseyTs
Copy link
Contributor

AlekseyTs commented Jun 29, 2022

Do we have an issue tracking the work to re-enable this scenario?

Copy link
Contributor

@AlekseyTs AlekseyTs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (commit 1)

@cston cston merged commit 65eb3f5 into dotnet:release/dev17.3 Jun 29, 2022
@cston cston deleted the no-ref-ref-struct branch June 29, 2022 16:51
@cston
Copy link
Member Author

cston commented Jun 29, 2022

Do we have an issue tracking the work to re-enable this scenario?

#62243

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants