Skip to content

Conversation

@evshary
Copy link
Contributor

@evshary evshary commented Jan 28, 2026

Description

The PR is the 1st round review dealing with #1684.
We wanted to make sure

  1. Don't use unsafe fn if we can avoid the UB inside the function
  2. Every unsafe fn should include /// # Safety
  3. Enable unsafe_op_in_unsafe_fn, which will be enabled by default in Edition 2024
  4. Having // SAFETY before an unsafe block.

What does this PR do?

Fix the unsafe fn usage inside Zenoh

Why is this change needed?

Ensure that we are using unsafe correctly.

Related Issues

#1684


🏷️ Label-Based Checklist

Based on the labels applied to this PR, please complete these additional requirements:

Labels: enhancement

✨ Enhancement Requirements

Since this PR enhances existing functionality:

  • Enhancement scope documented - Clear description of what is being improved
  • Minimum necessary code - Implementation is as simple as possible, doesn't overcomplicate the system
  • Backwards compatible - Existing code/APIs still work unchanged
  • No new APIs added - Only improving existing functionality
  • Tests updated - Existing tests pass, new test cases added if needed
  • Performance improvement measured - If applicable, before/after metrics provided
  • Documentation updated - Existing docs updated to reflect improvements
  • User impact documented - How users benefit from this enhancement

Remember: Enhancements should not introduce new APIs or breaking changes.

Instructions:

  1. Check off items as you complete them (change - [ ] to - [x])
  2. The PR checklist CI will verify these are completed

This checklist updates automatically when labels change, but preserves your checked boxes.

Signed-off-by: ChenYing Kuo <evshary@gmail.com>
@evshary evshary mentioned this pull request Jan 28, 2026
@evshary evshary added the enhancement Existing things could work better label Jan 28, 2026
@codecov
Copy link

codecov bot commented Jan 28, 2026

Codecov Report

❌ Patch coverage is 40.00000% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.99%. Comparing base (b3b5161) to head (4f80769).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
commons/zenoh-util/src/ffi/mod.rs 0.00% 10 Missing ⚠️
commons/zenoh-util/src/lib_loader.rs 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2396      +/-   ##
==========================================
+ Coverage   71.95%   71.99%   +0.04%     
==========================================
  Files         390      390              
  Lines       62786    62790       +4     
==========================================
+ Hits        45176    45208      +32     
+ Misses      17610    17582      -28     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Existing things could work better

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant