Skip to content

Commit

Permalink
Work around Rust 1.12.0 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Oct 1, 2016
1 parent fd6935d commit 62604d9
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/nom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,22 @@ macro_rules! take_while1 {
};
}

pub fn str_chars(s: &str) -> Vec<char> {
// Can't do `s.chars().collect()` because it triggers a compiler bug in 1.12.0
// https://github.com/dtolnay/syn/issues/20
let mut result = Vec::new();
for ch in s.chars() {
result.push(ch);
}
result
}

macro_rules! take_until {
($input:expr, $substr:expr) => {{
if $substr.len() > $input.len() {
$crate::nom::IResult::Error
} else {
let substr_vec: Vec<char> = $substr.chars().collect();
let substr_vec: Vec<char> = $crate::nom::str_chars($substr);
let mut window: Vec<char> = vec![];
let mut offset = $input.len();
let mut parsed = false;
Expand Down

0 comments on commit 62604d9

Please sign in to comment.