Skip to content

Remove unnecessary unsafe from time refcount rules - #495

Merged
nunoplopes merged 2 commits into
masterfrom
copilot/remove-unsafe-from-time-refcount-rules
Oct 8, 2026
Merged

nunoplopes merged 2 commits into
masterfrom
copilot/remove-unsafe-from-time-refcount-rules

Conversation

Copilot AI commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Three clock-ID helper functions in the time refcount rules were declared unsafe even though they only return nix::time::ClockId constants.

  • rules/time/tgt_refcount.rs
    • Dropped unsafe from f9 (CLOCK_REALTIME), f10 (CLOCK_MONOTONIC) and f11 (CLOCK_MONOTONIC_RAW, Linux only).
// before
unsafe fn f9() -> nix::time::ClockId { nix::time::ClockId::CLOCK_REALTIME }
// after
fn f9() -> nix::time::ClockId { nix::time::ClockId::CLOCK_REALTIME }

I haven't built this or run the tests. Please check CI to confirm the rules still compile and the translated output is unchanged.

Copilot AI linked an issue Oct 8, 2026 that may be closed by this pull request
Co-authored-by: nunoplopes <[email protected]>
Copilot AI changed the title [WIP] Remove unsafe from time refcount rules Remove unnecessary unsafe from time refcount rules Oct 8, 2026
Copilot AI requested a review from nunoplopes October 8, 2026 11:05
@lucic71

lucic71 commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Please also add a check in rule-preprocessor that refuses refcount rules that contain unsafe fn

@nunoplopes
nunoplopes marked this pull request as ready for review October 8, 2026 11:08
@nunoplopes
nunoplopes merged commit 3aca9e8 into master Oct 8, 2026
9 checks passed
@nunoplopes
nunoplopes deleted the copilot/remove-unsafe-from-time-refcount-rules branch October 8, 2026 11:17
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.

Remove unsafe from time refcount rules

3 participants