]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #42428 - scottmcm:str-get-overflow, r=sfackler
authorCorey Farwell <coreyf@rwell.org>
Tue, 13 Jun 2017 21:14:59 +0000 (17:14 -0400)
committerGitHub <noreply@github.com>
Tue, 13 Jun 2017 21:14:59 +0000 (17:14 -0400)
Add overflow checking for `str::get` with inclusive ranges

Fixes https://github.com/rust-lang/rust/issues/42401

Two commits here:

1. The first makes `str::index` just call `SliceIndex<str>::index`.  It's intended to have no behavior change, except where the two methods were inconsistent.
2. The second actually adds the overflow checking to `get(_mut)` (and tests for it)

1  2 
src/libcollections/tests/lib.rs

index 5f5217b73c2596ee2ff6de6e23c643cab30be58f,f64a549a05d4d72048e82df9bd35bfcd5631647a..c6f0b4436bb3179d361e8ac3b920b4f44b6b3081
  #![feature(pattern)]
  #![feature(placement_in_syntax)]
  #![feature(rand)]
 +#![feature(repr_align)]
  #![feature(slice_rotate)]
  #![feature(splice)]
+ #![feature(str_checked_slicing)]
  #![feature(str_escape)]
  #![feature(test)]
  #![feature(unboxed_closures)]