contd
This commit is contained in:
@@ -116,7 +116,7 @@ struct GeneratorA {
|
||||
impl FnMut<()> for GeneratorA {
|
||||
type Output = GeneratorState<i32, ()>;
|
||||
fn call_mut(&mut self) -> Self::Output {
|
||||
|
||||
Generatorstate::Yielded(2)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,6 +130,23 @@ impl FnMut<()> for GeneratorA {
|
||||
|
||||
>The `yield` keyword was discussed first in [RFC#1823][rfc1823] and in [RFC#1832][rfc1832].
|
||||
|
||||
|
||||
pinning
|
||||
```ignore
|
||||
// If we borrow through yield points, we end up with this error
|
||||
|
||||
--> src\main.rs:12:11
|
||||
|
|
||||
5 | match gen.resume() {
|
||||
| --- first mutable borrow occurs here
|
||||
...
|
||||
12 | match gen.resume() {
|
||||
| ^^^
|
||||
| |
|
||||
| second mutable borrow occurs here
|
||||
| first borrow later used here
|
||||
```
|
||||
|
||||
[rfc2033]: https://github.com/rust-lang/rfcs/blob/master/text/2033-experimental-coroutines.md
|
||||
[greenthreads]: https://cfsamson.gitbook.io/green-threads-explained-in-200-lines-of-rust/
|
||||
[rfc1823]: https://github.com/rust-lang/rfcs/pull/1823
|
||||
|
||||
Reference in New Issue
Block a user