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 9 pull requests #49615

Closed
wants to merge 21 commits into from
Closed

Rollup of 9 pull requests #49615

wants to merge 21 commits into from

Conversation

kennytm
Copy link
Member

@kennytm kennytm commented Apr 3, 2018

Successful merges:

Failed merges:

GuillaumeGomez and others added 20 commits March 30, 2018 16:10
Chosen to start a precedent of using it on ones that are potentially-expensive and where using it for side effects is particularly discouraged.

Discuss :)
This makes sure that all bits in each IdxSet between the universe length
and the end of the word are all zero instead of being in an indeterminate state.

This fixes a crash with RUST_LOG=rustc_mir, and is probably a good idea
anyway.
vec![0; n], via implementations of SpecFromElem, has an optimization
that uses with_capacity_zeroed instead of with_capacity, which will use
calloc instead of malloc, and avoid an extra memset.

This adds the same optimization for vec![ptr::null(); n] and
vec![ptr::null_mut(); n], assuming their bit value is 0 (which is true
on all currently supported platforms).

This does so by adding an intermediate trait IsZero, which looks very
much like nonzero::Zeroable, but that one is on the way out, and doesn't
apply to pointers anyways.

Adding such a trait allows to avoid repeating the logic using
with_capacity_zeroed or with_capacity, or making the macro more complex
to support generics.
Similarly to vec![ptr::null{,_mut}(); n] in previous change, this adds
the optimization for vec!['\0'; n].
So we can cut some params by using stuff from the environment.
It was stabilized right before the beta branch was cut for 1.26.0.

See rust-lang#49523 (comment)
…gs, r=nikomatsakis

Small typeck refactorings

Some code improvements I noticed while reading the code.
Add more vec![... ; n] optimizations

vec![0; n], via implementations of SpecFromElem, has an optimization that uses with_capacity_zeroed instead of with_capacity, which will use calloc instead of malloc, and avoid an extra memset.

This PR adds the same optimization for ptr::null, ptr::null_mut, and None, when their in-memory representation is zeroes.
…r=QuietMisdreavus

Add support for variant and types fields for intra links

Part of rust-lang#43466.

r? @QuietMisdreavus
…ing-anchor, r=QuietMisdreavus

Add missing anchor for union type fields

r? @QuietMisdreavus
Add #[must_use] to a few standard library methods

Chosen to start a precedent of using it on ones that are potentially-expensive and where using it for side effects is particularly discouraged.

Discuss :)

```rust
warning: unused return value of `std::iter::Iterator::collect` which must be used: if you really need to exhaust the iterator, consider `.for_each(drop)` instead
  --> $DIR/fn_must_use_stdlib.rs:19:5
   |
LL |     "1 2 3".split_whitespace().collect::<Vec<_>>();
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: unused return value of `std::borrow::ToOwned::to_owned` which must be used: cloning is often expensive and is not expected to have side effects
  --> $DIR/fn_must_use_stdlib.rs:21:5
   |
LL |     "hello".to_owned();
   |     ^^^^^^^^^^^^^^^^^^^

warning: unused return value of `std::clone::Clone::clone` which must be used: cloning is often expensive and is not expected to have side effects
  --> $DIR/fn_must_use_stdlib.rs:23:5
   |
LL |     String::from("world").clone();
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

cc rust-lang#48926
…sakis

avoid IdxSets containing garbage above the universe length

This makes sure that all bits in each IdxSet between the universe length
and the end of the word are all zero instead of being in an indeterminate state.

This fixes a crash with RUST_LOG=rustc_mir, and is probably a good idea
anyway.

r? @nikomatsakis - I think you are responsible for this code area now?
…sxcv

Fix typo

In `libstd/io/buffered.rs` one example was marked as `no_ru` instead of `no_run`. I assume this is a typo.
…etrochenkov

run-pass/attr-stmt-expr: expand test cases

Follow-up to rust-lang#49124 (comment)

r? @petrochenkov
@kennytm
Copy link
Member Author

kennytm commented Apr 3, 2018

@bors r+ p=8

@bors
Copy link
Contributor

bors commented Apr 3, 2018

📌 Commit 0878e0f has been approved by kennytm

@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 Apr 3, 2018
Fix "since" version for getpid feature.

It was stabilized right before the beta branch was cut for 1.26.0.

See rust-lang#49523 (comment)

This will need to be backported to beta (1.26.0)
@kennytm
Copy link
Member Author

kennytm commented Apr 3, 2018

@bors r+

Added #49612.

@bors
Copy link
Contributor

bors commented Apr 3, 2018

📌 Commit 6af59e8 has been approved by kennytm

@kennytm kennytm changed the title Rollup of 8 pull requests Rollup of 9 pull requests Apr 3, 2018
@bors
Copy link
Contributor

bors commented Apr 3, 2018

🔒 Merge conflict

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 3, 2018
@bors
Copy link
Contributor

bors commented Apr 3, 2018

☔ The latest upstream changes (presumably #49348) made this pull request unmergeable. Please resolve the merge conflicts.

@kennytm kennytm closed this Apr 3, 2018
@Centril Centril added the rollup A PR which is a rollup label Oct 24, 2019
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-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet