> cargo run --example counter
Blocking waiting for file lock on build directory
Compiling examples v0.0.0 (D:\Projects\freya)
error[E0597]: `count` does not live long enough
--> examples\counter.rs:27:21
|
23 | let count = use_signal(|| 0);
| ----- binding `count` declared here
...
27 | value: *count.read()
| ^^^^^-------
| |
| borrowed value does not live long enough
| a temporary with access to the borrow is created here ...
...
30 | }
| -
| |
| `count` dropped here while still borrowed
| ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `generational_box::references::GenerationalRef<Ref<'_, i32>>`
|
= note: the temporary is part of an expression at the end of a block;
consider forcing this temporary to be dropped sooner, before the block's local variables are dropped
help: for example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block
|
25 ~ let x = rsx!(
26 | Comp {
27 | value: *count.read()
28 | }
29 ~ ); x
|
For more information about this error, try `rustc --explain E0597`.
error: could not compile `examples` (example "counter") due to previous error
Problem
I am getting an error with signals that seems unnecessary and it used to compile just fine before.
Code:
Error:
Expected behavior
Compile
Environment:
2d2e9dc56a59b4f3ad4deb55d15c27f337cf564c
freya