Skip to content

Document ECMA-335 augment III.1.7.7 recognition for UnscopedRefAttribute and RefSafetyRulesAttribute#12902

Draft
jakobbotsch with Copilot wants to merge 3 commits into
mainfrom
copilot/add-documentation-unscopedref-and-refsafetyrules
Draft

Document ECMA-335 augment III.1.7.7 recognition for UnscopedRefAttribute and RefSafetyRulesAttribute#12902
jakobbotsch with Copilot wants to merge 3 commits into
mainfrom
copilot/add-documentation-unscopedref-and-refsafetyrules

Conversation

Copilot AI commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Documents that UnscopedRefAttribute and RefSafetyRulesAttribute are specially recognized by the runtime per ECMA-335 augment III.1.7.7 (from dotnet/runtime#130863), and links out to the augment for the full IL restriction rules.

Changes

  • UnscopedRefAttribute — Added remarks explaining the augment: applying it to a value type instance method lets this escape; when absent, an optimizing compiler can rely on this not escaping (e.g., to eliminate boxing). Notes the runtime relies on it (can't be stripped) and that its effect only holds in a module also annotated with RefSafetyRulesAttribute.
  • RefSafetyRulesAttribute — Replaced the placeholder remarks with a description of the module-level opt-in and version value, links to the augment, and notes the runtime can't strip it.

Both entries follow repo style (contractions, "might"/"can" over "may") and link to the augment's #iii177-opt-in-restrictions anchor. No claim that dynamic IL emitters must apply either attribute, since omitting them is always conservatively correct.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants