fn foo(
mut x: &(),
y: &(),
) {
x = y;
}
gives the error:
error[E0623]: lifetime mismatch
--> src/lib.rs:5:9
|
2 | mut x: &(),
| ---
3 | y: &(),
| --- these two types are declared with different lifetimes...
4 | ) {
5 | x = y;
| ^ ...but data from `y` flows into `x` here
but does not suggest the solution: adding a new lifetime parameter 'a to foo and giving both variables the same lifetime.
gives the error:
but does not suggest the solution: adding a new lifetime parameter
'atofooand giving both variables the same lifetime.