]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAuto merge of #74748 - simonvandel:simplify-discriminant-arm, r=wesleywiser
bors [Mon, 17 Aug 2020 18:33:24 +0000 (18:33 +0000)]
Auto merge of #74748 - simonvandel:simplify-discriminant-arm, r=wesleywiser

MIR-OPT: Make SimplifyBranchSame able to remove identity match with fieldless variant

Modifies SimplifyBranchSame so that it can see that the statements can be considered equal in the following example
`_0 = _1` and `discriminant(_0) = discriminant(0)` are considered equal if 0 is a fieldless variant of an enum.

3 years agoAuto merge of #75187 - pawanbisht62:feature/incorporate-tracing, r=oli-obk
bors [Mon, 17 Aug 2020 16:40:10 +0000 (16:40 +0000)]
Auto merge of #75187 - pawanbisht62:feature/incorporate-tracing, r=oli-obk

Incorporated Tracing Crate in some libraries

Issue #74747

3 years agoAuto merge of #74940 - oli-obk:const_is_null, r=RalfJung
bors [Mon, 17 Aug 2020 14:13:13 +0000 (14:13 +0000)]
Auto merge of #74940 - oli-obk:const_is_null, r=RalfJung

Make `<*const T>::is_null` const fn

r? @RalfJung

cc @rust-lang/wg-const-eval

tracking issue: #74939

3 years agoMake a test platform independent
Oliver Scherer [Mon, 17 Aug 2020 13:31:48 +0000 (15:31 +0200)]
Make a test platform independent

3 years agoAuto merge of #75592 - RalfJung:miri-int-align, r=oli-obk
bors [Mon, 17 Aug 2020 12:11:41 +0000 (12:11 +0000)]
Auto merge of #75592 - RalfJung:miri-int-align, r=oli-obk

miri engine: add option to use force_int for alignment check

This is needed for https://github.com/rust-lang/miri/issues/1074. The Miri-side patch is at https://github.com/rust-lang/miri/pull/1513.

r? @oli-obk

3 years agofix typo
Ralf Jung [Mon, 17 Aug 2020 12:11:03 +0000 (14:11 +0200)]
fix typo

Co-authored-by: Oliver Scherer <github35764891676564198441@oli-obk.de>
3 years agoAuto merge of #75535 - denisvasilik:intra-doc-links-any, r=jyn514
bors [Mon, 17 Aug 2020 08:00:45 +0000 (08:00 +0000)]
Auto merge of #75535 - denisvasilik:intra-doc-links-any, r=jyn514

Move to intra-doc links for /library/core/src/any.rs

Helps with #75080.

@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc

Known issues:

* Links from `core` to `std` (#74481):
    * `[Box]: ../../std/boxed/struct.Box.html`

3 years agoAuto merge of #75468 - poliorcetics:intra-links-fs, r=jyn514
bors [Mon, 17 Aug 2020 06:02:16 +0000 (06:02 +0000)]
Auto merge of #75468 - poliorcetics:intra-links-fs, r=jyn514

Move to intra doc links in std/src/fs.rs

Helps with #75080.

@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc

3 years agoAuto merge of #75568 - ehuss:cloudabi-tier3, r=Mark-Simulacrum
bors [Mon, 17 Aug 2020 03:52:46 +0000 (03:52 +0000)]
Auto merge of #75568 - ehuss:cloudabi-tier3, r=Mark-Simulacrum

Move CloudABI to tier 3.

The CloudABI target hasn't had much work done on it in a while, and it doesn't appear to be in active use. It has a fairly substantial amount of code, particularly in the [sys module](https://github.com/rust-lang/rust/tree/5addb135edc2653b07670482a430aac9b655a86b/library/std/src/sys/cloudabi) that requires actively supporting. I contacted @EdSchouten who indicated that many of the CloudABI concepts are now in WASI, and that they are OK with the target being moved to tier 3.

3 years agoAuto merge of #75014 - Amanieu:fix_asm_reg, r=nagisa
bors [Mon, 17 Aug 2020 01:57:50 +0000 (01:57 +0000)]
Auto merge of #75014 - Amanieu:fix_asm_reg, r=nagisa

Work around LLVM issues with explicit register in inline asm

Fixes #74658

3 years agoAuto merge of #74562 - pickfire:is_ascii_branchless, r=nagisa
bors [Sun, 16 Aug 2020 23:52:32 +0000 (23:52 +0000)]
Auto merge of #74562 - pickfire:is_ascii_branchless, r=nagisa

Remove branch in optimized is_ascii

Performs slightly better in short or medium bytes by eliminating
the last branch check on `byte_pos == len` and always check the
last byte as it is always at most one `usize`.

Benchmark, before `libcore`, after `libcore_new`. It improves
medium and short by 1ns but regresses unaligned_tail by 2ns,
either way we can get unaligned_tail have a tiny chance of 1/8
on a 64 bit machine. I don't think we should bet on that, the
probability is worse than dice.

```
test long::case00_libcore                     ... bench:          38 ns/iter (+/- 1) = 183947 MB/s
test long::case00_libcore_new                 ... bench:          38 ns/iter (+/- 1) = 183947 MB/s
test long::case01_iter_all                    ... bench:         227 ns/iter (+/- 6) = 30792 MB/s
test long::case02_align_to                    ... bench:          40 ns/iter (+/- 1) = 174750 MB/s
test long::case03_align_to_unrolled           ... bench:          19 ns/iter (+/- 1) = 367894 MB/s
test medium::case00_libcore                   ... bench:           5 ns/iter (+/- 0) = 6400 MB/s
test medium::case00_libcore_new               ... bench:           4 ns/iter (+/- 0) = 8000 MB/s
test medium::case01_iter_all                  ... bench:          20 ns/iter (+/- 1) = 1600 MB/s
test medium::case02_align_to                  ... bench:           6 ns/iter (+/- 0) = 5333 MB/s
test medium::case03_align_to_unrolled         ... bench:           5 ns/iter (+/- 0) = 6400 MB/s
test short::case00_libcore                    ... bench:           7 ns/iter (+/- 0) = 1000 MB/s
test short::case00_libcore_new                ... bench:           6 ns/iter (+/- 0) = 1166 MB/s
test short::case01_iter_all                   ... bench:           5 ns/iter (+/- 0) = 1400 MB/s
test short::case02_align_to                   ... bench:           5 ns/iter (+/- 0) = 1400 MB/s
test short::case03_align_to_unrolled          ... bench:           5 ns/iter (+/- 1) = 1400 MB/s
test unaligned_both::case00_libcore           ... bench:           4 ns/iter (+/- 0) = 7500 MB/s
test unaligned_both::case00_libcore_new       ... bench:           4 ns/iter (+/- 0) = 7500 MB/s
test unaligned_both::case01_iter_all          ... bench:          26 ns/iter (+/- 0) = 1153 MB/s
test unaligned_both::case02_align_to          ... bench:          13 ns/iter (+/- 2) = 2307 MB/s
test unaligned_both::case03_align_to_unrolled ... bench:          11 ns/iter (+/- 0) = 2727 MB/s
test unaligned_head::case00_libcore           ... bench:           5 ns/iter (+/- 0) = 6200 MB/s
test unaligned_head::case00_libcore_new       ... bench:           5 ns/iter (+/- 0) = 6200 MB/s
test unaligned_head::case01_iter_all          ... bench:          19 ns/iter (+/- 1) = 1631 MB/s
test unaligned_head::case02_align_to          ... bench:          10 ns/iter (+/- 0) = 3100 MB/s
test unaligned_head::case03_align_to_unrolled ... bench:          14 ns/iter (+/- 0) = 2214 MB/s
test unaligned_tail::case00_libcore           ... bench:           3 ns/iter (+/- 0) = 10333 MB/s
test unaligned_tail::case00_libcore_new       ... bench:           5 ns/iter (+/- 0) = 6200 MB/s
test unaligned_tail::case01_iter_all          ... bench:          19 ns/iter (+/- 0) = 1631 MB/s
test unaligned_tail::case02_align_to          ... bench:          10 ns/iter (+/- 0) = 3100 MB/s
test unaligned_tail::case03_align_to_unrolled ... bench:          13 ns/iter (+/- 0) = 2384 MB/s
```

Rough (unfair) maths on improvements for fun: 1ns * 7/8 - 2ns * 1/8 = 0.625ns

Inspired by fish and zsh clever trick to highlight missing linefeeds (⏎)
and branchless implementation of binary_search in rust.

cc @thomcc https://github.com/rust-lang/rust/pull/74066
r? @nagisa

3 years agoAuto merge of #75609 - tmandry:rollup-yrcmgke, r=tmandry
bors [Sun, 16 Aug 2020 22:00:29 +0000 (22:00 +0000)]
Auto merge of #75609 - tmandry:rollup-yrcmgke, r=tmandry

Rollup of 10 pull requests

Successful merges:

 - #74204 (Don't visit foreign function bodies when lowering ast to hir)
 - #74314 (rustc_typeck: construct {Closure,Generator}Substs more directly.)
 - #74346 (Use LocalDefId instead of HirId for reachable_set elements.)
 - #74399 (Move DelaySpanBugEmitted to ty::context)
 - #75177 (Add regression test for issue-66768)
 - #75223 (Add #[track_caller] to `Session::delay_span_bug`)
 - #75423 (Move to intra-doc links for /library/core/src/hint.rs)
 - #75485 (pin docs: add some forward references)
 - #75569 (Bump minor version of emsdk to 1.38.47)
 - #75596 (Switch to intra-doc links in /sys/windows/ext/{ffi,fs,process}.rs)

Failed merges:

r? @ghost

3 years agoRollup merge of #75596 - nixphix:docs/windows-ext, r=jyn514
Tyler Mandry [Sun, 16 Aug 2020 21:59:36 +0000 (14:59 -0700)]
Rollup merge of #75596 - nixphix:docs/windows-ext, r=jyn514

Switch to intra-doc links in /sys/windows/ext/{ffi,fs,process}.rs

Partial fix for #75080

@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc

r? @jyn514

3 years agoRollup merge of #75569 - tmiasko:emscripten, r=tlively
Tyler Mandry [Sun, 16 Aug 2020 21:59:34 +0000 (14:59 -0700)]
Rollup merge of #75569 - tmiasko:emscripten, r=tlively

Bump minor version of emsdk to 1.38.47

Release Notes:

```
v1.38.47: 10/02/2019
--------------------
 - Add support for FETCH API in WASM backend. This doesn't support FETCH in the
   main thread (`USE_FETCH_WORKER=0` is enforced). #9490
 - Redefine errno values to be consistent with wasi. This will let us avoid
   needing to convert the values back and forth as we use more wasi APIs.
   This is an ABI change, which should not be noticeable from user code
   unless you use errno defines (like EAGAIN) *and* keep around binaries
   compiled with an older version that you link against. In that case, you
   should rebuild them. See #9545.
 - Removed build option `-s ONLY_MY_CODE` as we now have much better solutions
   for that, like building to a wasm object file or using `STANDALONE_WASM`
   etc. (see
   https://github.com/emscripten-core/emscripten/wiki/WebAssembly-Standalone).
 - Emscripten now supports the config file (.emscripten) being placed in the
   emscripten directory rather that the current user's home directory.
   See #9543
```

Motivated by changes to errno values which are currently out of sync with those
in libc crate which uses wasi values already. Helps with #72808 and #75532.

3 years agoRollup merge of #75485 - RalfJung:pin, r=nagisa
Tyler Mandry [Sun, 16 Aug 2020 21:59:32 +0000 (14:59 -0700)]
Rollup merge of #75485 - RalfJung:pin, r=nagisa

pin docs: add some forward references

@nagisa had some questions about pinning that were answered in the docs, which they did not realize because that discussion is below the examples. I still think it makes sense to introduce the examples before that discussion, since it give the discussion something concrete to refer to, but this PR adds some forward references so people don't think the examples conclude the docs.

@nagisa do you think this would have helped?

3 years agoRollup merge of #75423 - denisvasilik:intra-doc-links-core-hint, r=dtolnay
Tyler Mandry [Sun, 16 Aug 2020 21:59:30 +0000 (14:59 -0700)]
Rollup merge of #75423 - denisvasilik:intra-doc-links-core-hint, r=dtolnay

Move to intra-doc links for /library/core/src/hint.rs

Helps with #75080.

@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc

3 years agoRollup merge of #75223 - Aaron1011:feature/session-track-caller, r=eddyb
Tyler Mandry [Sun, 16 Aug 2020 21:59:29 +0000 (14:59 -0700)]
Rollup merge of #75223 - Aaron1011:feature/session-track-caller, r=eddyb

Add #[track_caller] to `Session::delay_span_bug`

This forwards the caller span to `Handler::delay_span_bug`

3 years agoRollup merge of #75177 - JohnTitor:broken-mir-test, r=eddyb
Tyler Mandry [Sun, 16 Aug 2020 21:59:27 +0000 (14:59 -0700)]
Rollup merge of #75177 - JohnTitor:broken-mir-test, r=eddyb

Add regression test for issue-66768

Fixes #66768

This is fixed by #70452 (in particular, https://github.com/rust-lang/rust/pull/70452/files#diff-53aef089a36a8e2ed07627fc8915fe63R1763) and I'm not sure it's worth to add this test (i.e. the tests in #70452 are enough), so r? @eddyb to confirm it.

3 years agoRollup merge of #74399 - mark-i-m:ty-err-4, r=eddyb
Tyler Mandry [Sun, 16 Aug 2020 21:59:25 +0000 (14:59 -0700)]
Rollup merge of #74399 - mark-i-m:ty-err-4, r=eddyb

Move DelaySpanBugEmitted to ty::context

This makes it even hard to abuse.

r? @eddyb

cc @LeSeulArtichaut as this will probably conflict with your PR :/

3 years agoRollup merge of #74346 - eddyb:reachable-defs, r=nikomatsakis
Tyler Mandry [Sun, 16 Aug 2020 21:59:23 +0000 (14:59 -0700)]
Rollup merge of #74346 - eddyb:reachable-defs, r=nikomatsakis

Use LocalDefId instead of HirId for reachable_set elements.

The only `HirId`s being tracked there that don't have matching `DefId`s are local variables, and that's an accident from #44316 (where I preserved the old behavior, even if nothing relied on reachability tracking local variables).

3 years agoRollup merge of #74314 - eddyb:closure-substs-direct, r=nikomatsakis
Tyler Mandry [Sun, 16 Aug 2020 21:59:21 +0000 (14:59 -0700)]
Rollup merge of #74314 - eddyb:closure-substs-direct, r=nikomatsakis

rustc_typeck: construct {Closure,Generator}Substs more directly.

We've previously not had a way to create `{Closure,Generator}Substs` other than instantiating all generics as inference variables and unifying the inference types (extracted using the regular `{Closure,Generator}Substs` accessors), with the actual types.

With this PR, those hacks, and assumptions about the order of closure/generator-specific components, are replaced with a simple API where the base `Substs` are combined with the additional information into a `{Closure,Generator}Substs`.
This might also be faster than relying inference, although probably not by much.

r? @nikomatsakis cc #53488 @blitzerr

3 years agoRollup merge of #74204 - ayazhafiz:i/74120, r=eddyb
Tyler Mandry [Sun, 16 Aug 2020 21:59:20 +0000 (14:59 -0700)]
Rollup merge of #74204 - ayazhafiz:i/74120, r=eddyb

Don't visit foreign function bodies when lowering ast to hir

Previously the existence of bodies inside a foreign function block would
cause a panic in the hir `NodeCollector` during its collection of crate
bodies to compute a crate hash:

https://github.com/rust-lang/rust/blob/e59b08e62ea691916d2f063cac5aab4634128022/src/librustc_middle/hir/map/collector.rs#L154-L158

The collector walks the hir tree and creates a map of hir nodes, then
attaching bodies in the crate to their owner in the map. For a code like

```rust
extern "C" {
    fn f() {
        fn g() {}
    }
}
```

The crate bodies include the body of the function `g`. But foreign
functions cannot have bodies, and while the parser AST permits a foreign
function to have a body, the hir doesn't. This means that the body of
`f` is not present in the hir, and so neither is `g`. So when the
`NodeCollector` finishes the walking the hir, it has no record of `g`,
cannot find an owner for the body of `g` it sees in the crate bodies,
and blows up.

Why do the crate bodies include the body of `g`? The AST walker has a
need a for walking function bodies, and FFIs share the same AST node as
functions in other contexts.

There are at least two options to fix this:

- Don't unwrap the map entry for an hir node in the `NodeCollector`
- Modifier the ast->hir lowering visitor to ignore foreign function
  blocks

I don't think the first is preferrable, since we want to know when we
can't find a body for an hir node that we thought had one (dropping this
information may lead to an invalid hash). So this commit implements the
second option.

Closes #74120

3 years agoFix fortanix build
Mark Rousskov [Sun, 16 Aug 2020 20:34:39 +0000 (16:34 -0400)]
Fix fortanix build

3 years agoImplement 'considered equal' for statements, so that for example `_0 = _1` and `discr...
Simon Vandel Sillesen [Sat, 25 Jul 2020 15:46:11 +0000 (17:46 +0200)]
Implement 'considered equal' for statements, so that for example `_0 = _1` and `discriminant(_0) = discriminant(0)` are considered equal if 0 is a fieldless variant of an enum

3 years agomove DelaySpanBugEmitted to ty::context
mark [Thu, 16 Jul 2020 15:21:10 +0000 (10:21 -0500)]
move DelaySpanBugEmitted to ty::context

3 years agoAuto merge of #73176 - LeSeulArtichaut:tyctxtat-err, r=eddyb
bors [Sun, 16 Aug 2020 18:48:26 +0000 (18:48 +0000)]
Auto merge of #73176 - LeSeulArtichaut:tyctxtat-err, r=eddyb

Add `TyCtxtAt::{ty_error, ty_error_with_message}`

~~Only e2d957d was added, the rest comes from #70551.~~
I was unsure where to put the implementation for those methods, please tell me if there is a better place for it.

Closes #72619, ~~blocked on #70551~~.

r? @eddyb cc @mark-i-m, maybe this should be part of #70551? If so feel free to cherry-pick or ask me to file a PR against your fork.

3 years agorustc_typeck: construct {Closure,Generator}Substs more directly.
Eduard-Mihai Burtescu [Mon, 13 Jul 2020 14:12:07 +0000 (17:12 +0300)]
rustc_typeck: construct {Closure,Generator}Substs more directly.

3 years agoUse LocalDefId instead of HirId for reachable_set elements.
Eduard-Mihai Burtescu [Tue, 14 Jul 2020 23:51:46 +0000 (02:51 +0300)]
Use LocalDefId instead of HirId for reachable_set elements.

3 years agoSwitch to intra-doc links in /sys/windows/ext/{ffi,fs,process}.rs
Prabakaran Kumaresshan [Sun, 16 Aug 2020 16:58:45 +0000 (22:28 +0530)]
Switch to intra-doc links in /sys/windows/ext/{ffi,fs,process}.rs

3 years agoAuto merge of #75472 - Mark-Simulacrum:mangling-config, r=eddyb
bors [Sun, 16 Aug 2020 16:58:13 +0000 (16:58 +0000)]
Auto merge of #75472 - Mark-Simulacrum:mangling-config, r=eddyb

Add option to use the new symbol mangling in rustc/std

I don't know if this causes problems in some cases -- maybe it should be on by default for at least rustc. I've never encountered problems with it other than tools not supporting it, though.

cc @nnethercote
r? @eddyb

3 years agomiri engine: add option to use force_int for alignment check
Ralf Jung [Sun, 16 Aug 2020 15:36:46 +0000 (17:36 +0200)]
miri engine: add option to use force_int for alignment check

3 years agoAuto merge of #75567 - poliorcetics:intra-links-std-net, r=jyn514
bors [Sun, 16 Aug 2020 13:15:52 +0000 (13:15 +0000)]
Auto merge of #75567 - poliorcetics:intra-links-std-net, r=jyn514

Move to intra doc links in std::net

Helps with #75080.

@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc

The links for `true` and `false` had to stay else `rustdoc` complained, it is intended ?

3 years agoFix a link, improve method resolution
Alexis Bourget [Sun, 16 Aug 2020 12:41:12 +0000 (14:41 +0200)]
Fix a link, improve method resolution

3 years agoAuto merge of #75536 - estebank:e0255-suggestion, r=varkor
bors [Sun, 16 Aug 2020 11:16:44 +0000 (11:16 +0000)]
Auto merge of #75536 - estebank:e0255-suggestion, r=varkor

Tweak output of E0225

When encountering multiple non-auto trait bounds suggest creating a new
trait and explain what auto-traits are.

_Inspired by https://fasterthanli.me/articles/frustrated-its-not-you-its-rust_

3 years agoAuto merge of #75565 - nixphix:docs/vxworks-ext, r=jyn514
bors [Sun, 16 Aug 2020 08:45:52 +0000 (08:45 +0000)]
Auto merge of #75565 - nixphix:docs/vxworks-ext, r=jyn514

Switch to intra-doc links in std/src/sys/vxworks/ext/{fs,process}.rs

Partial fix for #75080

@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc

r? @jyn514

3 years agoAuto merge of #75561 - kornelski:stringcol, r=Dylan-DPC
bors [Sun, 16 Aug 2020 06:26:38 +0000 (06:26 +0000)]
Auto merge of #75561 - kornelski:stringcol, r=Dylan-DPC

Doc: String isn't a collection

On forums one user was confused by this text, interpreting it as saying that `String` is a `Vec<char>` literally, rather than figuratively for the purpose of collect. I've reworded that paragraph.

3 years agoAuto merge of #75553 - denisvasilik:intra-doc-links-convert, r=jyn514
bors [Sun, 16 Aug 2020 04:31:05 +0000 (04:31 +0000)]
Auto merge of #75553 - denisvasilik:intra-doc-links-convert, r=jyn514

Move to intra-doc links for /library/core/src/char/convert.rs

Helps with #75080.

@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc

3 years agoAuto merge of #75541 - camelid:intra-doc-links-for-core-option, r=jyn514
bors [Sun, 16 Aug 2020 02:39:21 +0000 (02:39 +0000)]
Auto merge of #75541 - camelid:intra-doc-links-for-core-option, r=jyn514

Switch to intra-doc links in `core::option`

Part of #75080.

I didn't change some of the links since they link into `std` and you can't link from `core` to `std` (#74481).

Also, at least one other link can't be switched to an intra-doc link because it's not supported yet (#74489).

3 years agoAuto merge of #75575 - marmeladema:only-measure-drop-ast, r=eddyb
bors [Sat, 15 Aug 2020 23:55:56 +0000 (23:55 +0000)]
Auto merge of #75575 - marmeladema:only-measure-drop-ast, r=eddyb

Only measure time spent dropping the AST

r? @eddyb

3 years agoOnly measure time spent dropping the AST
marmeladema [Sat, 15 Aug 2020 23:21:14 +0000 (00:21 +0100)]
Only measure time spent dropping the AST

3 years agoAuto merge of #75514 - gdhuper:gdhuper/replace_log_with_tracing, r=davidtwco
bors [Sat, 15 Aug 2020 22:00:06 +0000 (22:00 +0000)]
Auto merge of #75514 - gdhuper:gdhuper/replace_log_with_tracing, r=davidtwco

Replaced `log` with `tracing`

## Description

Replaced `log` with `tracing` in the following crates:
- [x] librustc_ast
- [x] librustc_driver
- [x]  librustc_errors
- [x] librustc_expand
- [x]  librustc_hir
- [x]  librustc_incremental
- [x]  librustc_infer
- [x]  librustc_interface
- [x]  librustc_lint
- [x]  librustc_metadata
- [x]  librustc_middle
- [x]  librustc_mir
- [x]  librustc_mir_build
- [x]  librustc_parse
- [x]  librustc_passes
- [x]  librustc_privacy
- [x]  librustc_query_system
- [x]  librustc_resolve
- [x]  librustc_save_analysis
- [x] librustc_session
- [x] librustc_span
- [x] librustc_symbol_mangling
- [x] librustc_target
- [x] librustc_trait_selection
- [x] librustc_traits
- [x] librustc_ty
- [x] librustc_typeck
- [x] compiletest

Fixes: #74747
## Checklist:
- [x] Code compiles / builds
- [x] run tidy
- [x] Cleanup any clippy warnings
- [x] Update/add docs

3 years agoBump minor version of emsdk to 1.38.47
Tomasz Miąsko [Sat, 15 Aug 2020 00:00:00 +0000 (00:00 +0000)]
Bump minor version of emsdk to 1.38.47

Release Notes:

```
v1.38.47: 10/02/2019
--------------------
 - Add support for FETCH API in WASM backend. This doesn't support FETCH in the
   main thread (`USE_FETCH_WORKER=0` is enforced). #9490
 - Redefine errno values to be consistent with wasi. This will let us avoid
   needing to convert the values back and forth as we use more wasi APIs.
   This is an ABI change, which should not be noticeable from user code
   unless you use errno defines (like EAGAIN) *and* keep around binaries
   compiled with an older version that you link against. In that case, you
   should rebuild them. See #9545.
 - Removed build option `-s ONLY_MY_CODE` as we now have much better solutions
   for that, like building to a wasm object file or using `STANDALONE_WASM`
   etc. (see
   https://github.com/emscripten-core/emscripten/wiki/WebAssembly-Standalone).
 - Emscripten now supports the config file (.emscripten) being placed in the
   emscripten directory rather that the current user's home directory.
   See #9543
```

3 years agoreplaced log with tracing
Gurpreet Singh [Fri, 14 Aug 2020 06:05:01 +0000 (23:05 -0700)]
replaced log with tracing

3 years agoAuto merge of #75246 - pickfire:patch-5, r=Amanieu
bors [Sat, 15 Aug 2020 19:51:44 +0000 (19:51 +0000)]
Auto merge of #75246 - pickfire:patch-5, r=Amanieu

Add more examples to Path ends_with

We faced a footgun when using ends_with to check extension,
showing an example could prevent that.

https://github.com/rust-dc/fish-manpage-completions/pull/106/commits/2c155e50b2d9e607174908b3f80f1dcf92693eee

3 years agoAuto merge of #75560 - Mark-Simulacrum:rustc-docs, r=matthiaskrgr
bors [Sat, 15 Aug 2020 18:01:06 +0000 (18:01 +0000)]
Auto merge of #75560 - Mark-Simulacrum:rustc-docs, r=matthiaskrgr

Add rustc-docs as a component

Previously it was listed as a package but wasn't available in the component
lists in rustup, so wasn't actually installable.

rustc-docs is also only present for x86_64-unknown-linux-gnu. Eventually it'll
also be shipped for aarch64-gnu with current CI configuration, but that builder
isn't quite up and running yet.

We probably want to ship compiler docs for other platforms as well, though, but
this commit doesn't enable that quite yet. A future PR may do so by adding
--enable-compiler-docs to the relevant builders (but it would also need to
decide the set of builders which we'd ship on).

r? @matthiaskrgr

3 years agoLink to primitive instead of module
Denis Vasilik [Sat, 15 Aug 2020 17:27:34 +0000 (19:27 +0200)]
Link to primitive instead of module

3 years agoMove to intra doc links in std::net
Alexis Bourget [Sat, 15 Aug 2020 17:17:19 +0000 (19:17 +0200)]
Move to intra doc links in std::net

3 years agoDoc: String isn't a collection
Kornel Lesiński [Sat, 15 Aug 2020 11:34:15 +0000 (12:34 +0100)]
Doc: String isn't a collection

3 years agoRemove unnecessary intra-doc link
Camelid [Sat, 15 Aug 2020 16:52:35 +0000 (09:52 -0700)]
Remove unnecessary intra-doc link

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
3 years agoinline linking
Prabakaran Kumaresshan [Sat, 15 Aug 2020 16:41:09 +0000 (22:11 +0530)]
inline linking

3 years agoFix link
Camelid [Sat, 15 Aug 2020 16:31:14 +0000 (09:31 -0700)]
Fix link

Intra-doc links don't work yet in this case: #74489

3 years agoremove empty lines
Prabakaran Kumaresshan [Sat, 15 Aug 2020 16:23:02 +0000 (21:53 +0530)]
remove empty lines

3 years agoAuto merge of #75483 - mati865:mingw-lld-flags, r=petrochenkov
bors [Sat, 15 Aug 2020 15:51:55 +0000 (15:51 +0000)]
Auto merge of #75483 - mati865:mingw-lld-flags, r=petrochenkov

Add LLD flags for MinGW

Tested locally and this now works:
- `RUSTFLAGS="-Zlink-self-contained=yes -Clinker=rust-lld" cargo b`
- `RUSTFLAGS="-Zlink-self-contained=no -Clinker=rust-lld -Zpre-link-arg=-Ld:/msys64/mingw64/x86_64-w64-mingw32/lib -Zpre-link-arg=-Ld:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/10.2.0 -Zpre-link-arg=crt2.o" cargo b`

This is "harmless" part of the changes to make possible linking with bare LLD with windows-gnu target. More debatable changes should follow in next PRs soon.

3 years agoresolve comments
Prabakaran Kumaresshan [Sat, 15 Aug 2020 15:23:41 +0000 (20:53 +0530)]
resolve comments

3 years agoSwitch to intra-doc links in std/src/sys/vxworks/ext/{fs,process}.rs
Prabakaran Kumaresshan [Sat, 15 Aug 2020 13:19:52 +0000 (18:49 +0530)]
Switch to intra-doc links in std/src/sys/vxworks/ext/{fs,process}.rs

3 years agoAuto merge of #75537 - tmiasko:match-branch-simplify, r=oli-obk
bors [Sat, 15 Aug 2020 13:41:05 +0000 (13:41 +0000)]
Auto merge of #75537 - tmiasko:match-branch-simplify, r=oli-obk

MatchBranchSimplification: fix equal const bool assignments

The match branch simplification is applied when target blocks contain
statements that are either equal or perform a const bool assignment with
different values to the same place.

Previously, when constructing new statements, only statements from a
single block had been examined. This lead to a misoptimization when
statements are equal because the assign the *same* const bool value to
the same place.

Fix the issue by examining statements from both blocks when deciding on
replacement.

Additionally:

* Copy discriminant instead of moving it since it might be necessary to use its
  value more than once.
* Optimize when switching on copy operand

Based on #75508.

r? @oli-obk  / @JulianKnodt

3 years agoAuto merge of #74576 - myfreeweb:freebsd-sanitizers, r=oli-obk
bors [Sat, 15 Aug 2020 11:38:24 +0000 (11:38 +0000)]
Auto merge of #74576 - myfreeweb:freebsd-sanitizers, r=oli-obk

Add sanitizer support on FreeBSD

Restarting #47337. Everything is better now, no more weird llvm problems, well not everything:

Unfortunately, the sanitizers don't have proper support for versioned symbols (https://github.com/google/sanitizers/issues/628), so `libc`'s usage of `stat@FBSD_1.0` and so on explodes, e.g. in calling `std::fs::metadata`.

Building std (now easy thanks to cargo `-Zbuild-std`) and libc with `freebsd12/13` config via the `LIBC_CI=1` env variable is a good workaround…

```
LIBC_CI=1 RUSTFLAGS="-Z sanitizer=address" cargo +san-test -Zbuild-std run --target x86_64-unknown-freebsd --verbose
```

…*except* std won't build because there's no `st_lspare` in the ino64 version of the struct, so an std patch is required:

```diff
--- i/src/libstd/os/freebsd/fs.rs
+++ w/src/libstd/os/freebsd/fs.rs
@@ -66,8 +66,6 @@ pub trait MetadataExt {
     fn st_flags(&self) -> u32;
     #[stable(feature = "metadata_ext2", since = "1.8.0")]
     fn st_gen(&self) -> u32;
-    #[stable(feature = "metadata_ext2", since = "1.8.0")]
-    fn st_lspare(&self) -> u32;
 }

 #[stable(feature = "metadata_ext", since = "1.1.0")]
@@ -136,7 +134,4 @@ impl MetadataExt for Metadata {
     fn st_flags(&self) -> u32 {
         self.as_inner().as_inner().st_flags as u32
     }
-    fn st_lspare(&self) -> u32 {
-        self.as_inner().as_inner().st_lspare as u32
-    }
 }
```

I guess std could like.. detect that `libc` isn't built for the old ABI, and replace the implementation of `st_lspare` with a panic?

3 years agoAdd rustc-docs as a component
Mark Rousskov [Sat, 15 Aug 2020 11:06:18 +0000 (07:06 -0400)]
Add rustc-docs as a component

Previously it was listed as a package but wasn't available in the component
lists in rustup, so wasn't actually installable.

rustc-docs is also only present for x86_64-unknown-linux-gnu. Eventually it'll
also be shipped for aarch64-gnu with current CI configuration, but that builder
isn't quite up and running yet.

We probably want to ship compiler docs for other platforms as well, though, but
this commit doesn't enable that quite yet. A future PR may do so by adding
--enable-compiler-docs to the relevant builders (but it would also need to
decide the set of builders which we'd ship on).

3 years agoAuto merge of #75518 - davidtwco:issue-75326-polymorphization-symbol-mangling-v0...
bors [Sat, 15 Aug 2020 09:46:22 +0000 (09:46 +0000)]
Auto merge of #75518 - davidtwco:issue-75326-polymorphization-symbol-mangling-v0-predicates, r=lcnr

polymorphize: `I` used if `T` used in `I: Foo<T>`

Fixes #75326.

This PR adjusts polymorphization's handling of predicates so that after ensuring that `T` is used in `I: Foo<T>` if `I` is used, it now ensures that `I` is used if `T` is used in `I: Foo<T>`. This is necessary to mark generic parameters that only exist in impl parameters as used - thereby avoiding symbol clashes when using the new mangling scheme.

With this PR, rustc will now fully bootstrap with polymorphization and the new symbol mangling scheme enabled - not all tests pass, but I'm not sure how much of that is the interaction of the two features, I'll be looking into that soon. All tests pass with only polymorphization enabled.

r? @lcnr (this isn't sufficiently complex that I need to add to eddy's review queue)
cc @eddyb

3 years agoUse resolve.conf as example for Path ends_with
Ivan Tham [Sat, 15 Aug 2020 09:25:07 +0000 (17:25 +0800)]
Use resolve.conf as example for Path ends_with

3 years agoAuto merge of #75539 - ehuss:fix-crate-version-rustdoc-bootstrap, r=Mark-Simulacrum
bors [Sat, 15 Aug 2020 07:55:58 +0000 (07:55 +0000)]
Auto merge of #75539 - ehuss:fix-crate-version-rustdoc-bootstrap, r=Mark-Simulacrum

Fix crate-version with rustdoc in bootstrap.

Cargo will now automatically use the `--crate-version` flag (see https://github.com/rust-lang/cargo/pull/8509). Cargo has special handling to avoid passing the flag if it is passed in via RUSTDOCFLAGS, but the `rustdoc` wrapper circumvents that check. This causes a problem because rustdoc will fail if the flag is passed in twice. Fix this by using RUSTDOCFLAGS.

This will be necessary when 1.47 is promoted to beta, but should be safe to do now.

3 years agoAuto merge of #75488 - ssomers:btree_revert_75257, r=Mark-Simulacrum
bors [Sat, 15 Aug 2020 05:43:00 +0000 (05:43 +0000)]
Auto merge of #75488 - ssomers:btree_revert_75257, r=Mark-Simulacrum

Revert the fundamental changes in #74762 and #75257

Before possibly going over to #75487. Also contains some added and fixed comments.

r? @Mark-Simulacrum

3 years agoMove CloudABI to tier 3.
Eric Huss [Sat, 15 Aug 2020 03:43:27 +0000 (20:43 -0700)]
Move CloudABI to tier 3.

3 years agoMerge branch 'master' into feature/incorporate-tracing
pawanbisht62 [Sat, 15 Aug 2020 03:29:12 +0000 (08:59 +0530)]
Merge branch 'master' into feature/incorporate-tracing

3 years agoDeal with spaces in the rust version.
Eric Huss [Sat, 15 Aug 2020 00:52:09 +0000 (17:52 -0700)]
Deal with spaces in the rust version.

3 years agoAuto merge of #75549 - tmandry:rollup-sxjwa0w, r=tmandry
bors [Sat, 15 Aug 2020 03:08:03 +0000 (03:08 +0000)]
Auto merge of #75549 - tmandry:rollup-sxjwa0w, r=tmandry

Rollup of 4 pull requests

Successful merges:

 - #75376 (Set CMAKE_SYSTEM_NAME when cross-compiling)
 - #75448 (merge `as_local_hir_id` with `local_def_id_to_hir_id`)
 - #75513 (Recover gracefully from `struct` parse errors)
 - #75545 (std/sys/unix/time: make it easier for LLVM to optimize `Instant` subtraction.)

Failed merges:

 - #75514 (Replaced `log` with `tracing`)

r? @ghost

3 years agoRollup merge of #75545 - eddyb:instant-sub-branchless, r=sfackler
Tyler Mandry [Sat, 15 Aug 2020 03:07:16 +0000 (20:07 -0700)]
Rollup merge of #75545 - eddyb:instant-sub-branchless, r=sfackler

std/sys/unix/time: make it easier for LLVM to optimize `Instant` subtraction.

This PR is the minimal change necessary to get LLVM to optimize `if self.t.tv_nsec >= other.t.tv_nsec` to branchless instructions (at least on x86_64), inspired by @m-ou-se's own attempts at optimizing `Instant` subtraction.

I stumbled over this by looking at the total number of instructions executed by `rustc -Z self-profile`, and found that after disabling ASLR, the largest source of non-determinism remaining was from this `if` taking one branch or the other, depending on the values involved.

The reason this code is even called so many times to make a difference, is that `measureme` (the `-Z self-profile` implementation) currently uses `Instant::elapsed` for its event timestamps (of which there can be millions).

I doubt it's critical to land this, although perhaps it could slightly improve some forms of benchmarking.

3 years agoRollup merge of #75513 - estebank:confused-parser, r=davidtwco
Tyler Mandry [Sat, 15 Aug 2020 03:07:13 +0000 (20:07 -0700)]
Rollup merge of #75513 - estebank:confused-parser, r=davidtwco

Recover gracefully from `struct` parse errors

Currently the parser tries to recover from finding a keyword where a field name was expected, but this causes extra knock down parse errors that are completely irrelevant. Instead, bail out early in the parsing of the field and consume the remaining tokens in the block. This can reduce output significantly.

_Improvements based on the narrative in https://fasterthanli.me/articles/i-am-a-java-csharp-c-or-cplusplus-dev-time-to-do-some-rust_

3 years agoRollup merge of #75448 - lcnr:rn-as_local_hir_id, r=davidtwco
Tyler Mandry [Sat, 15 Aug 2020 03:07:11 +0000 (20:07 -0700)]
Rollup merge of #75448 - lcnr:rn-as_local_hir_id, r=davidtwco

merge `as_local_hir_id` with `local_def_id_to_hir_id`

`as_local_hir_id` was defined as just calling `local_def_id_to_hir_id` and I think that having two different ways to call the same method is somewhat confusing.

Don't really care about which of these 2 methods we want to keep.

Does this require an MCP, considering that these methods are fairly frequently used?

3 years agoRollup merge of #75376 - tmiasko:cmake-system-name, r=Mark-Simulacrum
Tyler Mandry [Sat, 15 Aug 2020 03:07:10 +0000 (20:07 -0700)]
Rollup merge of #75376 - tmiasko:cmake-system-name, r=Mark-Simulacrum

Set CMAKE_SYSTEM_NAME when cross-compiling

Configure CMAKE_SYSTEM_NAME when cross-compiling in `configure_cmake`,
to tell CMake about target system. Previously this was done only for
LLVM step and now applies more generally to steps using cmake.

Helps with #74576.

3 years agostd/sys/unix/time: make it easier for LLVM to optimize `Instant` subtraction.
Eduard-Mihai Burtescu [Fri, 14 Aug 2020 23:41:41 +0000 (02:41 +0300)]
std/sys/unix/time: make it easier for LLVM to optimize `Instant` subtraction.

3 years agoAuto merge of #73851 - matthewjasper:serialize-not-special, r=oli-obk
bors [Sat, 15 Aug 2020 00:45:13 +0000 (00:45 +0000)]
Auto merge of #73851 - matthewjasper:serialize-not-special, r=oli-obk

Remove most specialization use in serialization

Switching from specialization to min_specialization in the compiler made the unsoundness of how we used these traits pretty clear. This changes how the `Encodable` and `Decodable` traits work to be more friendly for types need a `TyCtxt` to deserialize.

The alternative design of having both `Encodable` and `TyEncodable` traits was considered, but doesn't really work because the following impls would conflict:

```
impl<E: Ecodable> TyEncodable for Encodable
impl<E: TyEcodable> TyEncodable for [E]
```

## How-to guide

- `Rustc(De|En)codable` is now spelled `Ty(De|En)coable` in `rustc_middle`, `Metadata(En|De)codable` in `rustc_metadata` where needed, and `(De|En)codable` everywhere else.
- Manual implementations of `(De|En)codable` shouldn't be much different.
- If you're adding a new interned type that needs to be en/decodable then the simplest thing way to handle this is:
    - Have the type be a wrapper around a reference to the interned data (i.e. do what `ty::Predicate` does, and not what all of the other interned types do)
    - Derive `Ty(En|De)codable` on the inner type
    - Implement `Encodable<impl TyEncoder>` by forwarding to the inner type.
    - Implement `Decodable<impl TyDecoder>` by decoding the inner type and then creating the wrapper around that (using the `tcx` from the decoder as needed).

cc @rust-lang/compiler for opinions on this change
r? @oli-obk

3 years agoMatchBranchSimplification: avoid intermediate vec allocation
Tomasz Miąsko [Sat, 15 Aug 2020 00:00:00 +0000 (00:00 +0000)]
MatchBranchSimplification: avoid intermediate vec allocation

3 years agoMatchBranchSimplification: fix equal const bool assignments
Tomasz Miąsko [Sat, 15 Aug 2020 00:00:00 +0000 (00:00 +0000)]
MatchBranchSimplification: fix equal const bool assignments

The match branch simplification is applied when target blocks contain
statements that are either equal or perform a const bool assignment with
different values to the same place.

Previously, when constructing new statements, only statements from a
single block had been examined. This lead to a misoptimization when
statements are equal because the assign the *same* const bool value to
the same place.

Fix the issue by examining statements from both blocks when deciding on
replacement.

3 years agoUse intra-doc links
Denis Vasilik [Fri, 14 Aug 2020 23:12:47 +0000 (01:12 +0200)]
Use intra-doc links

3 years agoSwitch to intra-doc links in `core::option`
Camelid [Fri, 14 Aug 2020 20:36:40 +0000 (13:36 -0700)]
Switch to intra-doc links in `core::option`

3 years agoAuto merge of #75538 - tmandry:rollup-i8miv8q, r=tmandry
bors [Fri, 14 Aug 2020 22:52:57 +0000 (22:52 +0000)]
Auto merge of #75538 - tmandry:rollup-i8miv8q, r=tmandry

Rollup of 17 pull requests

Successful merges:

 - #73943 (Document the unsafe keyword)
 - #74062 (deny(unsafe_op_in_unsafe_fn) in libstd/ffi/c_str.rs)
 - #74185 (Remove liballoc unneeded explicit link)
 - #74192 (Improve documentation on process::Child.std* fields)
 - #74409 (Change Debug impl of SocketAddr and IpAddr to match their Display output)
 - #75195 (BTreeMap: purge innocent use of into_kv_mut)
 - #75214 (Use intra-doc links in `mem::manually_drop` & `mem::maybe_uninit`)
 - #75432 (Switch to intra-doc links in `std::process`)
 - #75482 (Clean up E0752 explanation)
 - #75501 (Move to intra doc links in std::ffi)
 - #75509 (Tweak suggestion for `this` -> `self`)
 - #75511 (Do not emit E0228 when it is implied by E0106)
 - #75515 (Bump std's libc version to 0.2.74)
 - #75517 (Promotion and const interning comments)
 - #75519 (BTreeMap: refactor splitpoint and move testing over to unit test)
 - #75530 (Switch to intra-doc links in os/raw/*.md)
 - #75531 (Migrate unit tests of btree collections to their native breeding ground)

Failed merges:

r? @ghost

3 years agopolymorphize: `I` used if `T` used in `I: Foo<T>`
David Wood [Fri, 14 Aug 2020 11:33:20 +0000 (12:33 +0100)]
polymorphize: `I` used if `T` used in `I: Foo<T>`

This commit adjusts polymorphization's handling of predicates so that
after ensuring that `T` is used in `I: Foo<T>` if `I` is used, it now
ensures that `I` is used if `T` is used in `I: Foo<T>`. This is
necessary to mark generic parameters that only exist in impl parameters
as used - thereby avoiding symbol clashes when using the new mangling
scheme.

Signed-off-by: David Wood <david@davidtw.co>
3 years agoFix crate-version with rustdoc in bootstrap.
Eric Huss [Fri, 14 Aug 2020 21:50:18 +0000 (14:50 -0700)]
Fix crate-version with rustdoc in bootstrap.

3 years agoRollup merge of #75531 - ssomers:btree_tests_migration, r=Mark-Simulacrum
Tyler Mandry [Fri, 14 Aug 2020 21:47:04 +0000 (14:47 -0700)]
Rollup merge of #75531 - ssomers:btree_tests_migration, r=Mark-Simulacrum

Migrate unit tests of btree collections to their native breeding ground

There's one BTreeSet test case that I couldn't easily convince to come along, maybe because it truly is an integration test. But leaving it in place would mean git wouldn't see the move so I also moved it to a new file.

r? @Mark-Simulacrum

3 years agoRollup merge of #75530 - nixphix:docs/os-raw, r=jyn514
Tyler Mandry [Fri, 14 Aug 2020 21:47:03 +0000 (14:47 -0700)]
Rollup merge of #75530 - nixphix:docs/os-raw, r=jyn514

Switch to intra-doc links in os/raw/*.md

Partial fix for #75080

@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc

r? @jyn514

3 years agoRollup merge of #75519 - ssomers:btree_splitpoint_cleanup, r=Mark-Simulacrum
Tyler Mandry [Fri, 14 Aug 2020 21:47:01 +0000 (14:47 -0700)]
Rollup merge of #75519 - ssomers:btree_splitpoint_cleanup, r=Mark-Simulacrum

BTreeMap: refactor splitpoint and move testing over to unit test

r? @Mark-Simulacrum

3 years agoRollup merge of #75517 - RalfJung:promo-intern-comments, r=oli-obk
Tyler Mandry [Fri, 14 Aug 2020 21:46:59 +0000 (14:46 -0700)]
Rollup merge of #75517 - RalfJung:promo-intern-comments, r=oli-obk

Promotion and const interning comments

I understood some things today which I felt should be put into comments.

Cc @rust-lang/wg-const-eval

3 years agoRollup merge of #75515 - workingjubilee:patch-4, r=Mark-Simulacrum
Tyler Mandry [Fri, 14 Aug 2020 21:46:57 +0000 (14:46 -0700)]
Rollup merge of #75515 - workingjubilee:patch-4, r=Mark-Simulacrum

Bump std's libc version to 0.2.74

It's been a while and this should really be using a recent version, that's all. :sparkling_heart:

3 years agoRollup merge of #75511 - estebank:elide-trait-object-lt-error, r=lcnr
Tyler Mandry [Fri, 14 Aug 2020 21:46:56 +0000 (14:46 -0700)]
Rollup merge of #75511 - estebank:elide-trait-object-lt-error, r=lcnr

Do not emit E0228 when it is implied by E0106

Emit E0288 (lifetime bound for trait object cannot be deduced) only on bare trait objects. When the trait object is in the form of `&dyn Trait`, E0106 (missing lifetime specifier) will have been emitted, making the former redundant.

3 years agoRollup merge of #75509 - estebank:coming-merrily-from-java-land, r=lcnr
Tyler Mandry [Fri, 14 Aug 2020 21:46:54 +0000 (14:46 -0700)]
Rollup merge of #75509 - estebank:coming-merrily-from-java-land, r=lcnr

Tweak suggestion for `this` -> `self`

* When referring to `this` in associated `fn`s always suggest `self`.
* Point at ident for `fn` lacking `self`
* Suggest adding `self` to assoc `fn`s when appropriate

_Improvements based on the narrative in https://fasterthanli.me/articles/i-am-a-java-csharp-c-or-cplusplus-dev-time-to-do-some-rust_

3 years agoRollup merge of #75501 - poliorcetics:intra-links-std-ffi, r=jyn514
Tyler Mandry [Fri, 14 Aug 2020 21:46:52 +0000 (14:46 -0700)]
Rollup merge of #75501 - poliorcetics:intra-links-std-ffi, r=jyn514

Move to intra doc links in std::ffi

Helps with #75080.

@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc

3 years agoRollup merge of #75482 - GuillaumeGomez:cleanup-e0752, r=pickfire
Tyler Mandry [Fri, 14 Aug 2020 21:46:51 +0000 (14:46 -0700)]
Rollup merge of #75482 - GuillaumeGomez:cleanup-e0752, r=pickfire

Clean up E0752 explanation

r? @Dylan-DPC

cc @pickfire

3 years agoRollup merge of #75432 - camelid:intra-doc-links-for-std-process, r=jyn514
Tyler Mandry [Fri, 14 Aug 2020 21:46:49 +0000 (14:46 -0700)]
Rollup merge of #75432 - camelid:intra-doc-links-for-std-process, r=jyn514

Switch to intra-doc links in `std::process`

Part of #75080.

3 years agoRollup merge of #75214 - chansuke:fix-intra-doc-links, r=jyn514
Tyler Mandry [Fri, 14 Aug 2020 21:46:47 +0000 (14:46 -0700)]
Rollup merge of #75214 - chansuke:fix-intra-doc-links, r=jyn514

Use intra-doc links in `mem::manually_drop` & `mem::maybe_uninit`

This is partial fixes for https://github.com/rust-lang/rust/issues/75080.

3 years agoRollup merge of #75195 - ssomers:btree_split_up_into_kv_mut, r=Mark-Simulacrum
Tyler Mandry [Fri, 14 Aug 2020 21:46:45 +0000 (14:46 -0700)]
Rollup merge of #75195 - ssomers:btree_split_up_into_kv_mut, r=Mark-Simulacrum

BTreeMap: purge innocent use of into_kv_mut

Replace the use of `into_kv_mut` into more precise calls. This makes more sense if you know that the single remaining use of `into_kv_mut` is in fact evil and can be trialled in court (#75200) and sent to a correction facility (#73971).

No real performance difference reported (but functions that might benefit a tiny constant bit like `BTreeMap::get_mut` aren't benchmarked):
```
benchcmp old new --threshold 5
 name                       old ns/iter  new ns/iter  diff ns/iter  diff %  speedup
 btree::map::clone_fat_100  63,073       59,256             -3,817  -6.05%   x 1.06
 btree::map::iter_100       3,514        3,235                -279  -7.94%   x 1.09
```

3 years agoRollup merge of #74409 - LukasKalbertodt:improve-debug-impl-of-socketaddr-ipaddr...
Tyler Mandry [Fri, 14 Aug 2020 21:46:44 +0000 (14:46 -0700)]
Rollup merge of #74409 - LukasKalbertodt:improve-debug-impl-of-socketaddr-ipaddr, r=Amanieu

Change Debug impl of SocketAddr and IpAddr to match their Display output

This has already been done for `SocketAddrV4`, `SocketAddrV6`, `IpAddrV4` and `IpAddrV6`. I don't see a point to keep the rather bad to read derived impl, especially so when pretty printing:

    V4(
        127.0.0.1
    )

From the `Display`, one can easily and unambiguously see if it's V4 or V6. Two examples:

```
127.0.0.1:443
[2001:db8:85a3::8a2e:370:7334]:443
```

Luckily the docs explicitly state that `Debug` output is not stable and that it may be changed at any time.

Using `Display` as `Debug` is very convenient for configuration structs (e.g. for webservers) that often just have a `derive(Debug)` and are printed that way to the one starting the server.

3 years agoRollup merge of #74192 - xkr47:patch-1, r=Mark-Simulacrum
Tyler Mandry [Fri, 14 Aug 2020 21:46:41 +0000 (14:46 -0700)]
Rollup merge of #74192 - xkr47:patch-1, r=Mark-Simulacrum

Improve documentation on process::Child.std* fields

As a relative beginner, it took a while for me to figure out I could just steal the references to avoid partially moving the child and thus retain ability to call functions on it (and store it in structs etc).

3 years agoRollup merge of #74185 - pickfire:liballoc-iter-doc, r=jyn514
Tyler Mandry [Fri, 14 Aug 2020 21:46:40 +0000 (14:46 -0700)]
Rollup merge of #74185 - pickfire:liballoc-iter-doc, r=jyn514

Remove liballoc unneeded explicit link

3 years agoRollup merge of #74062 - poliorcetics:unsafe-in-unsafe-c_str, r=Mark-Simulacrum
Tyler Mandry [Fri, 14 Aug 2020 21:46:33 +0000 (14:46 -0700)]
Rollup merge of #74062 - poliorcetics:unsafe-in-unsafe-c_str, r=Mark-Simulacrum

deny(unsafe_op_in_unsafe_fn) in libstd/ffi/c_str.rs

Partial fix of #73904.

This encloses `unsafe` operations in `unsafe fn` in `libstd/ffi/c_str.rs`.

3 years agoRollup merge of #73943 - poliorcetics:unsafe-keyword, r=steveklabnik
Tyler Mandry [Fri, 14 Aug 2020 21:46:31 +0000 (14:46 -0700)]
Rollup merge of #73943 - poliorcetics:unsafe-keyword, r=steveklabnik

Document the unsafe keyword

Partial fix of #34601 (just one more and it will be done 😄).

I tried to be concise and redirect as much as possible on other, longer resources, exposing only the strict necessary.

I also used `SAFETY:` comments to promote good documentation.

I would like a thorough review to ensure I did not introduce mistakes that would confuse people or worse, lead them to write unsound code.

@rustbot modify labels: T-doc,C-enhancement

Edit: this is now the last PR for the original issue: fixes #34601.

3 years agoDocument the unsafe keyword
Alexis Bourget [Fri, 14 Aug 2020 20:52:23 +0000 (22:52 +0200)]
Document the unsafe keyword

3 years agoMatchBranchSimplification: copy discriminant instead of moving it
Tomasz Miąsko [Fri, 14 Aug 2020 00:00:00 +0000 (00:00 +0000)]
MatchBranchSimplification: copy discriminant instead of moving it

It might be necessary to use its value more than once.

3 years agoMatchBranchSimplification: optimize when switching on copy operand
Tomasz Miąsko [Fri, 14 Aug 2020 00:00:00 +0000 (00:00 +0000)]
MatchBranchSimplification: optimize when switching on copy operand

3 years agoTweak output of E0225
Esteban Küber [Fri, 14 Aug 2020 19:08:49 +0000 (12:08 -0700)]
Tweak output of E0225

When encountering multiple non-auto trait bounds suggest creating a new
trait and explain what auto-traits are.