diff --git a/Cargo.toml b/Cargo.toml
index 17dee75..12bcc74 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "core_io"
-version = "0.0.20160708"
+version = "0.1.20160708"
authors = ["The Rust Project Developers", "Jethro Beekman"]
license = "MIT/Apache-2.0"
description = """
@@ -19,3 +19,7 @@ build = "build.rs"
[build-dependencies]
rustc_version = "0.1.7"
+
+[features]
+alloc = []
+collections = ["alloc"]
diff --git a/doc.sh b/doc.sh
index bb85974..baf91e0 100755
--- a/doc.sh
+++ b/doc.sh
@@ -1,2 +1,10 @@
#!/bin/bash
-cargo rustdoc -- --html-in-header <(echo '')
+cd "$(dirname "$0")"
+HIDE_DOCBLOCKS='.docblock>*, .collapse-toggle, #toggle-all-docs { display: none; } #core_io-show-docblock+p { display: initial }'
+FIX_ERRORSTRING='.method a.type[title="core_io::ErrorString"]:before { content: "Error"; }'
+rm -rf target/doc
+cargo rustdoc --features collections -- --html-in-header <(echo '')
+mv target/doc target/doc_collections
+cargo rustdoc --features alloc -- --html-in-header <(echo '')
+mv target/doc target/doc_alloc
+cargo rustdoc -- --html-in-header <(echo '')
diff --git a/src/lib.rs b/src/lib.rs
index 5576171..664a5f7 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -6,10 +6,35 @@
#![feature(question_mark,const_fn,collections,alloc,unicode,copy_from_slice,str_char)]
#![no_std]
-#[macro_use]
-extern crate collections;
-extern crate alloc;
+#[cfg_attr(feature="collections",macro_use)]
+#[cfg(feature="collections")] extern crate collections;
+#[cfg(feature="alloc")] extern crate alloc;
extern crate rustc_unicode;
+#[cfg(not(feature="collections"))]
+pub type ErrorString = &'static str;
+
+// Provide Box::new wrapper
+#[cfg(not(feature="alloc"))]
+struct FakeBox(core::marker::PhantomData);
+#[cfg(not(feature="alloc"))]
+impl FakeBox {
+ fn new(val: T) -> T {
+ val
+ }
+}
+
+// Needed for older compilers, to ignore vec!/format! macros in tests
+#[cfg(not(feature="collections"))]
+macro_rules! vec (
+ ( $ elem : expr ; $ n : expr ) => { () };
+ ( $ ( $ x : expr ) , * ) => { () };
+ ( $ ( $ x : expr , ) * ) => { () };
+);
+#[cfg(not(feature="collections"))]
+macro_rules! format {
+ ( $ ( $ arg : tt ) * ) => { () };
+}
+
include!(concat!(env!("OUT_DIR"), "/io.rs"));
pub use io::*;