Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(metadata): remove manual Send + Sync impls for metadata types #640

Merged
merged 1 commit into from
May 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions tonic/src/metadata/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1244,9 +1244,6 @@ impl<'a> Iterator for Iter<'a> {
}
}

unsafe impl<'a> Sync for Iter<'a> {}
unsafe impl<'a> Send for Iter<'a> {}

// ===== impl IterMut =====

impl<'a> Iterator for IterMut<'a> {
Expand Down Expand Up @@ -1274,9 +1271,6 @@ impl<'a> Iterator for IterMut<'a> {
}
}

unsafe impl<'a> Sync for IterMut<'a> {}
unsafe impl<'a> Send for IterMut<'a> {}

// ===== impl ValueDrain =====

impl<'a, VE: ValueEncoding> Iterator for ValueDrain<'a, VE> {
Expand All @@ -1293,9 +1287,6 @@ impl<'a, VE: ValueEncoding> Iterator for ValueDrain<'a, VE> {
}
}

unsafe impl<'a, VE: ValueEncoding> Sync for ValueDrain<'a, VE> {}
unsafe impl<'a, VE: ValueEncoding> Send for ValueDrain<'a, VE> {}

// ===== impl Keys =====

impl<'a> Iterator for Keys<'a> {
Expand Down Expand Up @@ -1425,9 +1416,6 @@ where
}
}

unsafe impl<'a, VE: ValueEncoding> Sync for ValueIterMut<'a, VE> {}
unsafe impl<'a, VE: ValueEncoding> Send for ValueIterMut<'a, VE> {}

// ===== impl Entry =====

impl<'a, VE: ValueEncoding> Entry<'a, VE> {
Expand Down Expand Up @@ -2725,4 +2713,18 @@ mod tests {
}
assert!(found_x_word_bin);
}

#[allow(dead_code)]
fn value_drain_is_send_sync() {
fn is_send_sync<T: Send + Sync>() {}

is_send_sync::<Iter<'_>>();
is_send_sync::<IterMut<'_>>();

is_send_sync::<ValueDrain<'_, Ascii>>();
is_send_sync::<ValueDrain<'_, Binary>>();

is_send_sync::<ValueIterMut<'_, Ascii>>();
is_send_sync::<ValueIterMut<'_, Binary>>();
}
}