Skip to content

regex 1.0 #471

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
May 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ dist: trusty
sudo: false
language: rust
rust:
- 1.12.0
- 1.20.0
- stable
- beta
- nightly
Expand Down
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
1.0.0 (2018-05-01)
==================
This release marks the 1.0 release of regex.

While this release includes some breaking changes, most users of older versions
of the regex library should be able to migrate to 1.0 by simply bumping the
version number. The important changes are as follows:

* We adopt Rust 1.20 as the new minimum supported version of Rust for regex.
We also tentativley adopt a policy that permits bumping the minimum supported
version of Rust in minor version releases of regex, but no patch releases.
That is, with respect to semver, we do not strictly consider bumping the
minimum version of Rust to be a breaking change, but adopt a conservative
stance as a compromise.
* Octal syntax in regular expressions has been disabled by default. This
permits better error messages that inform users that backreferences aren't
available. Octal syntax can be re-enabled via the corresponding option on
`RegexBuilder`.
* `(?-u:\B)` is no longer allowed in Unicode regexes since it can match at
invalid UTF-8 code unit boundaries. `(?-u:\b)` is still allowed in Unicode
regexes.
* The `From<regex_syntax::Error>` impl has been removed. This formally removes
the public dependency on `regex-syntax`.
* A new feature, `use_std`, has been added and enabled by default. Disabling
the feature will result in a compilation error. In the future, this may
permit us to support `no_std` environments (w/ `alloc`) in a backwards
compatible way.

For more information and discussion, please see
[1.0 release tracking issue](https://github.com/rust-lang/regex/issues/457).


0.2.11 (2018-05-01)
===================
This release primarily contains bug fixes. Some of them resolve bugs where
Expand Down
14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,20 @@ quickcheck = { version = "0.6", default-features = false }
rand = "0.4"

[features]
# We don't enable any features by default currently, but if the compiler
# supports a specific type of feature, then regex's build.rs might enable
# some default features.
default = []
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 = []
# 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 = []
# Enable to use simd acceleration.
# Note that this is deprecated and is a no-op.
simd-accel = []

[lib]
# There are no benchmarks in the library code itself
Expand Down
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ by [RE2](https://github.com/google/re2).
[![Build status](https://ci.appveyor.com/api/projects/status/github/rust-lang/regex?svg=true)](https://ci.appveyor.com/project/rust-lang-libs/regex)
[![Coverage Status](https://coveralls.io/repos/github/rust-lang/regex/badge.svg?branch=master)](https://coveralls.io/github/rust-lang/regex?branch=master)
[![](http://meritbadge.herokuapp.com/regex)](https://crates.io/crates/regex)
[![Rust](https://img.shields.io/badge/rust-1.20%2B-blue.svg?maxAge=3600)](https://github.com/rust-lang/regex)

### Documentation

Expand Down Expand Up @@ -210,7 +211,22 @@ recommended for general use.

[Documentation `regex-syntax`.](https://docs.rs/regex-syntax)

# License

### Minimum Rust version policy

This crate's minimum supported `rustc` version is `1.20.0`.

The current **tentative** policy is that the minimum Rust version required to
use this crate can be increased in minor version updates. For example, if
regex 1.0.0 requires Rust 1.20.0, then regex 1.0.z for all values of `z` will
also require Rust 1.20.0 or newer. However, regex 1.y for `y > 0` may require
a newer minimum version of Rust.

In general, this crate will be conservative with respect to the minimum
supported version of Rust.


### License

This project is licensed under either of

Expand Down
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fn main() {
let version = String::from_utf8(output).unwrap();

// If we're using nightly Rust, then we can enable vector optimizations.
// Note that these aren't actually activated unless the `nightly` feature
// Note that these aren't actually activated unless the `unstable` feature
// is enabled.
//
// We also don't activate these if we've explicitly disabled auto
Expand Down
9 changes: 0 additions & 9 deletions ci/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,6 @@ set -ex
cargo build --verbose
cargo doc --verbose

# If we're testing on an older version of Rust, then only check that we
# can build the crate. This is because the dev dependencies might be updated
# more frequently, and therefore might require a newer version of Rust.
#
# This isn't ideal. It's a compromise.
if [ "$TRAVIS_RUST_VERSION" = "1.12.0" ]; then
exit
fi

# Run tests. If we have nightly, then enable our nightly features.
if [ "$TRAVIS_RUST_VERSION" = "nightly" ]; then
cargo test --verbose --features unstable
Expand Down
20 changes: 10 additions & 10 deletions regex-debug/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ fn cmd_ast(args: &Args) -> Result<()> {
use syntax::ast::parse::Parser;

let mut parser = Parser::new();
let ast = try!(parser.parse(&args.arg_pattern));
let ast = parser.parse(&args.arg_pattern)?;
println!("{:#?}", ast);
Ok(())
}
Expand All @@ -134,13 +134,13 @@ fn cmd_hir(args: &Args) -> Result<()> {
let mut parser = ParserBuilder::new()
.allow_invalid_utf8(false)
.build();
let hir = try!(parser.parse(&args.arg_pattern));
let hir = parser.parse(&args.arg_pattern)?;
println!("{:#?}", hir);
Ok(())
}

fn cmd_literals(args: &Args) -> Result<()> {
let exprs = try!(args.parse_many());
let exprs = args.parse_many()?;
let mut lits =
if args.cmd_prefixes {
args.literals(&exprs, |lits, e| lits.union_prefixes(e))
Expand Down Expand Up @@ -173,7 +173,7 @@ fn cmd_literals(args: &Args) -> Result<()> {
}

fn cmd_anchors(args: &Args) -> Result<()> {
let expr = try!(args.parse_one());
let expr = args.parse_one()?;
if expr.is_anchored_start() {
println!("start");
}
Expand All @@ -184,8 +184,8 @@ fn cmd_anchors(args: &Args) -> Result<()> {
}

fn cmd_captures(args: &Args) -> Result<()> {
let expr = try!(args.parse_one());
let prog = try!(args.compiler().only_utf8(false).compile(&[expr]));
let expr = args.parse_one()?;
let prog = args.compiler().only_utf8(false).compile(&[expr])?;
for (i, name) in prog.captures.iter().enumerate() {
match *name {
None => println!("{}", i),
Expand All @@ -196,14 +196,14 @@ fn cmd_captures(args: &Args) -> Result<()> {
}

fn cmd_compile(args: &Args) -> Result<()> {
let exprs = try!(args.parse_many());
let exprs = args.parse_many()?;
let compiler =
args.compiler()
.bytes(args.flag_bytes)
.only_utf8(!args.flag_bytes)
.dfa(args.flag_dfa)
.reverse(args.flag_dfa_reverse);
let prog = try!(compiler.compile(&exprs));
let prog = compiler.compile(&exprs)?;
print!("{:?}", prog);
Ok(())
}
Expand All @@ -213,9 +213,9 @@ fn cmd_utf8_ranges(args: &Args) -> Result<()> {
use syntax::hir::{self, HirKind};
use utf8_ranges::Utf8Sequences;

let hir = try!(ParserBuilder::new()
let hir = ParserBuilder::new()
.build()
.parse(&format!("[{}]", args.arg_class)));
.parse(&format!("[{}]", args.arg_class))?;
let cls = match hir.into_kind() {
HirKind::Class(hir::Class::Unicode(cls)) => cls,
_ => return Err(
Expand Down
Loading