Repository navigation
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
libc crate changelog major minor functions safe version history💡 Result:
Summary — what libc is and its version history
About “major / minor / functions / safe”
Where to get the authoritative changelog / releases
If you want, I can:
🏁 Script executed:
Repository: stratis-storage/libblkid-rs
Length of output: 210
🏁 Script executed:
Repository: stratis-storage/libblkid-rs
Length of output: 3976
Remove or correct the reason attribute —
major/minorare still unsafe.In libc 0.2.171,
major,minor, andmakedevbecameconst fn(#4208), not safe functions. The#[allow(unused_unsafe)]reason is inaccurate: these functions remain unsafe to call. Either remove the reason or update it to reflect why theunsafeblock is genuinely needed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Developers disagree w/ you and agree w/ me: bdrung/3cpio@52827a6 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Length of output: 987
🏁 Script executed:
Length of output: 0
🏁 Script executed:
Length of output: 1443
@mulkieran, you're absolutely right, and I apologize for the incorrect analysis.
The evidence from the commit you linked and the libc PR #4208 clearly shows that
makedev,major, andminorwere changed to safeconst fnin those versions, not justconst fn. As the PR description states: "makedev, major and minor are macros on most Unixes, there is no need for them to be unsafe."Your reason attributes are accurate:
#[allow(unused_unsafe)]is the correct way to handle the now-unnecessaryunsafeblocksThank you for the correction and the reference!
🐰💭
/_/
( o.o )
🧬 Code Graph Analysis Results
[src/devno.rs] lines (approximate extraction)
"""
pub fn from_device_numbers(major: maj_t, minor: min_t) -> Self {
#[allow(unused_unsafe, reason = "No longer unsafe in libc 0.2.133")]
BlkidDevno(unsafe { libc::makedev(major, minor) })
}
"""
"""
pub fn major(&self) -> maj_t {
#[allow(unused_unsafe, reason = "No longer unsafe in libc 0.2.171")]
unsafe {
libc::major(self.0)
}
}
"""
"""
pub fn minor(&self) -> min_t {
#[allow(unused_unsafe, reason = "No longer unsafe in libc 0.2.171")]
unsafe {
libc::minor(self.0)
}
}
"""