aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorJeff Vander Stoep <jeffv@google.com>2022-12-13 10:48:04 +0100
committerJeff Vander Stoep <jeffv@google.com>2022-12-13 10:49:00 +0100
commit926348bf52270896ffe3aefa3021ddba5f0aa0c1 (patch)
treeba170ab2fc6423814191be920bb4d1cc53f9b287 /src/lib.rs
parent23166d66dc01778780a8d46bd0bc4ebf2033f2ef (diff)
downloadpin-project-926348bf52270896ffe3aefa3021ddba5f0aa0c1.tar.gz
Upgrade pin-project to 1.0.12main-16k-with-phones
This project was upgraded with external_updater. Usage: tools/external_updater/updater.sh update rust/crates/pin-project For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md Test: TreeHugger Change-Id: I970f12737ae466548757b47ad4582afce563a778
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 00bc931..ca47cea 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -75,7 +75,20 @@
)
))]
#![warn(missing_docs, rust_2018_idioms, single_use_lifetimes, unreachable_pub)]
-#![warn(clippy::default_trait_access, clippy::wildcard_imports)]
+#![warn(
+ clippy::pedantic,
+ // lints for public library
+ clippy::alloc_instead_of_core,
+ clippy::exhaustive_enums,
+ clippy::exhaustive_structs,
+ clippy::std_instead_of_alloc,
+ clippy::std_instead_of_core,
+ // lints that help writing unsafe code
+ clippy::default_union_representation,
+ clippy::trailing_empty_array,
+ clippy::transmute_undefined_repr,
+ clippy::undocumented_unsafe_blocks,
+)]
#![allow(clippy::needless_doctest_main)]
// ANDROID: Use std to allow building as a dylib.
@@ -246,7 +259,8 @@ pub mod __private {
#[doc(hidden)]
pub struct Wrapper<'a, T: ?Sized>(PhantomData<&'a ()>, T);
- unsafe impl<T: ?Sized> UnsafeUnpin for Wrapper<'_, T> where T: UnsafeUnpin {}
+ // SAFETY: `T` implements UnsafeUnpin.
+ unsafe impl<T: ?Sized + UnsafeUnpin> UnsafeUnpin for Wrapper<'_, T> {}
// This is an internal helper struct used by `pin-project-internal`.
//
@@ -269,6 +283,8 @@ pub mod __private {
impl<T: ?Sized> Drop for UnsafeDropInPlaceGuard<T> {
fn drop(&mut self) {
+ // SAFETY: the caller of `UnsafeDropInPlaceGuard::new` must guarantee
+ // that `ptr` is valid for drop when this guard is destructed.
unsafe {
ptr::drop_in_place(self.0);
}
@@ -292,6 +308,8 @@ pub mod __private {
impl<T> Drop for UnsafeOverwriteGuard<T> {
fn drop(&mut self) {
+ // SAFETY: the caller of `UnsafeOverwriteGuard::new` must guarantee
+ // that `target` is valid for writes when this guard is destructed.
unsafe {
ptr::write(self.target, ptr::read(&*self.value));
}