Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GoldsteinE/450e3d6fb86f21e73401e4c03e0a645f to your computer and use it in GitHub Desktop.
Save GoldsteinE/450e3d6fb86f21e73401e4c03e0a645f to your computer and use it in GitHub Desktop.
error: captured variable cannot escape `FnMut` closure body
--> components/rendering/src/markdown.rs:208:17
|
176 | let mut highlighter: Option<CodeBlock> = None;
| --------------- variable defined here
...
197 | .map(|event| {
| - inferred to be a `FnMut` closure
...
208 | / Ok(Either::Right(events.into_iter().map(|event| {
209 | | match event {
210 | | Event::Text(text) => {
211 | | // if we are in the middle of a highlighted code block
212 | | if let Some(ref mut code_block) = highlighter {
| | ----------- variable captured here
... |
346 | | }
347 | | })))
| |____________________^ returns a reference to a captured variable which escapes the closure body
|
= note: `FnMut` closures only have access to their captured variables while they are executing...
= note: ...therefore, they cannot allow references to captured variables to escape
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment