Commit Graph

106251 Commits

Author SHA1 Message Date
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
Yuki Okushi 36fd7b9a59
Rollup merge of #67722 - petertodd:2019-improve-any-comment, r=Mark-Simulacrum
Minor: note how Any is an unsafe trait in SAFETY comments

Motivation: helpful to people like myself reading the standard library source to better understand how to use Any, especially if we do go ahead with https://github.com/rust-lang/rust/pull/67562 and make it an unsafe trait.
2020-01-29 18:56:22 +09:00
Yuki Okushi 0464692bb3 Update Clippy 2020-01-29 18:41:09 +09:00
Yuki Okushi cef7764a76 Avoid ICE in macro's diagnostics 2020-01-29 18:03:45 +09:00
bors edb3684915 Auto merge of #68572 - tmiasko:sanitizer-use-after-scope, r=nikic
Detect use-after-scope bugs with AddressSanitizer

Enable use-after-scope checks by default when using AddressSanitizer.
They allow to detect incorrect use of stack objects after their scope
have already ended. The detection is based on LLVM lifetime intrinsics.

To facilitate the use of this functionality, the lifetime intrinsics are
now emitted regardless of optimization level if enabled sanitizer makes
use of them.
2020-01-29 07:44:36 +00:00
bors 343432a74d Auto merge of #68512 - spastorino:local-is-copy, r=oli-obk
Local is copy

r? @oli-obk
2020-01-29 04:36:50 +00:00
Peter Todd f722964d00
Minor: note why we can rely on Any trait for safety 2020-01-28 20:53:45 -05:00
bors d55f3e9f1d Auto merge of #68625 - JohnTitor:rollup-20pfcru, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #68289 (Don't ICE on path-collision in dep-graph)
 - #68378 (Add BTreeMap::remove_entry)
 - #68553 (Fix run button positionning in case of scrolling)
 - #68556 (rustdoc: Fix re-exporting primitive types)
 - #68582 (Add E0727 long explanation)
 - #68592 (fix: typo in vec.rs)
 - #68619 (Fix a few spelling mistakes)
 - #68620 (Update links to WASI docs in time.rs module)

Failed merges:

r? @ghost
2020-01-29 01:28:55 +00:00
Josh Triplett 9bb2a50e04 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-28 17:22:38 -08:00
Yuki Okushi c0df1be21e
Rollup merge of #68620 - kubkon:patch-1, r=Dylan-DPC
Update links to WASI docs in time.rs module

Since the docs for the WASI API are now evolving in [WebAssembly/WASI] repo,
I thought it might be useful to update the links in the docs to point to that location
instead of using the outdated `CraneStation/wasmtime` destination.

[WebAssembly/WASI]: https://github.com/WebAssembly/WASI

r? @steveklabnik

cc @alexcrichton
2020-01-29 09:34:54 +09:00
Yuki Okushi 10fbbf6fba
Rollup merge of #68619 - gorilskij:master, r=varkor
Fix a few spelling mistakes
2020-01-29 09:34:52 +09:00
Yuki Okushi 8d3273cdba
Rollup merge of #68592 - pdbrito:master, r=jonas-schievink
fix: typo in vec.rs
2020-01-29 09:34:51 +09:00
Yuki Okushi 9c1244d6a1
Rollup merge of #68582 - LeSeulArtichaut:code-explanations, r=Dylan-DPC
Add E0727 long explanation

Add long explanation for the `E0727` error code (async generators not yet supported).
Part of #61137

r? @GuillaumeGomez
2020-01-29 09:34:49 +09:00
Yuki Okushi edfa0f4345
Rollup merge of #68556 - ollie27:rustdoc_primitive_re-export, r=GuillaumeGomez
rustdoc: Fix re-exporting primitive types

* Generate links to the primitive type docs for re-exports.
* Don't ICE on cross crate primitive type re-exports.
* Make primitive type re-exports show up cross crate.

Fixes #67646
Closes #67972

r? @GuillaumeGomez
2020-01-29 09:34:48 +09:00
Yuki Okushi 85f324004e
Rollup merge of #68553 - GuillaumeGomez:fix-run-button-scroll-pos, r=kinnison
Fix run button positionning in case of scrolling

Fixes #68337.

r? @kinnison
2020-01-29 09:34:47 +09:00
Yuki Okushi af0c280be6
Rollup merge of #68378 - billyrieger:btreemap-remove-entry, r=KodrAus
Add BTreeMap::remove_entry

Implements https://github.com/rust-lang/rust/issues/66714.
2020-01-29 09:34:45 +09:00
Yuki Okushi cb3884adaa
Rollup merge of #68289 - pnkfelix:issue-62649-dont-ice-on-path-collision-in-dep-graph, r=michaelwoerister
Don't ICE on path-collision in dep-graph

Collisions in the dep-graph due to path-reuse are rare but can occur.

So, instead of ICE'ing, just fail to mark green in such cases (for `DepKind::{Hir, HirBody, CrateMetadata}`).

Fix #62649.
2020-01-29 09:34:43 +09:00
John Kåre Alsaker b0b11d31a2 Use termize instead of term_size 2020-01-29 01:13:48 +01:00
Jakub Konka 6fbb000893
Update links to WASI docs in time.rs module
Since the docs for the WASI API are now evolving in [WebAssembly/WASI] repo,
I thought it might be useful to update the links in the docs to point to that location
instead of using the outdated `CraneStation/wasmtime` destination.

[WebAssembly/WASI]: https://github.com/WebAssembly/WASI
2020-01-28 23:34:00 +01:00
Guillaume Gomez 0754461e02 Fix null synthetic_implementors error 2020-01-28 23:32:29 +01:00
gorilskij f0a7e8f58c
Fix a few spelling mistakes 2020-01-28 23:06:58 +01:00
bors 3761dcd346 Auto merge of #68606 - jonas-schievink:normalize-fastpath, r=Zoxc
Add an early-exit to `QueryNormalizer::fold_ty`

Pulled out from https://github.com/rust-lang/rust/pull/68524, this results in a ~60-70% reduction in compile time for the await-call-tree benchmarks. This should unblock https://github.com/rust-lang/rust/issues/67982 as well.

r? @Zoxc
2020-01-28 20:26:24 +00:00
LeSeulArtichaut 976a146203 Add E0727 long explanation 2020-01-28 21:17:12 +01:00
Michael Burge 79d8c9beab Correct ICE caused by macros generating invalid spans. 2020-01-28 11:02:22 -08:00
Waffle db1a107b3f Fill tracking issue for `iter_map_while` feature 2020-01-28 21:30:34 +03:00
Waffle 1aff08010d Add `Iterator::map_while` method and corresponding `MapWhile` adapter 2020-01-28 21:30:34 +03:00