Commit Graph

125171 Commits

Author SHA1 Message Date
bors
52b179b4b5 Auto merge of #75005 - adamreichold:limit-vector-count, r=Amanieu
Limit I/O vector count on Unix

Unix systems enforce limits on the vector count when performing vectored I/O via the readv and writev system calls and return EINVAL when these limits are exceeded. This changes the standard library to handle those limits as short reads and writes to avoid forcing its users to query these limits using platform specific mechanisms.

Fixes #68042
2020-08-05 17:58:55 +00:00
bors
2eab060ab7 Auto merge of #5859 - ebroto:5765_manual_async_fn_fp, r=yaahc
manual_async_fn: take input lifetimes into account

The anonymous future returned from an `async fn` captures all input
lifetimes. This was not being taken into account.

See https://github.com/rust-lang/rfcs/blob/master/text/2394-async_await.md#lifetime-capture-in-the-anonymous-future

changelog: Take input lifetimes into account in [`manual_async_fn`].

Fixes #5765
2020-08-05 17:52:28 +00:00
Bastian Kauschke
0d54f571c1 impl review 2020-08-05 18:30:37 +02:00
Bastian Kauschke
a5a5ca0da8 add tracking issue 2020-08-05 18:30:37 +02:00
Bastian Kauschke
188bbf840d forbid complex types for generic parameters 2020-08-05 18:30:37 +02:00
Bastian Kauschke
289e5fca7e forbid generic params in complex consts 2020-08-05 18:30:37 +02:00
Bastian Kauschke
375bccb8b3 add min_const_generics feature gate 2020-08-05 18:30:37 +02:00
bors
db870ea71b Auto merge of #75194 - Aaron1011:feature/macro-backtrace-numbers, r=eddyb
Show backtrace numbers in backtrace whenever more than one is involved

Previously, we only displayed 'frame' numbers in a macro backtrace when more
than two frames were involved. This commit should help make backtrace
more readable, since these kinds of messages can quickly get confusing.
2020-08-05 16:08:53 +00:00
Adam Reichold
9073acdc98 Add fallback for cfg(unix) targets that do not define libc::_SC_IOV_MAX. 2020-08-05 17:15:08 +02:00
Aaron Hill
f9f8923393
Show backtrace numbers in backtrace whenever more than one is involved
Previously, we only displayed 'frame' numbers in a macro backtrace when more
than two frames were involved. This commit should help make backtrace
more readable, since these kinds of messages can quickly get confusing.
2020-08-05 11:05:12 -04:00
Adam Reichold
04a0114e7e Rely only on POSIX semantics for I/O vector count
All #[cfg(unix)] platforms follow the POSIX standard and define _SC_IOV_MAX so
that we rely purely on POSIX semantics to determine the limits on I/O vector
count.
2020-08-05 16:57:02 +02:00
Adam Reichold
87edccf0f0 Reduce synchronization overhead of I/O vector count memoization 2020-08-05 16:57:02 +02:00
Adam Reichold
6672f7be03 Memoize the I/O vector count limit
Keep the I/O vector count limit in a `SyncOnceCell` to avoid the overhead of
repeatedly calling `sysconf` as these limits are guaranteed to not change during
the lifetime of a process by POSIX.
2020-08-05 16:57:02 +02:00
Adam Reichold
9468752581 Query maximum vector count on Linux and macOS
Both Linux and MacOS enforce limits on the vector count when performing vectored
I/O via the readv and writev system calls and return EINVAL when these limits
are exceeded. This changes the standard library to handle those limits as short
reads and writes to avoid forcing its users to query these limits using
platform specific mechanisms.
2020-08-05 16:57:02 +02:00
Takayuki Nakata
610d4e3c8b rustfmt 2020-08-05 23:10:30 +09:00
Takayuki Nakata
e48685edef Just check if it contains _ in for pat 2020-08-05 23:00:03 +09:00
Takayuki Nakata
228f668282 Use mutated_variables 2020-08-05 23:00:03 +09:00
Takayuki Nakata
b7ceb4d3d7 rustfmt 2020-08-05 23:00:03 +09:00
bors
ec9d5241f7 Auto merge of #75165 - JulianKnodt:i72787, r=lcnr
Add regression test for #72787

Add regression test for Issue #72787
Fixes #72787

~~Still waiting on running tests locally to bless the error output~~

r? @lcnr
2020-08-05 14:00:00 +00:00
Takayuki Nakata
14a4e3bcc8 Fix a lint message 2020-08-05 22:59:12 +09:00
Takayuki Nakata
1543e117cc cargo dev update_lints 2020-08-05 22:51:38 +09:00
Takayuki Nakata
2beb9090d1 Rename TypeckTables to TypeckResults 2020-08-05 22:51:38 +09:00
Takayuki Nakata
161f475100 Add test case for same_item_push 2020-08-05 22:51:38 +09:00
Takayuki Nakata
1e8ada3cab Add lint same_item_push 2020-08-05 22:51:38 +09:00
Guillaume Gomez
cd4633917d Clean up E0746 explanation 2020-08-05 14:14:21 +02:00
Aaron Hill
48bc398207
Handle fieldless tuple structs in diagnostic code
Fixes #75062
2020-08-05 07:59:26 -04:00
bors
8b84156c6e Auto merge of #75169 - ehuss:update-cargo, r=ehuss
Update cargo

8 commits in 2d5c2381e4e50484bf281fc1bfe19743aa9eb37a..1653f354644834073d6d2541e27fae94588e685e
2020-07-31 21:56:08 +0000 to 2020-08-04 23:14:37 +0000
- Fix close_output test. (rust-lang/cargo#8587)
- clippy fixes, use matches! macro in more places (rust-lang/cargo#8575)
- Display embedded man pages for built-in commands. (rust-lang/cargo#8456)
- Add mdman for generating man pages. (rust-lang/cargo#8577)
- Fix typo 'more then' -> 'more than' in error and comments (rust-lang/cargo#8581)
- cargo login: make login message less ambiguous (rust-lang/cargo#8579)
- Fix broken link in Build Cache chapter. (rust-lang/cargo#8578)
- Fix intra-doc tests for renamed lint. (rust-lang/cargo#8576)
2020-08-05 11:17:36 +00:00
bors
1d69e3b1d7 Auto merge of #75124 - nnethercote:clean-up-rustdoc-main, r=oli-obk
Clean up rustdoc's `main()`

It can be simplified and made more similar to rustc's `main()`.

r? @oli-obk
2020-08-05 09:09:17 +00:00
Aaron Hill
0d8260ee48
Label rustfmt toolstate issues with A-rustfmt
This makes it easier to filter toolstate issues by the tool involved.
2020-08-05 05:03:08 -04:00
bors
3d7e3fdffd Auto merge of #5857 - tmiasko:try-err-poll, r=matthiaskrgr
try_err: Consider Try impl for Poll when generating suggestions

There are two different implementation of `Try` trait for `Poll` type:
`Poll<Result<T, E>>` and `Poll<Option<Result<T, E>>>`. Take them into
account when generating suggestions.

For example, for `Err(e)?` suggest either `return Poll::Ready(Err(e))` or
`return Poll::Ready(Some(Err(e)))` as appropriate.

Fixes #5855

changelog: try_err: Consider Try impl for Poll when generating suggestions
2020-08-05 08:43:37 +00:00
Waffle Lapkin
188ef3a200
Fix typo in librustc_feature/active.rs 2020-08-05 11:02:47 +03:00
bors
7f8ff84b51 Auto merge of #75155 - davidtwco:polymorphization-incr-comp-optimisations, r=lcnr
polymorphization: various improvements

This PR includes a handful of polymorphisation-related changes:

- @Mark-Simulacrum's suggestions [from this comment](https://github.com/rust-lang/rust/pull/74633#issuecomment-668684433):
    - Use a `FiniteBitSet<u32>` over a `FiniteBitSet<u64>` as most functions won't have 64 generic parameters.
    - Don't encode polymorphisation results in metadata when every parameter is used (in this case, just invoking polymorphisation will probably be quicker).
- @lcnr's suggestion [from this comment](https://github.com/rust-lang/rust/pull/74717#discussion_r463690015).
    - Add an debug assertion in `ensure_monomorphic_enough` to make sure that polymorphisation did what we expect.

r? @lcnr
2020-08-05 06:55:42 +00:00
Lzu Tao
d9f260e95e Remove unused FromInner impl for Ipv4Addr 2020-08-05 05:53:07 +00:00
Lzu Tao
725d37cae0 Make doctests of Ipv4Addr::from(u32) easier to read 2020-08-05 05:31:17 +00:00
bors
dab2ae0404 Auto merge of #75037 - richkadel:llvm-coverage-map-gen-5.2, r=wesleywiser
Completes support for coverage in external crates

Follow-up to #74959 :

The prior PR corrected for errors encountered when trying to generate
the coverage map on source code inlined from external crates (including
macros and generics) by avoiding adding external DefIds to the coverage
map.

This made it possible to generate a coverage report including external
crates, but the external crate coverage was incomplete (did not include
coverage for the DefIds that were eliminated.

The root issue was that the coverage map was converting Span locations
to source file and locations, using the SourceMap for the current crate,
and this would not work for spans from external crates (compliled with a
different SourceMap).

The solution was to convert the Spans to filename and location during
MIR generation instead, so precompiled external crates would already
have the correct source code locations embedded in their MIR, when
imported into another crate.

@wesleywiser FYI
r? @tmandry
2020-08-05 05:08:19 +00:00
Joshua Nelson
fc273a035d Unresolved link -> incompatible link kind
Clearly it has been resolved, because we say on the next line what it
resolved to.
2020-08-05 00:20:37 -04:00
Joshua Nelson
444f5a0556 Give a much better error message if the struct failed to resolve 2020-08-05 00:20:34 -04:00
bors
119d2a1a98 Auto merge of #75174 - JohnTitor:rollup-z9djftk, r=JohnTitor
Rollup of 5 pull requests

Successful merges:

 - #75139 (Remove log alias from librustdoc)
 - #75140 (Clean up E0745)
 - #75149 (Correct a typo in interpret/memory.rs)
 - #75152 (Replace `Memoryblock` with `NonNull<[u8]>`)
 - #75168 (Update books)

Failed merges:

r? @ghost
2020-08-05 03:04:21 +00:00
Lzu Tao
30a1455c8d Use u32::from_ne_bytes to fix a FIXME
Co-authored-by: Weiyi Wang <wwylele@gmail.com>
Co-authored-by: Adam Reichold <adam.reichold@t-online.de>
Co-authored-by: Josh Stone <cuviper@gmail.com>
Co-authored-by: Scott McMurray <scottmcm@users.noreply.github.com>
Co-authored-by: tmiasko <tomasz.miasko@gmail.com>
2020-08-05 02:49:26 +00:00
Yuki Okushi
324faf1aac
Rollup merge of #75168 - ehuss:update-books, r=ehuss
Update books

## reference

7 commits in b329ce37424874ad4db94f829a55807c6e21d2cb..c9b2736a059469043177e1e4ed41a55d7c63ac28
2020-07-20 08:54:08 -0700 to 2020-08-03 03:34:03 -0700
- Fix documented build output path. (rust-lang-nursery/reference#870)
- Update token usage table. (rust-lang-nursery/reference#868)
- Allow trait inner attributes (rust-lang-nursery/reference#864)
- patterns.md - add word "underscore" to _ paragraph (rust-lang-nursery/reference#865)
- Drive-by mention unsafe fn closure coercion (rust-lang-nursery/reference#802)
- grammar: Change "For awhile" to "For a while" (rust-lang-nursery/reference#857)
- Added Unpin to list of Auto Traits (rust-lang-nursery/reference#854)

## book

7 commits in a914f2c7e5cdb771fa465de142381a51c53b580e..363293c1c5ce9e84ea3935a5e29ce8624801208a
2020-07-21 09:20:05 -0500 to 2020-08-03 15:56:30 -0500
- replace commas with m-dashes to improve readability of chapter 4.1 (rust-lang/book#2419)
- Update TOML link to official website (rust-lang/book#2411)
- Add github repo link (rust-lang/book#2265)
- Remove the version number entirely so we can stop updating it
- Add link to the `Vec&lt;T&gt;` API documentation (rust-lang/book#2249)
- link to stdlib atomic docs (rust-lang/book#2361)
- mdbook version used is now 0.4.x (rust-lang/book#2410)

## rust-by-example

1 commits in 229c6945a26a53a751ffa4f9cb418388c00029d3..2e9271981adc32613365810f3428334c07095215
2020-07-06 10:13:15 -0300 to 2020-07-27 13:39:16 -0500
- Replaced "princess" with "royal" (rust-lang/rust-by-example#1363)

## embedded-book

1 commits in 94d9ea8460bcbbbfef1877b47cb930260b5849a7..b5256448a2a4c1bec68b93c0847066f92f2ff5a9
2020-07-05 14:17:40 +0000 to 2020-07-24 23:09:29 +0000
- Update c-with-rust.md  (rust-embedded/book#256)
2020-08-05 11:40:11 +09:00
Yuki Okushi
5f87ee0ab1
Rollup merge of #75152 - TimDiekmann:replace_memblock, r=Amanieu
Replace `Memoryblock` with `NonNull<[u8]>`

Closes rust-lang/wg-allocators#61

r? @Amanieu
2020-08-05 11:40:10 +09:00
Yuki Okushi
7123daff53
Rollup merge of #75149 - felixonmars:patch-1, r=wesleywiser
Correct a typo in interpret/memory.rs
2020-08-05 11:40:08 +09:00
Yuki Okushi
008228a708
Rollup merge of #75140 - GuillaumeGomez:cleanup-e0745, r=pickfire
Clean up E0745

r? @Dylan-DPC
2020-08-05 11:40:07 +09:00
Yuki Okushi
7b39f75187
Rollup merge of #75139 - pickfire:librustdoc-import, r=jyn514
Remove log alias from librustdoc

r? @jyn514
2020-08-05 11:40:05 +09:00
Nicholas Nethercote
5f8a11279d Be smarter about error handling in run().
`run()` returns `Result<(), String>`. But on failure it always returns
an empty string, and then `wrap_return()` treats an empty string
specially, by not reporting the error.

It turns out we already have the `ErrorReported` type for this sort of
behaviour. This commit changes `run()` to use it.
2020-08-05 11:25:57 +10:00
bors
32d14eba47 Auto merge of #75130 - lcnr:array_chunks, r=ecstatic-morse
forbid `#[track_caller]` on main

fixes #75125

cc @anp
2020-08-05 01:13:19 +00:00
JarredAllen
542740c2ec Run cargo dev fmt 2020-08-04 17:53:29 -07:00
Nicholas Nethercote
af4e3e08ea Remove setup_callbacks_and_run_in_default_thread_pool_with_globals().
It's a very thin wrapper around
`setup_callbacks_and_run_in_thread_pool_with_globals()` and it has a
single call site.
2020-08-05 10:42:45 +10:00
Nicholas Nethercote
530140729a Avoid an unnecessary thread creation at rustdoc startup.
rustdoc's `main()` immediately spawns a thread, M, with a large stack
(16MiB or 32MiB) on which it runs `main_args()`. `main_args()` does a
small amount of options processing and then calls
`setup_callbacks_and_run_in_default_thread_pool_with_globals()`, which
spawns it own thread, and M is not used further.

So, thread M seems unnecessary. However, it does serve a purpose: if the
options processing in `main_args()` panics, that panic is caught when M
is joined. So M can't simply be removed.

However, `main_options()`, which is called by `main_args()`, has a
`catch_fatal_errors()` call within it. We can move that call to `main()`
and change it to the very similar `catch_with_exit_code()`. With that in
place, M can be removed, and panics from options processing will still
be caught appropriately.

Even better, this makes rustdoc's `main()` match rustc's `main()`, which
also uses `catch_with_exit_code()`.

(Also note that the use of a 16MiB/32MiB stack was eliminated from rustc
in #55617.)
2020-08-05 10:42:42 +10:00
Eric Huss
f6855eacd1 Update cargo 2020-08-04 17:08:47 -07:00