Skip to content

Add DDoc behavior flags for noalloc/nogc/nothrow/pure. - #23775

Open
LightBender wants to merge 7 commits into
dlang:masterfrom
LightBender:ddoc-attrs
Open

Add DDoc behavior flags for noalloc/nogc/nothrow/pure.#23775
LightBender wants to merge 7 commits into
dlang:masterfrom
LightBender:ddoc-attrs

Conversation

@LightBender

@LightBender LightBender commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

This PR adds behavior flags to DDoc output for the @nogc, nothrow, and pure attributes, as well as adding a new noalloc flag for stating that no allocations of any kind are performed.

The flags will be added automatically when the attributes are present or added manually in the documentation comments. Flags are de-duplicated.

LLM Prompts:

  • I would like to add four new Macros (or Markup-tags?) to DDoc (See: doc.d ): NOALLOC, NOGC, NOTHROW, PURE. These tags should then generate a "flag" in the documentation output. These behavior flags can look similar to the "build status tags found in GitHub readmes, each should only be displayed when specified, and each should be a different color to aid in quickly determining what behaviors are offered.
  • Next let's automatically add these flags when the corresponding attribute is encountered in the code (with the exception of the NOALLOC flag, which has no attribute). We need to continue to allow the programmer to manually add these flags to the doc comments, but they should always be emitted under the "title" of the doc section regardless of where it is used in the documentation comments. Duplicates should be collapsed into a single output.
  • Finally we need to add unittests where possible and then run them, then build DMD and run the ddoc generation against the DRuntime so that we see the final behavior flag layout.

Screen capture of the output:
image

@rikkimax rikkimax added the Review:Needs Spec PR A PR updating the language specification needs to be submitted to dlang.org label Sep 3, 2026
@thewilsonator thewilsonator added the Review:Needs Changelog A changelog entry needs to be added to /changelog label Sep 3, 2026
@thewilsonator thewilsonator removed Review:Needs Changelog A changelog entry needs to be added to /changelog Review:Needs Spec PR A PR updating the language specification needs to be submitted to dlang.org labels Sep 3, 2026
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.

3 participants