Skip to content

Commit

Permalink
new_borrowed was unsound due to hiding the coupled lifetime
Browse files Browse the repository at this point in the history
  • Loading branch information
molpopgen committed Sep 21, 2023
1 parent 4f78b2c commit 58e1e51
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions src/sys/tskbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,6 @@ impl<T> TskBox<T> {
}
}

pub fn new_borrowed(owner: &Self) -> Self {
let tsk = owner.tsk;
Self {
tsk,
teardown: None,
owning: false,
}
}

pub fn as_ref(&self) -> &T {

Check warning on line 24 in src/sys/tskbox.rs

View workflow job for this annotation

GitHub Actions / Test (Miri)

methods `as_ref`, `as_mut`, `as_ptr`, and `as_mut_ptr` are never used
unsafe { self.tsk.as_ref() }
}
Expand Down Expand Up @@ -86,10 +77,6 @@ fn test_miri() {
},
teardown_x,
);

let _ = TskBox::new_borrowed(&b);

//is_send_sync(&b)
}

#[test]
Expand All @@ -112,5 +99,4 @@ fn test_table_collection_tskbox_shared_ptr() {
},
super::bindings::tsk_table_collection_free,
);
let _ = TskBox::new_borrowed(&tables);
}

0 comments on commit 58e1e51

Please sign in to comment.