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

Rollup of 6 pull requests #68675

Closed
wants to merge 16 commits into from

Conversation

Dylan-DPC-zz
Copy link

Successful merges:

Failed merges:

r? @ghost

WaffleLapkin and others added 16 commits January 28, 2020 21:30
Brings in a fix for rust-lang/jobserver-rs#23 which could cause Cargo
to unnecessarily hang in some situations.
This repr-hint makes a struct/enum hide any niche within from its
surrounding type-construction context.

It is meant (at least initially) as an implementation detail for
resolving issue 68303. We will not stabilize the repr-hint unless
someone finds motivation for doing so.

(So, declaration of `no_niche` feature lives in section of file
where other internal implementation details are grouped, and
deliberately leaves out the tracking issue number.)

incorporated review feedback, and fixed post-rebase.
…=mark-simulcrum

Add `Iterator::map_while`

In `Iterator` trait there is `*_map` version of [`filter`] — [`filter_map`], however, there is no `*_map` version of [`take_while`], that can also be useful.

### Use cases
In my code, I've found that I need to iterate through iterator of `Option`s, stopping on the first `None`. So I've written code like this:
```rust
let arr = [Some(4), Some(10), None, Some(3)];
let mut iter = arr.iter()
    .take_while(|x| x.is_some())
    .map(|x| x.unwrap());

assert_eq!(iter.next(), Some(4));
assert_eq!(iter.next(), Some(10));
assert_eq!(iter.next(), None);
assert_eq!(iter.next(), None);
```
Thit code
1) isn't clean
2) In theory, can generate bad bytecode (I'm actually **not** sure, but I think that `unwrap` would generate additional branches with `panic!`)

The same code, but with `map_while` (in the original PR message it was named "take_while_map"):
```rust
let arr = [Some(4), Some(10), None, Some(3)];
let mut iter = arr.iter().map_while(std::convert::identity);
```

Also, `map_while` can be useful when converting something (as in [examples]).

[`filter`]: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.filter
[`filter_map`]: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.filter_map
[`take_while`]: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.take_while
[examples]: https://github.com/rust-lang/rust/compare/master...WaffleLapkin:iter_take_while_map?expand=1#diff-7e57917f962fe6ffdfba51e4955ad6acR1042
…ell, r=oli

Hide niches under UnsafeCell

Hide any niche of T from type-construction context of `UnsafeCell<T>`.

Fix rust-lang#68303
Fix rust-lang#68206
…lan-DPC

Update jobserver crate to 0.1.21

Brings in a fix for rust-lang/jobserver-rs#23 which could cause Cargo
to unnecessarily hang in some situations.
suggest adding space in accidental doc comments

Fixes rust-lang#67553.

r? @estebank
@Dylan-DPC-zz
Copy link
Author

@bors r+ rollup=never p=6

@bors
Copy link
Contributor

bors commented Jan 30, 2020

📌 Commit e486f5e has been approved by Dylan-DPC

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jan 30, 2020
@Dylan-DPC-zz Dylan-DPC-zz added the rollup A PR which is a rollup label Jan 30, 2020
@bors
Copy link
Contributor

bors commented Jan 30, 2020

⌛ Testing commit e486f5e with merge 4c61ed74565e9b98e85efd494372e09518190dce...

@rust-highfive
Copy link
Collaborator

The job dist-various-2 of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2020-01-30T20:56:34.5519301Z [RUSTC-TIMING] backtrace test:false 0.286
2020-01-30T20:56:35.1187872Z [RUSTC-TIMING] hashbrown test:false 0.676
2020-01-30T20:56:35.2618371Z warning: dropping unsupported crate type `dylib` for target `x86_64-fortanix-unknown-sgx`
2020-01-30T20:56:35.2618905Z 
2020-01-30T20:56:37.3964798Z error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
2020-01-30T20:56:37.3965900Z   --> src/libstd/sys/sgx/rwlock.rs:16:5
2020-01-30T20:56:37.3966481Z    |
2020-01-30T20:56:37.3967082Z 16 |     mem::transmute::<RWLock, [u8; 128]>(r);
2020-01-30T20:56:37.3968822Z    |
2020-01-30T20:56:37.3968822Z    |
2020-01-30T20:56:37.3969438Z    = note: source type: `sys::sgx::rwlock::RWLock` (1152 bits)
2020-01-30T20:56:37.3970405Z    = note: target type: `[u8; 128]` (1024 bits)
2020-01-30T20:56:38.6432578Z error: aborting due to previous error
2020-01-30T20:56:38.6433415Z 
2020-01-30T20:56:38.6433985Z For more information about this error, try `rustc --explain E0512`.
2020-01-30T20:56:38.6501000Z [RUSTC-TIMING] std test:false 3.528
---
2020-01-30T20:56:38.6676293Z   local time: Thu Jan 30 20:56:38 UTC 2020
2020-01-30T20:56:38.9327518Z   network time: Thu, 30 Jan 2020 20:56:38 GMT
2020-01-30T20:56:38.9328065Z == end clock drift check ==
2020-01-30T20:56:40.3147051Z 
2020-01-30T20:56:40.3228344Z ##[error]Bash exited with code '1'.
2020-01-30T20:56:40.3281434Z ##[section]Starting: Checkout rust-lang/rust@auto to s
2020-01-30T20:56:40.3284081Z ==============================================================================
2020-01-30T20:56:40.3284157Z Task         : Get sources
2020-01-30T20:56:40.3284244Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@bors
Copy link
Contributor

bors commented Jan 30, 2020

💔 Test failed - checks-azure

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jan 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rollup A PR which is a rollup S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants