I mean something like:
fn minimum<'a, 'b>(x: &'a mut i32, y: &'b mut i32) -> &'min(a, b) mut i32 {
(x < y) ? x : y
}
We don't know which reference will be chosen at lifetime, but the compiler knows in which scope both references are still valid and the returned reference can be used safely.
A workaround that one can mention:
fn minimum<'a, 'b> where 'b: 'a (x: &'a i32, y: 'b i32) -> &'a i32 {
(x < y) ? x : y
}
isn't really the solution, because when calling a function we must handle both cases: when 'a: 'b
and 'b: 'a