Skip to content

Instantly share code, notes, and snippets.

@zrhoffman
Created September 8, 2023 23:50
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 zrhoffman/0b234a35bb3babb562256ee7e977eb51 to your computer and use it in GitHub Desktop.
Save zrhoffman/0b234a35bb3babb562256ee7e977eb51 to your computer and use it in GitHub Desktop.
4:21.31 error[E0524]: two closures require unique access to `addend` at the same time
4:21.32 --> servo/components/style/custom_properties.rs:1194:42
4:21.32 |
4:21.33 1155 | fn substitute_block<'i>(
4:21.33 | -- lifetime `'i` defined here
4:21.34 ...
4:21.34 1194 | input.parse_nested_block(|input| {
4:21.35 | ^^^^^^^ closures are constructed here in different iterations of loop
4:21.35 ...
4:21.35 1229 | addend,
4:21.37 | ------ capture is mutable because of use here
4:21.37 ...
4:21.37 1233 | let mut addend_input = ParserInput::new(&addend.css);
4:21.37 | ----------------------------- assignment requires that `addend` is borrowed for `'i`
4:21.38 ...
4:21.38 1263 | partial_computed_value.push_variable(&input, &addend)?;
4:21.38 | ------ borrows occur due to use of `addend` in closure
4:21.39 error[E0621]: explicit lifetime required in the type of `addend`
4:21.39 --> servo/components/style/custom_properties.rs:1233:56
4:21.39 |
4:21.39 1159 | addend: &mut ComputedValue,
4:21.40 | ------------------ help: add explicit lifetime `'i` to the type of `addend`: `&'i mut VariableValue`
4:21.40 ...
4:21.40 1233 | let mut addend_input = ParserInput::new(&addend.css);
4:21.40 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'i` required
4:21.41 error[E0597]: `addend` does not live long enough
4:21.41 --> servo/components/style/custom_properties.rs:1263:71
4:21.41 |
4:21.41 1155 | fn substitute_block<'i>(
4:21.42 | -- lifetime `'i` defined here
4:21.42 ...
4:21.43 1194 | input.parse_nested_block(|input| {
4:21.43 | ------- value captured here
4:21.43 ...
4:21.43 1233 | let mut addend_input = ParserInput::new(&addend.css);
4:21.43 | ----------------------------- assignment requires that `addend` is borrowed for `'i`
4:21.44 ...
4:21.44 1263 | partial_computed_value.push_variable(&input, &addend)?;
4:21.45 | ^^^^^^ borrowed value does not live long enough
4:21.45 ...
4:21.45 1297 | }
4:21.46 | - `addend` dropped here while still borrowed
4:21.46 error[E0524]: two closures require unique access to `addend` at the same time
4:21.46 --> servo/components/style/custom_properties.rs:1273:42
4:21.46 |
4:21.47 1194 | input.parse_nested_block(|input| {
4:21.47 | ------- first closure is constructed here
4:21.47 ...
4:21.47 1229 | addend,
4:21.47 | ------ capture is mutable because of use here
4:21.48 ...
4:21.48 1263 | partial_computed_value.push_variable(&input, &addend)?;
4:21.48 | ------ first borrow occurs due to use of `addend` in closure
4:21.49 ...
4:21.49 1273 | input.parse_nested_block(|input| {
4:21.49 | ------------------ ^^^^^^^ second closure is constructed here
4:21.49 | |
4:21.50 | first borrow later used by call
4:21.51 ...
4:21.51 1278 | addend,
4:21.52 | ------ second borrow occurs due to use of `addend` in closure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment