Commit Graph

106071 Commits

Author SHA1 Message Date
bors
5371ddf8c6 Auto merge of #68080 - varkor:declared-here, r=petrochenkov
Address inconsistency in using "is" with "declared here"

"is" was generally used for NLL diagnostics, but not other diagnostics. Using "is" makes the diagnostics sound more natural and readable, so it seems sensible to commit to them throughout.

r? @Centril
2020-01-31 15:13:51 +00:00
bors
ecde10fc28 Auto merge of #68663 - alexcrichton:update-jobserver, r=Dylan-DPC
Update jobserver crate to 0.1.21

Brings in a fix for alexcrichton/jobserver-rs#23 which could cause Cargo
to unnecessarily hang in some situations.
2020-01-31 11:48:54 +00:00
bors
b1cb3c0909 Auto merge of #67340 - nnethercote:shrink-Nonterminal, r=petrochenkov
Shrink `Nonterminal`

These commits shrink `Nonterminal` from 240 bytes to 40 bytes. When building `serde_derive` they reduce the number of `memcpy` calls from 9.6M to 7.4M, and it's a tiny win on a few other benchmarks.

r? @petrochenkov
2020-01-31 06:33:36 +00:00
bors
266ecd6625 Auto merge of #68685 - Dylan-DPC:rollup-rkbo05z, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #68588 (check_unsafety: more code reuse)
 - #68638 (Add missing links for cmp traits)
 - #68660 (Fix typo.)
 - #68669 (suggest adding space in accidental doc comments)
 - #68670 (clarify "incorrect issue" error)
 - #68680 (Add `#![doc(html_playground_url = ...)]` to alloc crate)

Failed merges:

r? @ghost
2020-01-31 03:10:07 +00:00
Dylan DPC
6c67466f73
Rollup merge of #68680 - ollie27:doc_alloc_playground, r=Centril
Add `#![doc(html_playground_url = ...)]` to alloc crate

This adds the Run button to code examples just like the core and std docs have.
2020-01-31 01:21:31 +01:00
Dylan DPC
f60b95aaa1
Rollup merge of #68670 - euclio:invalid-issue, r=estebank
clarify "incorrect issue" error

Changes the message to be more precise, shrinks the span and adds a label specifying why the `issue` field is incorrect.
2020-01-31 01:21:30 +01:00
Dylan DPC
b3e63f28b3
Rollup merge of #68669 - euclio:doc-comment-stmt, r=estebank
suggest adding space in accidental doc comments

Fixes #67553.

r? @estebank
2020-01-31 01:21:28 +01:00
Dylan DPC
8b2fa37b07
Rollup merge of #68660 - kubo39:patch-1, r=Dylan-DPC
Fix typo.
2020-01-31 01:21:27 +01:00
Dylan DPC
f159045adc
Rollup merge of #68638 - GuillaumeGomez:links-cmp-traits, r=Dylan-DPC
Add missing links for cmp traits

r? @Dylan-DPC
2020-01-31 01:21:25 +01:00
Dylan DPC
8f5858007c
Rollup merge of #68588 - Centril:check-unsafety-clean, r=Mark-Simulacrum
check_unsafety: more code reuse

r? oli-obk
2020-01-31 01:21:24 +01:00
bors
138c50f0af Auto merge of #67878 - Others:opt-3, r=Mark-Simulacrum
Change opt-level from 2 back to 3

In Cargo.toml, the opt-level for `release` and `bench` was overridden to be 2. This was to work around a problem with LLVM 7. However, rust no longer uses LLVM 7, so this is hopefully no longer needed?

I tried a little bit to replicate the original problem, and could not. I think running this through CI is the best way to smoke test this :) Even if things break dramatically, the comment should be updated to reflect that things are still broken with LLVM 9.

I'm just getting started playing with the compiler, so apologies if I've missed an obvious problem here.

fixes #52378

(possibly relevant is the [current update to LLVM 10](https://github.com/rust-lang/rust/pull/67759))
2020-01-31 00:03:55 +00:00
Oliver Middleton
bfcfab630e Add #![doc(html_playground_url = ...)] to alloc crate
This adds the Run button to code examples just like the core and std docs have.
2020-01-30 21:14:39 +00:00
bors
34700c15c7 Auto merge of #66577 - WaffleLapkin:iter_take_while_map, r=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
2020-01-30 20:58:57 +00:00
Gregor Peach
0d52c562db Change opt-level from 2 back to 3
In Cargo.toml, the opt-level for `release` and `bench` was
overridden to be 2. This was to work around a problem with LLVM
7. However, rust no longer uses LLVM 7, so this is no longer
needed.

This creates a small compile time regression in MIR constant eval,
so I've added a #[inline(always)] on the `step` function used in
const eval

Also creates a binary size increase in wasm-stringify-ints-small,
so I've bumped the limit there.
2020-01-30 15:40:14 -05:00
Andy Russell
7632ade65b
clarify "incorrect issue" error 2020-01-30 09:01:56 -05:00
Andy Russell
db319a8fb0
suggest adding space in accidental doc comments 2020-01-30 09:00:35 -05:00
Guillaume Gomez
2f575dab30 Add missing links for cmp traits 2020-01-30 13:58:33 +01:00
bors
212b2c7da8 Auto merge of #68661 - nnethercote:rm-unused-read_uleb128-param, r=Mark-Simulacrum
Remove unused `read_uleb128` parameter.
2020-01-30 12:24:30 +00:00
bors
c4071d0919 Auto merge of #68325 - faern:move-numeric-consts-to-associated-consts-step1, r=LukasKalbertodt
Move numeric consts to associated consts step1

A subset of #67913. Implements the first step of RFC https://github.com/rust-lang/rfcs/pull/2700

This PR adds the new constants as unstable constants and defines the old ones in terms of the new ones. Then fix a tiny bit of code that started having naming collisions because of the new assoc consts.

Removed a test that did not seem relevant any longer. Since doing just `u8::MIN` should now indeed be valid.
2020-01-30 08:55:07 +00:00
Alex Crichton
ad0e4a167d Update jobserver crate to 0.1.21
Brings in a fix for alexcrichton/jobserver-rs#23 which could cause Cargo
to unnecessarily hang in some situations.
2020-01-29 23:47:01 -08:00
Nicholas Nethercote
6961db2024 Remove unused read_uleb128 parameter. 2020-01-30 15:22:53 +11:00
bors
3024c4e739 Auto merge of #68659 - Dylan-DPC:rollup-zo7zi9f, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #66648 (Implement clone_from for BTreeMap and BTreeSet)
 - #68468 (BTreeMap: tag and explain unsafe internal functions or assert preconditions)
 - #68626 (Use termize instead of term_size)
 - #68640 (Document remaining undocumented `From` implementations for IPs)
 - #68651 (Document `From` implementation for NonZero nums)
 - #68655 (Fix revision annotations in borrowck-feature-nll-overrides-migrate)

Failed merges:

r? @ghost
2020-01-30 02:25:56 +00:00
Hiroki Noda
c870ca6217 Update 2020-01-30 10:31:12 +09:00
Hiroki Noda
50ed6cbf98 Fix typo. 2020-01-30 10:07:36 +09:00
Dylan DPC
9f497f93aa
Rollup merge of #68655 - tmiasko:rev, r=Dylan-DPC
Fix revision annotations in borrowck-feature-nll-overrides-migrate
2020-01-30 01:46:48 +01:00
Dylan DPC
1780f2f12f
Rollup merge of #68651 - LeSeulArtichaut:doc-from-nonzero, r=steveklabnik
Document `From` implementation for NonZero nums

This is more of a nitpick than a real change in documentation. I did this for consistency with other documentation (namely Atomic integers).

Related to #51430

r? @steveklabnik

PS: I actually tested the code this time. My CPU died in the process, but I get to open a (hopefully 🤞) working PR
2020-01-30 01:46:46 +01:00
Dylan DPC
3df1ff2608
Rollup merge of #68640 - LeSeulArtichaut:doc-from-ip, r=steveklabnik
Document remaining undocumented `From` implementations for IPs

Some `From` implementations were missing documentation. I added examples, I tried to be as close to existing examples as possible.

Related to #51430 (cc @skade)

r? @steveklabnik
2020-01-30 01:46:45 +01:00
Dylan DPC
4af33a9c26
Rollup merge of #68626 - Zoxc:termize, r=estebank
Use termize instead of term_size

`termize` is a fork of `term_size` which uses `winapi` 0.3 instead of 0.2. This is a step towards removing the `winapi` 0.2 dependency.

r? @Mark-Simulacrum
2020-01-30 01:46:43 +01:00
Dylan DPC
f837c730ca
Rollup merge of #68468 - ssomers:btreemap_prefer_middle, r=Mark-Simulacrum
BTreeMap: tag and explain unsafe internal functions or assert preconditions

#68418 concluded that it's not desirable to tag all internal functions with preconditions as being unsafe. This PR does it to some functions, documents why, and elsewhere enforces the preconditions with asserts.
2020-01-30 01:46:42 +01:00
Dylan DPC
12c9562486
Rollup merge of #66648 - crgl:btree-clone-from, r=Amanieu
Implement clone_from for BTreeMap and BTreeSet

See #28481. This results in up to 90% speedups on simple data types when `self` and `other` are the same size, and is generally comparable or faster. Some concerns:

1. This implementation requires an `Ord` bound on the `Clone` implementation for `BTreeMap` and `BTreeSet`. Since these structs can only be created externally for keys with `Ord` implemented, this should be fine? If not, there's certainly a less safe way to do this.
2. Changing `next_unchecked` on `RangeMut` to return mutable key references allows for replacing the entire overlapping portion of both maps without changing the external interface in any way. However, if `clone_from` fails it can leave the `BTreeMap` in an invalid state, which might be unacceptable.

~This probably needs an FCP since it changes a trait bound, but (as far as I know?) that change cannot break any external code.~
2020-01-30 01:46:38 +01:00
Nicholas Nethercote
7d2173ed27 Use P for NtMeta.
This commit reduces the size of `Nonterminal` from a 72 bytes to 40 bytes (on
x86-64).
2020-01-30 11:19:40 +11:00
Nicholas Nethercote
0d69fe8308 Use P for NtTraitItem, NtImplItem, and NtForeignItem.
This commit reduces the size of `Nonterminal` from a whopping 240 bytes
to 72 bytes (on x86-64), which gets it below the `memcpy` threshold.

It also removes some impedance mismatches with `Annotatable`, which
already uses `P` for these variants.
2020-01-30 11:18:56 +11:00
bors
dc92dfc507 Auto merge of #67688 - cjgillot:passes, r=Zoxc
Move some code to librustc_passes.

Per instructions by @Zoxc, some code from `librustc::middle` is moved to `librustc_passes`.

cc #65031
r? @Zoxc
2020-01-29 23:09:58 +00:00
Tomasz Miąsko
ee73259bdc Fix revision annotations in borrowck-feature-nll-overrides-migrate 2020-01-29 20:51:29 +01:00
Camille GILLOT
f9335e9908 Make Target::from_impl_item a free function. 2020-01-29 19:44:34 +01:00
Camille GILLOT
124fd9d2a4 Move upvars query to librustc_passes. 2020-01-29 19:43:36 +01:00
Camille GILLOT
62c2c99d7d Move upvars.rs to librustc_passes. 2020-01-29 19:43:36 +01:00
Camille GILLOT
1b7e79a9bc Move check_mod_attr query in librustc_passes. 2020-01-29 19:42:56 +01:00
Camille GILLOT
f0a8991469 Move check_attr.rs to librustc_passes. 2020-01-29 19:27:58 +01:00
LeSeulArtichaut
684bd50148 Document From implementation for NonZero nums 2020-01-29 17:49:38 +01:00
LeSeulArtichaut
ab5e296890 Document remaining undocumented From implementations for IPs 2020-01-29 17:47:05 +01:00
bors
9ed29b6ff6 Auto merge of #68634 - JohnTitor:clippy-up, r=JohnTitor
Update Clippy

Fixes #68631

r? @ghost
2020-01-29 16:39:45 +00:00
bors
eed12bcd0c Auto merge of #68635 - JohnTitor:rollup-jsc34ac, r=JohnTitor
Rollup of 7 pull requests

Successful merges:

 - #67722 (Minor: note how Any is an unsafe trait in SAFETY comments)
 - #68586 (Make conflicting_repr_hints a deny-by-default c-future-compat lint)
 - #68598 (Fix null synthetic_implementors error)
 - #68603 (Changelog: Demonstrate final build-override syntax)
 - #68609 (Set lld flavor for MSVC to link.exe)
 - #68611 (Correct ICE caused by macros generating invalid spans.)
 - #68627 (Document that write_all will not call write if given an empty buffer)

Failed merges:

r? @ghost
2020-01-29 13:40:58 +00:00
Stein Somers
ba87a50332 BTreeMap: tag and explain unsafe internal functions or assert preconditions
Co-Authored-By: Mark Rousskov <mark.simulacrum@gmail.com>
2020-01-29 11:52:21 +01:00
Yuki Okushi
50df7880a7
Rollup merge of #68627 - joshtriplett:write-all-none, r=Dylan-DPC
Document that write_all will not call write if given an empty buffer

Some types of Write instances have a semantic meaning associated with
writing an empty buffer, such as sending an empty packet. This works
when calling `write` directly, and supplying an empty buffer. However,
calling `write_all` on an empty buffer will simply never call `write`,
because `write_all` assumes it has no work to do.

Document this behavior, to help prospective users of
datagram-packet-style Write instances.
2020-01-29 18:56:34 +09:00
Yuki Okushi
0e365583f3
Rollup merge of #68611 - MichaelBurge:master, r=estebank
Correct ICE caused by macros generating invalid spans.

Closes #68605
2020-01-29 18:56:32 +09:00
Yuki Okushi
288cabde8c
Rollup merge of #68609 - Zoxc:lld-msvc, r=alexcrichton
Set lld flavor for MSVC to link.exe

This enables linking with LLD on Windows with just `-C linker=rust-lld` instead of needing `-C linker=rust-lld -C linker-flavor=lld-link`.
2020-01-29 18:56:31 +09:00
Yuki Okushi
95e7342773
Rollup merge of #68603 - kornelski:patch-1, r=pietroalbini
Changelog: Demonstrate final build-override syntax
2020-01-29 18:56:29 +09:00
Yuki Okushi
ed351e2818
Rollup merge of #68598 - GuillaumeGomez:fix-null-synthetic_implementors, r=ollie27
Fix null synthetic_implementors error

Fixes #68584.

r? @ollie27

cc @kinnison
2020-01-29 18:56:28 +09:00
Yuki Okushi
8f1857a822
Rollup merge of #68586 - Centril:repr-deny, r=pnkfelix
Make conflicting_repr_hints a deny-by-default c-future-compat lint

Closes https://github.com/rust-lang/rust/issues/68428.
cc https://github.com/rust-lang/rust/issues/68585.

r? @petrochenkov @pnkfelix
2020-01-29 18:56:26 +09:00