Skip to content

Forbid unsafe code across all package targets#2

Merged
MagicalTux merged 2 commits into
masterfrom
forbid-unsafe-all-targets
Jun 4, 2026
Merged

Forbid unsafe code across all package targets#2
MagicalTux merged 2 commits into
masterfrom
forbid-unsafe-all-targets

Conversation

@MagicalTux

Copy link
Copy Markdown
Member

Summary

Extends the unsafe-code prohibition from the library to the entire package.

Previously only src/lib.rs carried #![forbid(unsafe_code)], which covers the published library but not the other targets that compile as separate crates: build.rs, the build_support/* helpers, examples/cacrt-tool.rs, and the tests.

This adds a single package-level lint:

[lints.rust]
unsafe_code = "forbid"

[lints] applies to every target in the package, so the build-time code generator and maintenance tooling are now covered too. The existing crate-level attribute in src/lib.rs is left in place.

Testing

  • cargo build --examples --tests — compiles clean, no conflict from the double forbid.

🤖 Generated with Claude Code

MagicalTux and others added 2 commits June 4, 2026 22:24
Add [lints.rust] unsafe_code = "forbid" to Cargo.toml so the guarantee
extends beyond the library (which already had #![forbid(unsafe_code)] in
src/lib.rs) to the build-time code generator, build_support helpers,
examples, and tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@MagicalTux MagicalTux merged commit 6a41b5f into master Jun 4, 2026
3 checks passed
@MagicalTux MagicalTux mentioned this pull request Jun 4, 2026
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.

1 participant