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

Make iter::Empty<T> Send and Sync for any T #68348

Merged
merged 2 commits into from Jan 19, 2020
Merged

Make iter::Empty<T> Send and Sync for any T #68348

merged 2 commits into from Jan 19, 2020

Conversation

@xfix
Copy link
Contributor

xfix commented Jan 18, 2020

Continuing from #57682

It's quite funny, when I initially submitted this pull request, I said "Likely nobody will be using that property of iter::empty", but then a year later I got a compilation error because it wasn't Send and Sync.

Unfortunately, PhantomData<fn() -> T> still errors out. Oh well. I proposed struct PhantomFnWorkaround<T>(fn() -> T);, but dtolnay did not like it, so using explicit implementations.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Jan 18, 2020

r? @pietroalbini

(rust_highfive has picked a reviewer for you, use r? to override)

@xfix xfix force-pushed the xfix:patch-14 branch from 0d38439 to a54a896 Jan 18, 2020
@Centril Centril added this to the 1.42 milestone Jan 18, 2020
@Centril

This comment has been minimized.

Copy link
Member

Centril commented Jan 18, 2020

@xfix xfix force-pushed the xfix:patch-14 branch from a54a896 to d7a18f8 Jan 18, 2020
@nagisa

This comment has been minimized.

Copy link
Contributor

nagisa commented Jan 19, 2020

@bors r+

This makes perfect sense and has no future compat concerns, so an obvious r+.

FWIW this PR could also be extended to other auto-traits such as Unpin too.

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 19, 2020

📌 Commit d7a18f8 has been approved by nagisa

Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Jan 19, 2020
Make iter::Empty<T> Send and Sync for any T

Continuing from rust-lang#57682

It's quite funny, when I initially submitted this pull request, I said "Likely nobody will be using that property of `iter::empty`", but then a year later I got a compilation error because it wasn't `Send` and `Sync`.

Unfortunately, `PhantomData<fn() -> T>` still errors out. Oh well. I proposed `
struct PhantomFnWorkaround<T>(fn() -> T);`, but dtolnay did not like it, so using explicit implementations.
bors added a commit that referenced this pull request Jan 19, 2020
Rollup of 5 pull requests

Successful merges:

 - #67682 ([const-prop] Remove useless typedef)
 - #68133 (Slimmer syntax)
 - #68154 (Add more BTreeMap/BTreeSet benchmarks regarding iteration)
 - #68247 (Clean up err codes)
 - #68348 (Make iter::Empty<T> Send and Sync for any T)

Failed merges:

 - #68353 (Remove `rustc_error_codes` deps except in `rustc_driver`)

r? @ghost
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Jan 19, 2020
Make iter::Empty<T> Send and Sync for any T

Continuing from rust-lang#57682

It's quite funny, when I initially submitted this pull request, I said "Likely nobody will be using that property of `iter::empty`", but then a year later I got a compilation error because it wasn't `Send` and `Sync`.

Unfortunately, `PhantomData<fn() -> T>` still errors out. Oh well. I proposed `
struct PhantomFnWorkaround<T>(fn() -> T);`, but dtolnay did not like it, so using explicit implementations.
bors added a commit that referenced this pull request Jan 19, 2020
Rollup of 3 pull requests

Successful merges:

 - #67682 ([const-prop] Remove useless typedef)
 - #68247 (Clean up err codes)
 - #68348 (Make iter::Empty<T> Send and Sync for any T)

Failed merges:

r? @ghost
@bors bors merged commit d7a18f8 into rust-lang:master Jan 19, 2020
4 checks passed
4 checks passed
pr Build #20200118.38 succeeded
Details
pr (Linux mingw-check) Linux mingw-check succeeded
Details
pr (Linux x86_64-gnu-llvm-7) Linux x86_64-gnu-llvm-7 succeeded
Details
pr (Linux x86_64-gnu-tools) Linux x86_64-gnu-tools succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

7 participants
You can’t perform that action at this time.