Skip to content

Forbid unsafe_code#294

Merged
KodrAus merged 1 commit intobitflags:mainfrom
fintelia:forbid-unsafe
Jan 31, 2023
Merged

Forbid unsafe_code#294
KodrAus merged 1 commit intobitflags:mainfrom
fintelia:forbid-unsafe

Conversation

@fintelia
Copy link
Copy Markdown
Contributor

@fintelia fintelia commented Jan 2, 2023

Fixes #222. Contrary to what is mentioned there, removing this annotation would not constitute a breaking change requiring a major version bump (at least according to normal Rust conventions). It is merely an assertion that the current patch release contains no unsafe code.

Looking for #![forbid(unsafe_code)] is more reliable than trying to grep the crate source code for instances of "unsafe", since the latter could hypothetically be concealed by macros and such.

Copy link
Copy Markdown
Member

@KodrAus KodrAus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @fintelia 👍 I think this is something I'd be comfortable doing now. My comment about major version bumps was less about semver compatibility and more about making a reasonable commitment to users who care about the presence of unsafe code in their dependencies. You certainly should expect unsafe code to appear or disappear in patches, but I see #[forbid(unsafe_code)] also as a design guideline to avoid any solutions that require unsafe code.

@KodrAus KodrAus merged commit 5b36ce5 into bitflags:main Jan 31, 2023
@fintelia fintelia deleted the forbid-unsafe branch January 31, 2023 07:49
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.

forbid unsafe_code in the library code?

2 participants