diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-04-21 15:23:07 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-04-21 15:23:07 -0700 |
| commit | 37a1f2e3acc75e8a3d0fd47bb345b2cd880b2937 (patch) | |
| tree | 0e9af466fc2c1f4185b87f29ffe71a86ad5bcaa9 /src/libsyntax/util/parser_testing.rs | |
| parent | 957cb422a98585568558ad88ec5a0841c43961ae (diff) | |
| parent | 19c8d701743922a709a4eb6554f562996b7baa27 (diff) | |
| download | rust-37a1f2e3acc75e8a3d0fd47bb345b2cd880b2937.tar.gz rust-37a1f2e3acc75e8a3d0fd47bb345b2cd880b2937.zip | |
rollup merge of #24487: erickt/syntax
This removes the usage of `#[feature(into_cow, slice_patterns, box_syntax, box_patterns, quote, unsafe_destructor)]` from being used in libsyntax. My main desire for this is that it brings me one step closer to letting [syntex](https://github.com/erickt/rust-syntex) compile with stable rust. Hopefully this doesn't inconvenience rust development.
Diffstat (limited to 'src/libsyntax/util/parser_testing.rs')
| -rw-r--r-- | src/libsyntax/util/parser_testing.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/libsyntax/util/parser_testing.rs b/src/libsyntax/util/parser_testing.rs index c6646fe93a2..6adeb30a94e 100644 --- a/src/libsyntax/util/parser_testing.rs +++ b/src/libsyntax/util/parser_testing.rs @@ -15,6 +15,7 @@ use parse::new_parser_from_source_str; use parse::parser::Parser; use parse::token; use ptr::P; +use str::char_at; /// Map a string to tts, using a made-up filename: pub fn string_to_tts(source_str: String) -> Vec<ast::TokenTree> { @@ -96,24 +97,24 @@ pub fn matches_codepattern(a : &str, b : &str) -> bool { else if idx_a == a.len() {return false;} else if idx_b == b.len() { // maybe the stuff left in a is all ws? - if is_whitespace(a.char_at(idx_a)) { + if is_whitespace(char_at(a, idx_a)) { return scan_for_non_ws_or_end(a,idx_a) == a.len(); } else { return false; } } // ws in both given and pattern: - else if is_whitespace(a.char_at(idx_a)) - && is_whitespace(b.char_at(idx_b)) { + else if is_whitespace(char_at(a, idx_a)) + && is_whitespace(char_at(b, idx_b)) { idx_a = scan_for_non_ws_or_end(a,idx_a); idx_b = scan_for_non_ws_or_end(b,idx_b); } // ws in given only: - else if is_whitespace(a.char_at(idx_a)) { + else if is_whitespace(char_at(a, idx_a)) { idx_a = scan_for_non_ws_or_end(a,idx_a); } // *don't* silently eat ws in expected only. - else if a.char_at(idx_a) == b.char_at(idx_b) { + else if char_at(a, idx_a) == char_at(b, idx_b) { idx_a += 1; idx_b += 1; } @@ -129,7 +130,7 @@ pub fn matches_codepattern(a : &str, b : &str) -> bool { fn scan_for_non_ws_or_end(a : &str, idx: usize) -> usize { let mut i = idx; let len = a.len(); - while (i < len) && (is_whitespace(a.char_at(i))) { + while (i < len) && (is_whitespace(char_at(a, i))) { i += 1; } i |
