From 87558a9b0ed17934b719fc781d4e9c2f4323f054 Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Mon, 30 Aug 2021 17:32:47 +0200 Subject: [PATCH] feat(vfs) `mem-fs` does not support `enable-serde`. --- lib/vfs/src/lib.rs | 3 +++ lib/vfs/src/mem_fs/file.rs | 2 -- lib/vfs/src/mem_fs/file_opener.rs | 2 -- lib/vfs/src/mem_fs/filesystem.rs | 2 -- lib/vfs/src/mem_fs/stdio.rs | 4 ---- 5 files changed, 3 insertions(+), 10 deletions(-) diff --git a/lib/vfs/src/lib.rs b/lib/vfs/src/lib.rs index 50a80edbad5..d69f52e8c13 100644 --- a/lib/vfs/src/lib.rs +++ b/lib/vfs/src/lib.rs @@ -8,6 +8,9 @@ use thiserror::Error; #[cfg(all(not(feature = "host-fs"), not(feature = "mem-fs")))] compile_error!("At least the `host-fs` or the `mem-fs` feature must be enabled. Please, pick one."); +#[cfg(all(feature = "mem-fs", feature = "enable-serde"))] +compile_error!("`mem-fs` does not support `enable-serde` for the moment."); + #[cfg(feature = "host-fs")] pub mod host_fs; #[cfg(feature = "mem-fs")] diff --git a/lib/vfs/src/mem_fs/file.rs b/lib/vfs/src/mem_fs/file.rs index fe0862ee000..58474665f22 100644 --- a/lib/vfs/src/mem_fs/file.rs +++ b/lib/vfs/src/mem_fs/file.rs @@ -4,8 +4,6 @@ use super::*; use crate::{FileDescriptor, FsError, Result, VirtualFile}; -#[cfg(feature = "enable-serde")] -use serde::{Deserialize, Serialize}; use std::cmp; use std::convert::TryInto; use std::fmt; diff --git a/lib/vfs/src/mem_fs/file_opener.rs b/lib/vfs/src/mem_fs/file_opener.rs index 19bc34f0f33..08348aabfa4 100644 --- a/lib/vfs/src/mem_fs/file_opener.rs +++ b/lib/vfs/src/mem_fs/file_opener.rs @@ -1,7 +1,5 @@ use super::*; use crate::{FileType, FsError, Metadata, OpenOptionsConfig, Result, VirtualFile}; -#[cfg(feature = "enable-serde")] -use serde::{Deserialize, Serialize}; use std::io::{self, Seek}; use std::path::Path; diff --git a/lib/vfs/src/mem_fs/filesystem.rs b/lib/vfs/src/mem_fs/filesystem.rs index 9e2913ed7bc..6f08142ce76 100644 --- a/lib/vfs/src/mem_fs/filesystem.rs +++ b/lib/vfs/src/mem_fs/filesystem.rs @@ -2,8 +2,6 @@ use super::*; use crate::{DirEntry, FileType, FsError, Metadata, OpenOptions, ReadDir, Result}; -#[cfg(feature = "enable-serde")] -use serde::{Deserialize, Serialize}; use slab::Slab; use std::convert::identity; use std::ffi::OsString; diff --git a/lib/vfs/src/mem_fs/stdio.rs b/lib/vfs/src/mem_fs/stdio.rs index 9f4df6378db..db47ef33b41 100644 --- a/lib/vfs/src/mem_fs/stdio.rs +++ b/lib/vfs/src/mem_fs/stdio.rs @@ -2,8 +2,6 @@ //! `stdin`, `stdout` and `stderr`. use crate::{FileDescriptor, FsError, Result, VirtualFile}; -#[cfg(feature = "enable-serde")] -use serde::{Deserialize, Serialize}; use std::io::{self, Read, Seek, Write}; macro_rules! impl_virtualfile_on_std_streams { @@ -11,7 +9,6 @@ macro_rules! impl_virtualfile_on_std_streams { /// A wrapper type around the standard I/O stream of the same /// name that implements `VirtualFile`. #[derive(Debug, Default)] - #[cfg_attr(feature = "enable-serde", derive(Serialize, Deserialize))] pub struct $name { pub buf: Vec, } @@ -26,7 +23,6 @@ macro_rules! impl_virtualfile_on_std_streams { } } - #[cfg_attr(feature = "enable-serde", typetag::serde)] impl VirtualFile for $name { fn last_accessed(&self) -> u64 { 0