Closed
Description
I have a code roughly like this:
fn parse_selectors<'i, 't>(
input: &mut Parser<'i, 't>,
) -> Result<String, ParseError<'i, CustomParseError>> {
let mut selectors = String::new();
while let Ok(t) = input.next() {
match t {
Token::SquareBracketBlock => {
selectors.push('[');
input.parse_nested_block(|p| {
while let Ok(t) = p.next() {
/// ...
}
Ok(())
})?;
selectors.push(']');
}
t => {
unreachable!()
}
}
}
Ok(selectors)
}
It works fine with Rust 2018, but with 2015 I'm getting:
error[E0499]: cannot borrow `*input` as mutable more than once at a time
--> src/lib.rs:134:17
|
98 | while let Ok(t) = input.next() {
| ----- - first borrow ends here
| |
| first mutable borrow occurs here
...
134 | input.parse_nested_block(|p| {
| ^^^^^ second mutable borrow occurs here
Is it not possible at all on Rust 2015 or I have to change a code somehow?
Metadata
Metadata
Assignees
Labels
No labels