Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove unnecessary unsafe #5802

Merged
merged 7 commits into from
Nov 7, 2023
Merged

Conversation

koivunej
Copy link
Member

@koivunej koivunej commented Nov 6, 2023

unsafe impls for Send and Sync should not be added by default. in the case of SlotGuard removing them does not cause any issues, as the compiler automatically derives those.

This PR adds requirement to document the unsafety (see clippy::undocumented_unsafe_blocks) and opportunistically adds #![deny(unsafe_code)] to most places where we don't have unsafe code right now.

TRPL on Send and Sync: https://doc.rust-lang.org/book/ch16-04-extensible-concurrency-sync-and-send.html

@koivunej koivunej requested a review from a team as a code owner November 6, 2023 15:59
@koivunej koivunej requested review from problame and removed request for a team November 6, 2023 15:59
@koivunej koivunej changed the title refactor remove unnecessary unsafe refactor: remove unnecessary unsafe Nov 6, 2023
@koivunej koivunej requested a review from jcsp November 6, 2023 15:59
@koivunej koivunej requested review from shanyp and arpad-m November 6, 2023 16:08
Copy link
Collaborator

@jcsp jcsp left a comment

Choose a reason for hiding this comment

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

Thanks for cleaning this up: that's my fault for adding some Send/Sync in some earlier variant of the code & not removing it later.

@koivunej
Copy link
Member Author

koivunej commented Nov 6, 2023

(moving the comment for walredo pre_exec soon, checking out other unsafety)

@koivunej
Copy link
Member Author

koivunej commented Nov 6, 2023

also adding the deny into .neon_clippy_args

Copy link

github-actions bot commented Nov 6, 2023

2358 tests run: 2243 passed, 0 failed, 115 skipped (full report)


Flaky tests (2)

Postgres 16

  • test_emergency_mode: debug

Postgres 14

  • test_restarts_frequent_checkpoints: release

Code coverage (full report)

  • functions: 54.6% (8877 of 16271 functions)
  • lines: 81.7% (51183 of 62642 lines)

The comment gets automatically updated with the latest test results
6ca3c27 at 2023-11-07T10:19:41.395Z :recycle:

@koivunej
Copy link
Member Author

koivunej commented Nov 6, 2023

I cannot find a way to add these to .neon_clippy_args while at the same time allowing them in postgres_ffi.

@koivunej koivunej marked this pull request as draft November 6, 2023 17:22
@koivunej koivunej force-pushed the remove_unnecessary_unsafe branch from 349c8d9 to 6ca3c27 Compare November 7, 2023 09:29
@koivunej koivunej marked this pull request as ready for review November 7, 2023 09:34
@koivunej koivunej requested review from a team as code owners November 7, 2023 09:34
@koivunej koivunej requested review from arssher, knizhnik and ololobus and removed request for a team November 7, 2023 09:34
@koivunej koivunej enabled auto-merge (squash) November 7, 2023 09:42
@koivunej koivunej merged commit 4be6bc7 into main Nov 7, 2023
34 checks passed
@koivunej koivunej deleted the remove_unnecessary_unsafe branch November 7, 2023 10:26
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.

5 participants