forked from mirrors/jj
transaction: make evolution_mut() return a mutable reference
This includes fixing a lifetime bound on `MutableEvolution` that was reversed.
This commit is contained in:
parent
110c083e78
commit
0219dbb359
2 changed files with 6 additions and 4 deletions
|
@ -309,7 +309,7 @@ impl<'r> ReadonlyEvolution<'r> {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct MutableEvolution<'r, 'm: 'r> {
|
||||
pub struct MutableEvolution<'r: 'm, 'm> {
|
||||
repo: &'m MutableRepo<'r>,
|
||||
state: State,
|
||||
}
|
||||
|
|
|
@ -219,8 +219,10 @@ impl<'r> Repo for MutableRepo<'r> {
|
|||
}
|
||||
}
|
||||
|
||||
impl MutableRepo<'_> {
|
||||
pub fn evolution_mut(&mut self) -> &MutableEvolution {
|
||||
self.evolution.as_mut().unwrap()
|
||||
impl<'r> MutableRepo<'r> {
|
||||
pub fn evolution_mut<'m>(&'m mut self) -> &'m mut MutableEvolution<'r, 'm> {
|
||||
let evolution: &mut MutableEvolution<'static, 'static> = self.evolution.as_mut().unwrap();
|
||||
let evolution: &mut MutableEvolution<'r, 'm> = unsafe { std::mem::transmute(evolution) };
|
||||
evolution
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue