Skip to content

Commit

Permalink
Remove alloc feature
Browse files Browse the repository at this point in the history
`boba` has a required dependency on the `alloc` crate, but gates the
availability of the `alloc` crate with the `alloc` feature.

`boba` does not build with no default features as a result. The docs
lead me to believe this was intentional, but with new CI steps in #159,
all Artichoke crates must build and pass a docs build with no default
features.

This will require a semver major bump.
  • Loading branch information
lopopolo committed Aug 7, 2022
1 parent aa05c9f commit d598a93
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 20 deletions.
7 changes: 1 addition & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@ include = ["src/**/*", "tests/**/*", "LICENSE", "README.md"]
default = ["std"]
# Enable dependency on `std`, the Rust standard library. This feature enables
# `std::error::Error` implementations on the error types in `boba`.
std = ["alloc"]
# Enable a dependency on the `alloc` crate. This feature grants `boba` access to
# the `Vec` and `String` types. This feature is currently required to build
# `boba`, but exists to enable adding a slice-based, no allocator API in a
# backwards-compatible way.
alloc = []
std = []

[dependencies]

Expand Down
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ Boba has several Cargo features, all of which are enabled by default:
- **std** - Adds a dependency on [`std`], the Rust Standard Library. This
feature enables [`std::error::Error`] implementations on error types in this
crate. Enabling the **std** feature also enables the **alloc** feature.
- **alloc** - Adds a dependency on [`alloc`], the Rust allocation and
collections library. Currently, Boba requires this feature to build, but may
relax this requirement in the future.

`boba` is [fuzzed](fuzz/fuzz_targets) with [cargo-fuzz].

Expand Down
1 change: 0 additions & 1 deletion src/decode.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#[cfg(feature = "alloc")]
use alloc::vec::Vec;

use crate::DecodeError;
Expand Down
1 change: 0 additions & 1 deletion src/encode.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#[cfg(feature = "alloc")]
use alloc::string::String;

const VOWELS: [u8; 6] = *b"aeiouy";
Expand Down
10 changes: 1 addition & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@
//! feature enables [`std::error::Error`] implementations on error types in
//! this crate. Enabling the **std** feature also enables the **alloc**
//! feature.
//! - **alloc** - Adds a dependency on [`alloc`], the Rust allocation and
//! collections library. Currently, Boba requires this feature to build, but
//! may relax this requirement in the future.
//!
//! [perl-bubblebabble]: https://metacpan.org/pod/Digest::BubbleBabble
//! [ruby-bubblebabble]: https://ruby-doc.org/stdlib-3.1.1/libdoc/digest/rdoc/Digest.html#method-c-bubblebabble
Expand All @@ -94,19 +91,14 @@ macro_rules! readme {
readme!(include_str!("../README.md"));
};
}
#[cfg(all(feature = "alloc", doctest))]
#[cfg(doctest)]
readme!();

// Without the `alloc` feature, build `boba` without alloc.
// This configuration is unsupported and will result in a compile error.
#[cfg(feature = "alloc")]
extern crate alloc;
#[cfg(feature = "std")]
extern crate std;

#[cfg(feature = "alloc")]
use alloc::string::String;
#[cfg(feature = "alloc")]
use alloc::vec::Vec;
use core::fmt;

Expand Down

0 comments on commit d598a93

Please sign in to comment.