Relative Content

Tag Archive for rustborrow-checker

Indexing from `HashMap` with `&str`

What is the proper way to index into a HashMap<&String, V> with a &str? Rust reports that &String is not Borrow<str>, which is required for indexing. (This seems a bit silly to me; if T: Borrow<U> then surely &T: Borrow<U> should also hold?)

Double mutable borrow error in a loop happens even with NLL on

Suppose I have several structures like in the following example, and in the next() method I need to pull the next event using a user-provided buffer, but if this event is a comment, and ignore comments flag is set to true, I need to pull the next event again:

Double mutable borrow error in a loop happens even with NLL on

Suppose I have several structures like in the following example, and in the next() method I need to pull the next event using a user-provided buffer, but if this event is a comment, and ignore comments flag is set to true, I need to pull the next event again:

Double mutable borrow error in a loop happens even with NLL on

Suppose I have several structures like in the following example, and in the next() method I need to pull the next event using a user-provided buffer, but if this event is a comment, and ignore comments flag is set to true, I need to pull the next event again:

Double mutable borrow error in a loop happens even with NLL on

Suppose I have several structures like in the following example, and in the next() method I need to pull the next event using a user-provided buffer, but if this event is a comment, and ignore comments flag is set to true, I need to pull the next event again:

Double mutable borrow error in a loop happens even with NLL on

Suppose I have several structures like in the following example, and in the next() method I need to pull the next event using a user-provided buffer, but if this event is a comment, and ignore comments flag is set to true, I need to pull the next event again:

Double mutable borrow error in a loop happens even with NLL on

Suppose I have several structures like in the following example, and in the next() method I need to pull the next event using a user-provided buffer, but if this event is a comment, and ignore comments flag is set to true, I need to pull the next event again: