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

Remove Send from ValueDrain iterator #361

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/header/map.rs
Expand Up @@ -3030,8 +3030,10 @@ impl<'a, T> Drop for ValueDrain<'a, T> {
}
}

unsafe impl<'a, T: Sync> Sync for ValueDrain<'a, T> {}
unsafe impl<'a, T: Send> Send for ValueDrain<'a, T> {}
// `ValueDrain` cannot be `Send` because it has un-synchronized mutation of
// the `extra_values` vector.
//
// See https://github.com/hyperium/http/issues/355

// ===== impl RawLinks =====

Expand Down Expand Up @@ -3399,7 +3401,7 @@ mod as_header_name {

#[test]
fn test_bounds() {
fn check_bounds<T: Send + Send>() {}
fn check_bounds<T: Send + Sync>() {}

check_bounds::<HeaderMap<()>>();
check_bounds::<Iter<'static, ()>>();
Expand All @@ -3414,7 +3416,7 @@ fn test_bounds() {
check_bounds::<OccupiedEntry<'static, ()>>();
check_bounds::<ValueIter<'static, ()>>();
check_bounds::<ValueIterMut<'static, ()>>();
check_bounds::<ValueDrain<'static, ()>>();
// cannot: ValueDrain<'static, ()>
}

#[test]
Expand Down