-
Notifications
You must be signed in to change notification settings - Fork 19
fix arm64 build #264
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
base: main
Are you sure you want to change the base?
fix arm64 build #264
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -419,11 +419,11 @@ impl TryFrom<&libc::stat> for FileAttr { | |
| ino: NodeID::from_raw(st.st_ino).ok_or(TryIntoFileAttrError::InvalidNodeID)?, | ||
| size: transmute!(st.st_size), | ||
| mode: FileMode::from_raw(st.st_mode), | ||
| nlink: st.st_nlink.try_into()?, | ||
| nlink: (st.st_nlink as u64).try_into()?, | ||
| uid: Uid::from_raw(st.st_uid), | ||
| gid: Gid::from_raw(st.st_gid), | ||
| rdev: DeviceID::from_userspace_dev(st.st_rdev), | ||
| blksize: st.st_blksize.try_into()?, | ||
| blksize: (st.st_blksize as u64).try_into()?, | ||
| blocks: transmute!(st.st_blocks), | ||
| atime: Duration::new(transmute!(st.st_atime), st.st_atime_nsec as _), | ||
| mtime: Duration::new(transmute!(st.st_mtime), st.st_mtime_nsec as _), | ||
|
|
@@ -449,11 +449,11 @@ impl TryFrom<&Metadata> for FileAttr { | |
| ino: NodeID::from_raw(m.ino()).ok_or(TryIntoFileAttrError::InvalidNodeID)?, | ||
| size: m.size(), | ||
| mode: FileMode::from_raw(m.mode()), | ||
| nlink: m.nlink().try_into()?, | ||
| nlink: (m.nlink() as u64).try_into()?, | ||
| uid: Uid::from_raw(m.uid()), | ||
| gid: Gid::from_raw(m.gid()), | ||
| rdev: DeviceID::from_userspace_dev(m.rdev()), | ||
| blksize: m.blksize().try_into()?, | ||
| blksize: (m.blksize() as u64).try_into()?, | ||
|
Comment on lines
+452
to
+456
|
||
| blocks: m.blocks(), | ||
| atime: Duration::new(transmute!(m.atime()), m.atime_nsec() as _), | ||
| mtime: Duration::new(transmute!(m.mtime()), m.mtime_nsec() as _), | ||
|
|
||
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.
Using
(st.st_nlink as u64).try_into()?/(st.st_blksize as u64).try_into()?works around theInfallibleerror-type mismatch on platforms where the source field is alreadyu32, but it does so by forcing anascast. A more direct (and easier to reason about) fix is to makeTryIntoFileAttrErrorconvertible fromstd::convert::Infallible(e.g., via aFrom<Infallible>impl that is unreachable), or explicitly handle theInfalliblecase when callingtry_into(). That would allow keeping the originaltry_into()?without widening casts and keeps the intent clearer across architectures.