Skip to content

script: Wrap unsafe code in unsafe blocks for basic DOM types#37997

Merged
mrobinson merged 1 commit intoservo:mainfrom
mrobinson:start-wrapping-unsafe
Jul 11, 2025
Merged

script: Wrap unsafe code in unsafe blocks for basic DOM types#37997
mrobinson merged 1 commit intoservo:mainfrom
mrobinson:start-wrapping-unsafe

Conversation

@mrobinson
Copy link
Copy Markdown
Member

There is a new default cargo clippy lint, unsafe_op_in_unsafe_fn,
which requires unsafe code to be wrapped in unsafe blocks, even inside
functions marked as unsafe. The lint is disabled as much of our code
doesn't fulfill this contract. The thing itself is pretty useful in
order to gradually remove unsafety, so this change starts adding
unsafe blocks so we can eventually enable this lint.

Testing: This doesn't change behavior so existings tests should suffice.
Fixes: This is part of #35955.

There is a new default cargo clippy lint, `unsafe_op_in_unsafe_fn`,
which requires unsafe code to be wrapped in unsafe blocks, even inside
functions marked as unsafe. The lint is disabled as much of our code
doesn't fulfill this contract. The thing itself is pretty useful in
order to gradually remove unsafety, so this change starts adding
`unsafe` blocks so we can eventually enable this lint.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
@mrobinson mrobinson requested a review from gterzian as a code owner July 11, 2025 11:01
@mrobinson mrobinson changed the title script: Start wrapping unsafe code in unsafe blocks script: Wrapping unsafe code in unsafe blocks for basic DOM types Jul 11, 2025
@mrobinson mrobinson enabled auto-merge July 11, 2025 11:27
@mrobinson mrobinson added this pull request to the merge queue Jul 11, 2025
Merged via the queue into servo:main with commit 2366a8b Jul 11, 2025
22 checks passed
@mrobinson mrobinson deleted the start-wrapping-unsafe branch July 11, 2025 12:42
@mrobinson mrobinson changed the title script: Wrapping unsafe code in unsafe blocks for basic DOM types script: Wrap unsafe code in unsafe blocks for basic DOM types Jul 11, 2025
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