When attempting to compile this code, I get the following error:
error[E0308]: mismatched types
--> src/lib.rs:72:9
|
67 | fn get_states<'a>(&'a self) -> <(Bar, T) as MultiState<'a>>::Refs
| ---------------------------------- expected `<(Bar, T) as MultiState<'a>>::Refs` because of return type
...
72 | (&foo.bar, t)
| ^^^^^^^^^^^^^ expected associated type, found tuple
|
= note: expected associated type `<(Bar, T) as MultiState<'a>>::Refs`
found tuple `(&Bar, &T)`
= note: consider constraining the associated type `<(Bar, T) as MultiState<'a>>::Refs` to `(&Bar, &T)` or calling a method that returns `<(Bar, T) as MultiState<'a>>::Refs`
= note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
Why isn't Rust smart enough to realize that, for all 'a
, <(Bar, T) as MultiState<'a>>::Refs
is equal to (&'a Bar, &'a T)
, as I've written? Is there any way that I can coax Rust into realizing that these types are equal?