Skip to content

docs: add unsafe code guidelines to CONTRIBUTING.md#5363

Closed
PranavAgarkar07 wants to merge 1 commit into
boa-dev:mainfrom
PranavAgarkar07:docs/unsafe-guidelines
Closed

docs: add unsafe code guidelines to CONTRIBUTING.md#5363
PranavAgarkar07 wants to merge 1 commit into
boa-dev:mainfrom
PranavAgarkar07:docs/unsafe-guidelines

Conversation

@PranavAgarkar07
Copy link
Copy Markdown

Summary

This PR addresses issue #4188 — adding comprehensive unsafe code guidelines to CONTRIBUTING.md.

Changes

Added an Unsafe Code Guidelines section to CONTRIBUTING.md covering:

  • General principles: unsafe as last resort, every block must be justified, MIRI testing
  • Documentation requirements with concrete code examples from the codebase:
    • unsafe fn declarations with # Safety sections
    • unsafe { } blocks with // SAFETY: comments
    • Unsafe match arms with discriminant justification
    • unsafe impl Trait contract documentation
  • Lint enforcement: unsafe_op_in_unsafe_fn, undocumented_unsafe_blocks, missing_safety_doc
  • Boa-specific patterns: #[repr(C)] for type-punning, _unchecked suffix convention
  • Testing requirements: MIRI testing, error path coverage, invariant tests

All examples are taken from actual Boa source code (boa_gc, boa_engine, boa_string) rather than fabricated snippets.

Related issue

Closes #4188

@github-actions github-actions Bot added the Waiting On Review Waiting on reviews from the maintainers label May 15, 2026
@github-actions github-actions Bot added this to the v1.0.0 milestone May 15, 2026
@github-actions github-actions Bot added C-Documentation update documentation C-CLI Issues and PRs related to the Boa command line interface. labels May 15, 2026
Added a comprehensive Unsafe Code Guidelines section covering safety
comment requirements, lint enforcement, type-punning conventions,
the _unchecked suffix pattern, and MIRI testing requirements.

Based on documented unsafe patterns in boa_gc, boa_engine, and boa_string.
Includes concrete examples from the codebase for every pattern.
@jedel1043 jedel1043 closed this May 15, 2026
@github-actions github-actions Bot removed the Waiting On Review Waiting on reviews from the maintainers label May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-CLI Issues and PRs related to the Boa command line interface. C-Documentation update documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Write guidelines around unsafe usage

2 participants