ok/jj
1
0
Fork 0
forked from mirrors/jj

repo: comment about safety implication of view/view_dirty

This commit is contained in:
Yuya Nishihara 2022-11-04 20:28:03 +09:00
parent f26c5c1a05
commit f62aafa79f

View file

@ -506,6 +506,10 @@ impl MutableRepo {
}
pub fn view(&self) -> &View {
// SAFETY: We don't really rely on runtime Ref/RefMut tracking. Since view_dirty
// is set only by &mut self functions, and view() is the solo function which
// publicly provides view-related reference, there should be no view reference
// alive if view_dirty == true.
self.enforce_view_invariants();
let view_borrow = self.view.borrow();
let view = view_borrow.deref();