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

Explicitly opt out of `Sync` for `cell` and `mpsc` types #31982

Merged
merged 1 commit into from Mar 2, 2016

Conversation

Projects
None yet
4 participants
@apasel422
Copy link
Member

apasel422 commented Mar 1, 2016

These types were already !Sync, but this improves error messages when they are used in contexts that require Sync, aligning them with conventions used with Rc, among others.

r? @alexcrichton

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Mar 1, 2016

Thanks @apasel422! I wonder if it might also be a good idea to add compile-fail tests for these error messages as well? That way we can at least try to ensure the message remains high-quality over time.

@@ -307,6 +310,9 @@ pub struct Iter<'a, T: 'a> {
rx: &'a Receiver<T>
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> !Sync for Iter<'a, T> { }

This comment has been minimized.

@alexcrichton

alexcrichton Mar 1, 2016

Member

Perhaps this and the IntoIter can be left off? They seem less "fundamentally not-Sync" than the other types.

Explicitly opt out of `Sync` for `cell` and `mpsc` types
These types were already `!Sync`, but this improves error messages when
they are used in contexts that require `Sync`, aligning them with
conventions used with `Rc`, among others.
@apasel422

This comment has been minimized.

Copy link
Member Author

apasel422 commented Mar 1, 2016

@alexcrichton Updated.

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Mar 2, 2016

@bors: r+ f522d88

Thanks!

@reem

This comment has been minimized.

Copy link
Contributor

reem commented Mar 2, 2016

This is a great change! The previous error message was pretty bad and a common source of new user confusion.

Manishearth added a commit to Manishearth/rust that referenced this pull request Mar 2, 2016

Rollup merge of rust-lang#31982 - apasel422:sync, r=alexcrichton
These types were already `!Sync`, but this improves error messages when they are used in contexts that require `Sync`, aligning them with conventions used with `Rc`, among others.

r? @alexcrichton

bors added a commit that referenced this pull request Mar 2, 2016

@bors bors merged commit f522d88 into rust-lang:master Mar 2, 2016

1 check was pending

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details

@apasel422 apasel422 deleted the apasel422:sync branch Mar 2, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.