I'm making a Combinatory Optimization project to learn Rust and I've got a problem I cannot resolve myself...
I've got 2 functions :
pub fn get_pareto_front_offline<'a>(scheduling_jobs: &'a Vec<Vec<u32>>, costs_vector: &'a Vec<(u32, u32)>) -> Vec<(&'a Vec<u32>, &'a (u32, u32))> { // ... } and
pub fn pareto_approach_offline<'a>(list_of_jobs: &'a mut Vec<Vec<u32>>, neighborhood: &'a mut Vec<Vec<u32>>, costs: &'a Vec<(u32, u32)>) -> Vec<(&'a Vec<u32>, &'a (u32, u32))> { let pareto_front = get_pareto_front_offline(neighborhood, costs); loop { if pareto_front == vec![] { break; } neighborhood.clear(); for front in pareto_front.iter() { neighborhood.push((front.0).clone()); } } pareto_front } I've got a problem because the compiler tells me:
cannot borrow '*neighborhood' as mutable because it is also borrowed as immutableat line 15 col 9 cannot borrow '*neighborhood' as mutable because it is also borrowed as immutableat line 19 col 13