Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions library/std/src/sys/fs/unsupported.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,25 @@ pub struct FileType(!);
#[derive(Debug)]
pub struct DirBuilder {}

// Dummy Drops so that `needs_drop::<std::fs::File>()` etc. is true independent of platform,
// avoiding a portability hazard.
// The types not listed here are pure data and don’t implement Drop even when real.
impl Drop for File {
fn drop(&mut self) {
self.0
}
}
impl Drop for ReadDir {
fn drop(&mut self) {
self.0
}
}
impl Drop for DirEntry {
fn drop(&mut self) {
self.0
}
}

impl FileAttr {
pub fn size(&self) -> u64 {
self.0
Expand Down
7 changes: 7 additions & 0 deletions library/std/src/sys/fs/vexos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,13 @@ impl Drop for File {
}
}

impl Drop for ReadDir {
fn drop(&mut self) {
// Dummy Drop so that `needs_drop::<ReadDir>()` is true independent of platform.
self.0
}
}

pub fn readdir(_p: &Path) -> io::Result<ReadDir> {
// While there *is* a userspace function for reading file directories,
// the necessary implementation cannot currently be done cleanly, as
Expand Down
Loading