]> git.lizzy.rs Git - rust.git/log
rust.git
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 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 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 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 agoUse intra-doc links in `mem::manually_drop` & `mem::maybe_uninit`
chansuke [Thu, 6 Aug 2020 09:19:31 +0000 (18:19 +0900)]
Use intra-doc links in `mem::manually_drop` & `mem::maybe_uninit`

3 years agolibstd/ffi/c_str.rs: #![deny(unsafe_op_in_unsafe_fn)], enclose unsafe operations...
Alexis Bourget [Fri, 14 Aug 2020 17:33:04 +0000 (19:33 +0200)]
libstd/ffi/c_str.rs: #![deny(unsafe_op_in_unsafe_fn)], enclose unsafe operations in unsafe blocks

3 years agoreview comment: suggestion message wording
Esteban Küber [Fri, 14 Aug 2020 17:16:34 +0000 (10:16 -0700)]
review comment: suggestion message wording

3 years agoApply suggestions from code review
Poliorcetics [Fri, 14 Aug 2020 17:08:09 +0000 (19:08 +0200)]
Apply suggestions from code review

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
3 years agoFix rustc_serialize unit tests
Matthew Jasper [Sat, 18 Jul 2020 19:14:50 +0000 (20:14 +0100)]
Fix rustc_serialize unit tests

3 years agoFix rustc_ast unit test
Matthew Jasper [Sat, 18 Jul 2020 14:12:52 +0000 (15:12 +0100)]
Fix rustc_ast unit test

3 years agoFix run-make test
Matthew Jasper [Sat, 4 Jul 2020 15:59:14 +0000 (16:59 +0100)]
Fix run-make test

3 years agoFix ui fulldeps tests
Matthew Jasper [Sat, 4 Jul 2020 15:20:24 +0000 (16:20 +0100)]
Fix ui fulldeps tests

3 years agoFix tests and address review comments
Matthew Jasper [Mon, 29 Jun 2020 20:09:54 +0000 (21:09 +0100)]
Fix tests and address review comments

3 years agoAdd some documentation for (De|En)codable
Matthew Jasper [Mon, 22 Jun 2020 18:32:46 +0000 (19:32 +0100)]
Add some documentation for (De|En)codable

3 years agoSimplify arena_types macros
Matthew Jasper [Mon, 15 Jun 2020 16:29:14 +0000 (17:29 +0100)]
Simplify arena_types macros

3 years agoRework `rustc_serialize`
Matthew Jasper [Thu, 11 Jun 2020 14:49:57 +0000 (15:49 +0100)]
Rework `rustc_serialize`

- Move the type parameter from `encode` and `decode` methods to
  the trait.
- Remove `UseSpecialized(En|De)codable` traits.
- Remove blanket impls for references.
- Add `RefDecodable` trait to allow deserializing to arena-allocated
  references safely.
- Remove ability to (de)serialize HIR.
- Create proc-macros `(Ty)?(En|De)codable` to help implement these new
  traits.

3 years agoremove primitive type links
Prabakaran Kumaresshan [Fri, 14 Aug 2020 16:27:42 +0000 (21:57 +0530)]
remove primitive type links

3 years agoAuto merge of #75416 - richkadel:llvm-coverage-map-gen-5.3, r=richkadel
bors [Fri, 14 Aug 2020 16:27:00 +0000 (16:27 +0000)]
Auto merge of #75416 - richkadel:llvm-coverage-map-gen-5.3, r=richkadel

LLVM IR coverage encoding aligns closer to Clang's

I found some areas for improvement while attempting to debug the
SegFault issue when running rust programs compiled using MSVC, with
coverage instrumentation.

I discovered that LLVM's coverage writer was generating incomplete
function name variable names (that's not a typo: the name of the
variable that holds a function name).

The existing implementation used one-up numbers to distinguish
variables, and correcting the names did not fix the MSVC coverage bug,
but the fix in this PR makes the names and resulting LLVM IR easier to
follow and more consistent with Clang's implementation.

I also changed the way the `-Zinstrument-coverage` option is supported in
symbol_export.rs. The original implementation was incorrect, and the
corrected version matches the handling for `-Zprofile-generate`, as it
turns out.

(An argument could be made that maybe `-Zinstrument-coverage` should
automatically enable `-Cprofile-generate`. In fact, if
`-Cprofile-generate` is analagous to Clang's `-fprofile-generate`, as
some documentation implies, Clang always requires this flag for its
implementation of source-based code coverage. This would require a
little more validation, and if implemented, would probably require
updating some of the user-facing messages related to
`-Cprofile-generate` to not be so specific to the PGO use case.)

None of these changes fixed the MSVC coverage problems, but they should
still be welcome improvements.

Lastly, I added some additional FIXME comments in instrument_coverage.rs
describing issues I found with the generated LLVM IR that would be
resolved if the coverage instrumentation is injected with a `Statement`
instead of as a new `BasicBlock`. I describe seven advantages of this
change, but it requires some discussion before making a change like
this.

r? @tmandry

3 years agoMove btree unit test to their native, privileged location
Stein Somers [Fri, 14 Aug 2020 14:38:53 +0000 (16:38 +0200)]
Move btree unit test to their native, privileged location

3 years agoSwitch to intra-doc links in os/raw/*.md
Prabakaran Kumaresshan [Fri, 14 Aug 2020 15:39:35 +0000 (21:09 +0530)]
Switch to intra-doc links in os/raw/*.md

3 years agoBTreeMap: refactor splitpoint and move testing over to unit test
Stein Somers [Fri, 14 Aug 2020 12:50:30 +0000 (14:50 +0200)]
BTreeMap: refactor splitpoint and move testing over to unit test

3 years agoAuto merge of #75157 - rodrimati1992:patch-1, r=oli-obk
bors [Fri, 14 Aug 2020 14:08:05 +0000 (14:08 +0000)]
Auto merge of #75157 - rodrimati1992:patch-1, r=oli-obk

Constified str::from_utf8_unchecked

This would be useful for const code to use an array to construct a string using guaranteed utf8 inputs, and then create a `&str` from it.

3 years agoBTreeMap: refactor splitpoint and move testing over to unit test
Stein Somers [Fri, 14 Aug 2020 12:50:30 +0000 (14:50 +0200)]
BTreeMap: refactor splitpoint and move testing over to unit test

3 years agoImprove documentation on process::Child.std* fields
Jonas Berlin [Thu, 9 Jul 2020 18:18:06 +0000 (21:18 +0300)]
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 agoAuto merge of #74777 - ssomers:btree_cleanup_7, r=Mark-Simulacrum
bors [Fri, 14 Aug 2020 12:00:59 +0000 (12:00 +0000)]
Auto merge of #74777 - ssomers:btree_cleanup_7, r=Mark-Simulacrum

Stop BTreeMap casts from reborrowing

Down in btree/node.rs, the interface and use of `cast_unchecked` look a bit shady. It's really just there for inverting `forget_type` which does not borrow. By borrowing we can't write the same `cast_unchecked` in the same way at the Handle level.

No change in undefined behaviour or performance.

3 years agoadd a FIXME concerning interning of promoteds
Ralf Jung [Fri, 14 Aug 2020 11:23:26 +0000 (13:23 +0200)]
add a FIXME concerning interning of promoteds

3 years agoLLVM IR coverage encoding aligns closer to Clang's
Rich Kadel [Thu, 6 Aug 2020 05:53:11 +0000 (22:53 -0700)]
LLVM IR coverage encoding aligns closer to Clang's

I found some areas for improvement while attempting to debug the
SegFault issue when running rust programs compiled using MSVC, with
coverage instrumentation.

I discovered that LLVM's coverage writer was generating incomplete
function name variable names (that's not a typo: the name of the
variable that holds a function name).

The existing implementation used one-up numbers to distinguish
variables, and correcting the names did not fix the MSVC coverage bug,
but the fix in this PR makes the names and resulting LLVM IR easier to
follow and more consistent with Clang's implementation.

I also changed the way the `-Zinstrument-coverage` option is supported
in symbol_export.rs. The original implementation was incorrect, and the
corrected version matches the handling for `-Zprofile-generate`, as it
turns out.

(An argument could be made that maybe `-Zinstrument-coverage` should
automatically enable `-Cprofile-generate`. In fact, if
`-Cprofile-generate` is analagous to Clang's `-fprofile-generate`, as
some documentation implies, Clang always requires this flag for its
implementation of source-based code coverage. This would require a
little more validation, and if implemented, would probably require
updating some of the user-facing messages related to
`-Cprofile-generate` to not be so specific to the PGO use case.)

None of these changes fixed the MSVC coverage problems, but they should
still be welcome improvements.

Lastly, I added some additional FIXME comments in instrument_coverage.rs
describing issues I found with the generated LLVM IR that would be
resolved if the coverage instrumentation is injected with a `Statement`
instead of as a new `BasicBlock`. I describe seven advantages of this
change, but it requires some discussion before making a change like
this.

3 years agoAuto merge of #75503 - JulianKnodt:opt_opt, r=oli-obk
bors [Fri, 14 Aug 2020 09:23:22 +0000 (09:23 +0000)]
Auto merge of #75503 - JulianKnodt:opt_opt, r=oli-obk

Clean up some mir transform passes

I noticed a few places where there were intermediates being created
in MIR optimization passes, so I removed them.

I also changed some `Some(..)` into just `..` and wrap `Some(..)` at the function end, doing early returns for `None`.

I was generally looking for some easy optimizations in theses passes, and hopefully these should improve the runtime of these passes by a tinnnyyyyy bit.

r? @oli-obk

3 years agoanswer an old question re: intern kinds
Ralf Jung [Fri, 14 Aug 2020 09:18:55 +0000 (11:18 +0200)]
answer an old question re: intern kinds

3 years agomention 'lifetime extension' in promotion doc comments
Ralf Jung [Fri, 14 Aug 2020 09:17:03 +0000 (11:17 +0200)]
mention 'lifetime extension' in promotion doc comments

3 years agoRm allocation in uninhabited_enum_branching
kadmin [Thu, 13 Aug 2020 22:54:09 +0000 (22:54 +0000)]
Rm allocation in uninhabited_enum_branching

Also convert `uninhabited_enum_branching` `Cow<[u128]>::to_mut`

3 years agoBump std's libc version to 0.2.74
Jubilee [Fri, 14 Aug 2020 07:37:19 +0000 (00:37 -0700)]
Bump std's libc version to 0.2.74

3 years agoAuto merge of #73383 - ecstatic-morse:test-unoptimized-std, r=Mark-Simulacrum
bors [Fri, 14 Aug 2020 07:10:36 +0000 (07:10 +0000)]
Auto merge of #73383 - ecstatic-morse:test-unoptimized-std, r=Mark-Simulacrum

Run standard library unit tests without optimizations in `nopt` CI jobs

This was discussed in #73288 as a way to catch similar issues in the future. This builds an unoptimized standard library with the bootstrap compiler and runs the unit tests. This takes about 2 minutes on my laptop.

I confirmed that this method works locally, although there may be a better way of implementing it. It would be better to use the stage 2 compiler instead of the bootstrap one.

Notably, there are currently four `libstd` unit tests that fail in debug mode on `i686-unkown-linux-gnu` (a tier one target):

```
failures:
    f32::tests::test_float_bits_conv
    f32::tests::test_total_cmp
    f64::tests::test_float_bits_conv
    f64::tests::test_total_cmp
```

These are the tests that prompted #73288 as well as the ones added in #72568, which is currently broken due to #73328.

3 years agoRecover gracefully from `struct ` parse errors
Esteban Küber [Fri, 14 Aug 2020 04:15:36 +0000 (21:15 -0700)]
Recover gracefully from `struct ` parse errors

3 years agoAuto merge of #75510 - tmandry:rollup-tb9mllu, r=tmandry
bors [Fri, 14 Aug 2020 02:59:44 +0000 (02:59 +0000)]
Auto merge of #75510 - tmandry:rollup-tb9mllu, r=tmandry

Rollup of 12 pull requests

Successful merges:

 - #74650 (Correctly parse `{} && false` in tail expression)
 - #75319 (Fix ICE #75307 in `format`)
 - #75417 (Don't spill operands onto the stack in naked functions)
 - #75452 (self-profile: Cache more query key strings when doing self-profiling.)
 - #75459 (fix LocalInfo doc comment)
 - #75462 (Remove unused tcx parameter)
 - #75467 (Fix E0741 error code explanation)
 - #75471 (Change registered "program name" for -Cllvm-args usage messages)
 - #75477 (Expand function pointer docs)
 - #75479 (make rustc-docs component available to rustup)
 - #75496 (Prioritization WG: Open Zulip topics only for `I-prioritize` issues)
 - #75500 (Disable zlib in LLVM on aarch64-apple-darwin)

Failed merges:

r? @ghost

3 years agoUpdate liballoc vec doc link
Ivan Tham [Fri, 24 Jul 2020 09:28:37 +0000 (17:28 +0800)]
Update liballoc vec doc link

3 years agoUpdate src/liballoc/vec.rs
Ivan Tham [Thu, 23 Jul 2020 16:23:24 +0000 (00:23 +0800)]
Update src/liballoc/vec.rs

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
3 years agoRemove liballoc unneeded explicit link
Ivan Tham [Thu, 9 Jul 2020 15:41:56 +0000 (23:41 +0800)]
Remove liballoc unneeded explicit link

3 years agoDo not emit E0228 when it is implied by E0106
Esteban Küber [Fri, 14 Aug 2020 01:30:00 +0000 (18:30 -0700)]
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 agoAdd fix
kadmin [Fri, 14 Aug 2020 00:11:36 +0000 (00:11 +0000)]
Add fix

This also explicitly checks that the types are `bool`. `try_eval_bool` also appears to just
succeed for `u8`, so this ensures that it actually is a bool before casting.

3 years agoSuggest adding `&self` when accessing `self` in static assoc `fn`
Esteban Küber [Fri, 14 Aug 2020 00:52:33 +0000 (17:52 -0700)]
Suggest adding `&self` when accessing `self` in static assoc `fn`

3 years agoRollup merge of #75500 - glandium:arm64-mac-zlib, r=Mark-Simulacrum
Tyler Mandry [Fri, 14 Aug 2020 01:00:26 +0000 (18:00 -0700)]
Rollup merge of #75500 - glandium:arm64-mac-zlib, r=Mark-Simulacrum

Disable zlib in LLVM on aarch64-apple-darwin

For some reason, building rustc on the Apple Silicon DTK fails with some undefined symbols from zlib, which I guess is similar to some issues that appeared on *-apple-ios and *-apple-tvos.

3 years agoRollup merge of #75496 - spastorino:prioritization-zulip-topics, r=Mark-Simulacrum
Tyler Mandry [Fri, 14 Aug 2020 01:00:25 +0000 (18:00 -0700)]
Rollup merge of #75496 - spastorino:prioritization-zulip-topics, r=Mark-Simulacrum

Prioritization WG: Open Zulip topics only for `I-prioritize` issues

This was discussed in https://rust-lang.zulipchat.com/#narrow/stream/227806-t-compiler.2Fwg-prioritization/topic/nominations.20and.20other.20automatically.20opened.20topics
Is not being helpful to open topics on any of these events and it's even causing more work for the group.

@LeSeulArtichaut ... I think this is all that's needed to get rid of this, right?.

r? @Mark-Simulacrum

cc @rust-lang/wg-prioritization

@bors rollup=always