Skip to content

docs(corelib): fix three doc-comment examples#10204

Open
orizi wants to merge 1 commit into
mainfrom
orizi/07-17-docs_corelib_fix_three_doc-comment_examples
Open

docs(corelib): fix three doc-comment examples#10204
orizi wants to merge 1 commit into
mainfrom
orizi/07-17-docs_corelib_fix_three_doc-comment_examples

Conversation

@orizi

@orizi orizi commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes three small documentation bugs in the corelib:

  • ops/function.cairo: Corrects a misplaced code fence in the FnOnce doc comment. The opening ``` was placed before the # Examples header instead of after it, and the closing ``` was missing entirely.
  • option.cairo: Adds a missing semicolon at the end of the let o: Option<u8> = 67_u8.into() statement in the TIntoOption example.
  • zeroable.cairo: Fixes the type used in the Zeroable::zero example from i32 to u32, matching the trait's typical usage with unsigned integers.

Type of change

Please check one:

  • Bug fix (fixes incorrect behavior)
  • New feature
  • Performance improvement
  • Documentation change with concrete technical impact
  • Style, wording, formatting, or typo-only change

Why is this change needed?

The FnOnce doc comment had a malformed code block that would render incorrectly in generated documentation. The option.cairo example had a syntax error (missing semicolon) that would fail if executed. The zeroable.cairo example referenced i32, which is inconsistent with the unsigned integer context typically associated with Zeroable.


What was the behavior or documentation before?

  • FnOnce: The ``` opening fence appeared before # Examples, and the closing fence was absent, causing the entire example to render as a broken code block.
  • TIntoOption: The example statement 67_u8.into() lacked a terminating semicolon.
  • Zeroable::zero: The example used Zeroable::<i32>::zero().

What is the behavior or documentation after?

  • FnOnce: The code fence is correctly placed after # Examples, and the closing fence is present.
  • TIntoOption: The example statement is syntactically valid with a semicolon.
  • Zeroable::zero: The example uses Zeroable::<u32>::zero().

Related issue or discussion (if any)

None.


Additional context

None.

- option: add missing `;` in the `Into<T, Option<T>>` example so it compiles
- ops::function: close the `FnOnce` code fence and move it after `# Examples`
  (odd fence count was swallowing the heading in rendered docs)
- zeroable: use `u32` instead of `i32` in the `Zeroable::zero` example
  (`Zeroable` is not implemented for signed integers)
@reviewable-StarkWare

Copy link
Copy Markdown

This change is Reviewable

orizi commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@orizi
orizi marked this pull request as ready for review July 17, 2026 08:03
@cursor

cursor Bot commented Jul 17, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Comment-only edits with no runtime or API behavior changes.

Overview
Fixes documentation-only issues in three corelib doc-comment examples so they render and read correctly.

In ops/function.cairo, the FnOnce example block is repaired: the opening fence now follows # Examples, and a closing fence is added so the snippet is a proper fenced block.

In option.cairo, the TIntoOption example adds a semicolon after 67_u8.into().

In zeroable.cairo, the Zeroable::zero example switches from i32 to u32 in the type argument.

Reviewed by Cursor Bugbot for commit edc03ab. Bugbot is set up for automated code reviews on this repo. Configure here.

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