Skip to content

Conversation

djc
Copy link
Collaborator

@djc djc commented May 17, 2025

I tried running clippy and got this:

error: unsafe impl missing a safety comment
   --> src/internal.rs:308:1
    |
308 | unsafe impl Send for TaskThreadDataDelayedFg {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: consider adding a safety comment on the preceding line
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#undocumented_unsafe_blocks
note: the lint level is defined here
   --> lib.rs:9:9
    |
9   | #![deny(clippy::undocumented_unsafe_blocks)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: unsafe impl missing a safety comment
   --> src/internal.rs:310:1
    |
310 | unsafe impl Sync for TaskThreadDataDelayedFg {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: consider adding a safety comment on the preceding line
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#undocumented_unsafe_blocks

error: unsafe impl missing a safety comment
   --> src/internal.rs:440:1
    |
440 | unsafe impl Send for Rav1dContext {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: consider adding a safety comment on the preceding line
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#undocumented_unsafe_blocks

error: unsafe impl missing a safety comment
   --> src/internal.rs:442:1
    |
442 | unsafe impl Sync for Rav1dContext {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: consider adding a safety comment on the preceding line
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#undocumented_unsafe_blocks

clippy is configured like this:

#![allow(clippy::all)]
#![deny(clippy::undocumented_unsafe_blocks)]
#![deny(clippy::missing_safety_doc)]

It would be nice if these explicitly enabled clippy lints at least blocked PR CI.

@kkysen
Copy link
Collaborator

kkysen commented May 17, 2025

#1329 was supposed to fix the warnings, but we didn't have time to fix the issues with #1327 and then it languished.

@djc
Copy link
Collaborator Author

djc commented May 17, 2025

#1329 was supposed to fix the warnings, but we didn't have time to fix the issues with #1327 and then it languished.

Okay... this seems pretty important. Do you think we can get it fixed?

@kkysen
Copy link
Collaborator

kkysen commented May 23, 2025

Okay... this seems pretty important. Do you think we can get it fixed?

Yes, we should. I need to figure out the soundness issues with #1327 and Unique, although I can also merge that largely as is so that this PR gets unblocked, and leave an issue open to fix the Unique issues. The current unsafe impls aren't really any more sound than how I'm using Unique in #1327.

@djc
Copy link
Collaborator Author

djc commented May 26, 2025

Okay... this seems pretty important. Do you think we can get it fixed?

Yes, we should. I need to figure out the soundness issues with #1327 and Unique, although I can also merge that largely as is so that this PR gets unblocked, and leave an issue open to fix the Unique issues. The current unsafe impls aren't really any more sound than how I'm using Unique in #1327.

It's not that obvious to me how/why Unique is practically an improvement over the current situation, other than that it technically avoids these unsafe impl markers.

@kkysen
Copy link
Collaborator

kkysen commented May 27, 2025

It's not that obvious to me how/why Unique is practically an improvement over the current situation, other than that it technically avoids these unsafe impl markers.

That's more right than I thought. Feel free to add temporary // SAFETY: TODO ... comments to suppress the clippy warning for now so that we can run clippy in CI.

@djc djc force-pushed the clippy-ci branch 2 times, most recently from ca57d17 to c7332b9 Compare May 29, 2025 09:43
Copy link
Collaborator

@kkysen kkysen left a comment

Choose a reason for hiding this comment

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

We might be able to trim some of these CI jobs (I think there's some overlap), but it seems good for now.

@djc djc force-pushed the clippy-ci branch 3 times, most recently from 809365b to e62aa5a Compare May 30, 2025 09:12
@djc
Copy link
Collaborator Author

djc commented May 30, 2025

Dropped running clippy in the Android workflow, which seems to fail. It looks like there's not a lot of Android-specific code anyway, so I think it should be fine to land this -- can always expand with more coverage.

@djc djc merged commit 3dff5b5 into memorysafety:main May 30, 2025
28 checks passed
Copy link
Collaborator

@kkysen kkysen left a comment

Choose a reason for hiding this comment

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

Dropped running clippy in the Android workflow, which seems to fail. It looks like there's not a lot of Android-specific code anyway, so I think it should be fine to land this -- can always expand with more coverage.

Oh, it might be that the android target doesn't have clippy, since it's a tier 2 target without host tools.

@kkysen kkysen added the idiomaticity Make the Rust more idiomatic label Jun 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

idiomaticity Make the Rust more idiomatic

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Run clippy in CI

2 participants