diff --git a/Cargo.toml b/Cargo.toml index 62692e5..d1d7562 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,8 +20,8 @@ travis-ci = { repository = "rafalh/rust-fatfs" } [features] # Use Rust std library std = [] -# Use dynamic allocation - required for LFN support -alloc = ["core_io/collections"] +# Use dynamic allocation - required for LFN support. When used without std please enable core_io/collections +alloc = [] # Default features default = ["chrono", "std", "alloc"] diff --git a/README.md b/README.md index f8a691a..b5e681a 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ Put this in your `Cargo.toml`: [dependencies] fatfs = { version = "0.2", features = ["core_io"], default-features = false } -Note: LFN support requires `alloc` feature and makes use of `alloc` crate. +Note: LFN support requires `alloc` and `core_io/collections` features and makes use of `alloc` crate. You may have to provide a memory allocator implementation. For building in `no_std` mode nightly Rust version compatible with current `core_io` crate is required. diff --git a/build-nostd.sh b/build-nostd.sh index 9dbd382..3982407 100755 --- a/build-nostd.sh +++ b/build-nostd.sh @@ -1,4 +1,4 @@ #!/bin/sh set -e cargo build --no-default-features --features core_io -cargo build --no-default-features --features core_io,alloc +cargo build --no-default-features --features core_io,alloc,core_io/collections diff --git a/src/lib.rs b/src/lib.rs index 77702ac..0cb032f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -22,7 +22,6 @@ extern crate chrono; extern crate core_io; #[cfg(all(not(feature = "std"), feature = "alloc"))] -#[macro_use] extern crate alloc; mod fs; @@ -31,7 +30,7 @@ mod dir_entry; mod file; mod table; -#[cfg(feature = "alloc")] +#[cfg(all(feature = "alloc"))] mod utils; #[cfg(not(feature = "std"))] @@ -54,5 +53,5 @@ pub use dir::*; pub use dir_entry::*; pub use file::*; -#[cfg(feature = "alloc")] +#[cfg(all(feature = "alloc"))] pub use utils::*;