diff --git a/CHANGELOG.md b/CHANGELOG.md index 41a6d8d4d4..325f530ede 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +UNRELEASED +========== + +New features: + +* [FEATURE #474](https://github.com/rust-lang/regex/issues/474): + The `use_std` feature has been deprecated in favor of the `std` feature. + The `use_std` feature will be removed in regex 2. Until then, `use_std` will + remain as an alias for the `std` feature. + + 1.2.1 (2019-08-03) ================== This release does a bit of house cleaning. Namely: diff --git a/Cargo.toml b/Cargo.toml index 7ae61bc5fe..5a859f54bb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,17 +45,22 @@ rand = "0.6.5" doc-comment = "0.3" [features] -default = ["use_std"] -# The 'use_std' feature permits the regex crate to use the standard library. -# This is intended to support future use cases where the regex crate may be -# able to compile without std, and instead just rely on 'core' and 'alloc' -# (for example). Currently, this isn't supported, and removing the 'use_std' -# feature will prevent regex from compiling. -use_std = [] +default = ["std"] +# The 'std' feature permits the regex crate to use the standard library. This +# is intended to support future use cases where the regex crate may be able +# to compile without std, and instead just rely on 'core' and 'alloc' (for +# example). Currently, this isn't supported, and removing the 'std' feature +# will prevent regex from compiling. +std = [] +# The 'use_std' feature is DEPRECATED. It will be removed in regex 2. Until +# then, it is alias for the 'std' feature. +use_std = ["std"] + # A blanket feature that governs whether unstable features are enabled or not. # Unstable features are disabled by default, and typically rely on unstable # features in rustc itself. unstable = ["pattern"] + # Enable to use the unstable pattern traits defined in std. This is enabled # by default if the unstable feature is enabled. pattern = [] diff --git a/src/lib.rs b/src/lib.rs index 4aa4eaa0a3..154427d023 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -22,7 +22,7 @@ used by adding `regex` to your dependencies in your project's `Cargo.toml`. regex = "1" ``` -and this to your crate root: +If you're using Rust 2015, then you'll also need to add it to your crate root: ```rust extern crate regex; @@ -511,8 +511,8 @@ another matching engine with fixed memory requirements. #![cfg_attr(test, deny(warnings))] #![cfg_attr(feature = "pattern", feature(pattern))] -#[cfg(not(feature = "use_std"))] -compile_error!("`use_std` feature is currently required to build this crate"); +#[cfg(not(feature = "std"))] +compile_error!("`std` feature is currently required to build this crate"); extern crate aho_corasick; extern crate memchr; @@ -527,16 +527,16 @@ extern crate regex_syntax as syntax; #[cfg(test)] doc_comment::doctest!("../README.md"); -#[cfg(feature = "use_std")] +#[cfg(feature = "std")] pub use error::Error; -#[cfg(feature = "use_std")] +#[cfg(feature = "std")] pub use re_builder::set_unicode::*; -#[cfg(feature = "use_std")] +#[cfg(feature = "std")] pub use re_builder::unicode::*; -#[cfg(feature = "use_std")] +#[cfg(feature = "std")] pub use re_set::unicode::*; -#[cfg(feature = "use_std")] -#[cfg(feature = "use_std")] +#[cfg(feature = "std")] +#[cfg(feature = "std")] pub use re_unicode::{ escape, CaptureLocations, CaptureMatches, CaptureNames, Captures, Locations, Match, Matches, NoExpand, Regex, Replacer, ReplacerRef, Split, @@ -630,7 +630,7 @@ When the `s` flag is enabled, `.` matches any byte. In general, one should expect performance on `&[u8]` to be roughly similar to performance on `&str`. */ -#[cfg(feature = "use_std")] +#[cfg(feature = "std")] pub mod bytes { pub use re_builder::bytes::*; pub use re_builder::set_bytes::*; @@ -663,7 +663,7 @@ mod utf8; /// testing different matching engines and supporting the `regex-debug` CLI /// utility. #[doc(hidden)] -#[cfg(feature = "use_std")] +#[cfg(feature = "std")] pub mod internal { pub use compile::Compiler; pub use exec::{Exec, ExecBuilder};