]> git.lizzy.rs Git - rust.git/log
rust.git
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 #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 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 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 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 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

3 years agoRollup merge of #75479 - matthiaskrgr:package_docs, r=Mark-Simulacrum
Tyler Mandry [Fri, 14 Aug 2020 01:00:23 +0000 (18:00 -0700)]
Rollup merge of #75479 - matthiaskrgr:package_docs, r=Mark-Simulacrum

make rustc-docs component available to rustup

The `rustc-docs` component was generated but not selectable via rustup.

Zulip thread: https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/rustc.20nightly.20docs.20as.20component.3F

r? @Mark-Simulacrum

3 years agoRollup merge of #75477 - RalfJung:fn-ptrs, r=Mark-Simulacrum
Tyler Mandry [Fri, 14 Aug 2020 01:00:21 +0000 (18:00 -0700)]
Rollup merge of #75477 - RalfJung:fn-ptrs, r=Mark-Simulacrum

Expand function pointer docs

Be more explicit in the ABI section, and add a section on how to obtain a function pointer, which can be somewhat confusing.

Cc https://github.com/rust-lang/rust/issues/75239

3 years agoRollup merge of #75471 - richkadel:llvm-program-name, r=wesleywiser
Tyler Mandry [Fri, 14 Aug 2020 01:00:19 +0000 (18:00 -0700)]
Rollup merge of #75471 - richkadel:llvm-program-name, r=wesleywiser

Change registered "program name" for -Cllvm-args usage messages

While debugging a codegen issue, I tried adding LLVM options with
the rustc -Cllvm-args option, and was confused by the error and usage
messaging.

The LLVM "program name" argument is set to "rustc", and command line
error messages make it look like invalid arguments are "rustc"
arguments, not LLVM.

I changed this argument so error messages and the "-help" usage feedback
is easier to understand and react to. (Clang does something similar.)

r? @wesleywiser

3 years agoRollup merge of #75467 - rubenrua:rubenrua-patch-E0477, r=oli-obk
Tyler Mandry [Fri, 14 Aug 2020 01:00:17 +0000 (18:00 -0700)]
Rollup merge of #75467 - rubenrua:rubenrua-patch-E0477, r=oli-obk

Fix E0741 error code explanation

Using `ok !` into fixed SRC like in other explanations.

3 years agoRollup merge of #75462 - Mark-Simulacrum:clean-queries, r=petrochenkov
Tyler Mandry [Fri, 14 Aug 2020 01:00:15 +0000 (18:00 -0700)]
Rollup merge of #75462 - Mark-Simulacrum:clean-queries, r=petrochenkov

Remove unused tcx parameter

We shouldn't need access to a query context when storing already computed values.

3 years agoRollup merge of #75459 - RalfJung:local-info, r=oli-obk
Tyler Mandry [Fri, 14 Aug 2020 01:00:13 +0000 (18:00 -0700)]
Rollup merge of #75459 - RalfJung:local-info, r=oli-obk

fix LocalInfo doc comment

The doc comment makes it sound like this is diagnostics-only, but that is not true -- even [unsafety checking uses this information](https://github.com/rust-lang/rust/blob/ded20c98be8585b2a9fe4eeadd1be5524f6ffb17/src/librustc_mir/transform/check_unsafety.rs#L206), so it is crucial for soundness, not just "nice to have".

Cc @oli-obk

3 years agoRollup merge of #75452 - michaelwoerister:sp-cache-more-query-keys, r=lcnr
Tyler Mandry [Fri, 14 Aug 2020 01:00:11 +0000 (18:00 -0700)]
Rollup merge of #75452 - michaelwoerister:sp-cache-more-query-keys, r=lcnr

self-profile: Cache more query key strings when doing self-profiling.

This PR adds optimized `SpecIntoSelfProfilingString` implementations for two common query key types (`LocalDefId` and `WithOptConstParam`). This makes raw self-profiling data on disk 8-9% smaller for my two test cases (`regex` and `cargo`).

The on-disk format is not affected, so no tooling updates need to happen.

I also tried adding an impl for `Ty<'tcx>` (which should reduce size quite a bit) but the compiler did not allow me to add a specialized impl parameterized with `'tcx`. I don't know if there is an actual problem with that or if the implementation of specialization just doesn't support it yet.

cc @wesleywiser @Mark-Simulacrum

3 years agoRollup merge of #75417 - npmccallum:naked, r=matthewjasper
Tyler Mandry [Fri, 14 Aug 2020 01:00:10 +0000 (18:00 -0700)]
Rollup merge of #75417 - npmccallum:naked, r=matthewjasper

Don't spill operands onto the stack in naked functions

Currently, the code spills operands onto the stack for the purpose of
debuginfo. However, naked functions can only contain an asm block. Therefore,
attempting to spill the operands on the stack is undefined behavior.

Fixes https://github.com/rust-lang/rust/issues/42779
cc https://github.com/rust-lang/rust/issues/32408

Note that this PR reverts https://github.com/rust-lang/rust/pull/74105 which ultimately didn't fix the problem.

cc @haraldh @Amanieu @matthewjasper

3 years agoRollup merge of #75319 - estebank:format-ice, r=eddyb
Tyler Mandry [Fri, 14 Aug 2020 01:00:08 +0000 (18:00 -0700)]
Rollup merge of #75319 - estebank:format-ice, r=eddyb

Fix ICE #75307 in `format`

Remove usages of `unwrap` (even when some are safe today).

Fix #75307.

3 years agoRollup merge of #74650 - estebank:ambiguous-expr-binop, r=eddyb
Tyler Mandry [Fri, 14 Aug 2020 01:00:00 +0000 (18:00 -0700)]
Rollup merge of #74650 - estebank:ambiguous-expr-binop, r=eddyb

Correctly parse `{} && false` in tail expression

Fix #74233, fix #54186.

3 years agoTweak suggestion for `this` -> `self`
Esteban Küber [Fri, 14 Aug 2020 00:04:33 +0000 (17:04 -0700)]
Tweak suggestion for `this` -> `self`

3 years agoClean up some mir transform passes
kadmin [Thu, 13 Aug 2020 21:59:47 +0000 (21:59 +0000)]
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.

3 years agoAuto merge of #75105 - ssomers:btree_respect_min_len_hard, r=Mark-Simulacrum
bors [Thu, 13 Aug 2020 21:36:02 +0000 (21:36 +0000)]
Auto merge of #75105 - ssomers:btree_respect_min_len_hard, r=Mark-Simulacrum

Hard way to respect BTreeMap's minimum node length

Resolves #74834 the hard way (though not the hardest imaginable).

Benchmarks (which are all biased/realistic, inserting keys in ascending order) say:
```
benchcmp r0 r1 --threshold 10
 name                                        r0 ns/iter  r1 ns/iter  diff ns/iter   diff %  speedup
 btree::map::clone_slim_100_and_clear        2,183       2,723                540   24.74%   x 0.80
 btree::map::clone_slim_100_and_drain_all    3,652       4,173                521   14.27%   x 0.88
 btree::map::clone_slim_100_and_drain_half   3,320       3,940                620   18.67%   x 0.84
 btree::map::clone_slim_100_and_into_iter    2,154       2,717                563   26.14%   x 0.79
 btree::map::clone_slim_100_and_pop_all      3,372       3,870                498   14.77%   x 0.87
 btree::map::clone_slim_100_and_remove_all   5,111       5,647                536   10.49%   x 0.91
 btree::map::clone_slim_100_and_remove_half  3,259       3,821                562   17.24%   x 0.85
 btree::map::iter_0                          1,733       1,509               -224  -12.93%   x 1.15
 btree::map::iter_100                        2,714       3,739              1,025   37.77%   x 0.73
 btree::map::iter_10k                        3,728       4,269                541   14.51%   x 0.87
 btree::map::range_unbounded_unbounded       28,426      36,631             8,205   28.86%   x 0.78
 btree::map::range_unbounded_vs_iter         28,808      34,056             5,248   18.22%   x 0.85
```
This difference is not caused by the `debug_assert`-related code in the function `splitpoint`, it's the same without.

3 years agoMove to intra doc links in std::ffi
Alexis Bourget [Thu, 13 Aug 2020 21:19:45 +0000 (23:19 +0200)]
Move to intra doc links in std::ffi

3 years agoDisable zlib in LLVM on aarch64-apple-darwin
Mike Hommey [Thu, 13 Aug 2020 21:01:15 +0000 (06:01 +0900)]
Disable zlib in LLVM on aarch64-apple-darwin

3 years agoPrioritization WG: Open Zulip topics only for `I-prioritize` issues
Santiago Pastorino [Thu, 13 Aug 2020 20:04:28 +0000 (17:04 -0300)]
Prioritization WG: Open Zulip topics only for `I-prioritize` issues

3 years agoAuto merge of #75382 - JulianKnodt:match_branches, r=oli-obk
bors [Thu, 13 Aug 2020 19:26:35 +0000 (19:26 +0000)]
Auto merge of #75382 - JulianKnodt:match_branches, r=oli-obk

First iteration of simplify match branches

This is a simple MIR pass that attempts to convert
```
   bb0: {
        StorageLive(_2);
        _3 = discriminant(_1);
        switchInt(move _3) -> [0isize: bb2, otherwise: bb1];
    }

    bb1: {
        _2 = const false;
        goto -> bb3;
    }

    bb2: {
        _2 = const true;
        goto -> bb3;
    }
```
into
```
    bb0: {
        StorageLive(_2);
        _3 = discriminant(_1);
        _2 = _3 == 0;
        goto -> bb3;
    }
```
There are still missing components(like checking if the assignments are bools).
Was hoping that this could get some review though.

Handles #75141

r? @oli-obk

3 years agoAdd no-opt standard library builders
Dylan MacKenzie [Mon, 15 Jun 2020 19:24:39 +0000 (12:24 -0700)]
Add no-opt standard library builders

We already have builders which built standard library *test*s without
optimizations, but we previously did not have builders which built the standard
library itself without optimizations and then tested that.

This adds those builds for i686 and x86_64 linux.

3 years agoFixed transmute argument
rodrimati1992 [Thu, 13 Aug 2020 19:08:22 +0000 (16:08 -0300)]
Fixed transmute argument

3 years agoFix code examples
Guillaume Gomez [Thu, 13 Aug 2020 19:07:56 +0000 (21:07 +0200)]
Fix code examples

3 years agoReplaced union with transmute
rodrimati1992 [Thu, 13 Aug 2020 18:56:23 +0000 (15:56 -0300)]
Replaced union with transmute

3 years agofn type: structure, and talk a bit more about ABIs and how to create them
Ralf Jung [Thu, 13 Aug 2020 06:09:00 +0000 (08:09 +0200)]
fn type: structure, and talk a bit more about ABIs and how to create them

3 years agoImprove wording
Guillaume Gomez [Thu, 13 Aug 2020 18:13:44 +0000 (20:13 +0200)]
Improve wording

3 years agoAuto merge of #74793 - tmiasko:san-macos, r=Mark-Simulacrum
bors [Thu, 13 Aug 2020 17:22:36 +0000 (17:22 +0000)]
Auto merge of #74793 - tmiasko:san-macos, r=Mark-Simulacrum

Link sanitizers when creating dynamic libraries on macOS

Link sanitizer runtime when creating dynamic libraries on macOS
to resolve sanitizer runtime symbols and avoid failure at link time.

Closes #74571.

3 years agoAuto merge of #75443 - lcnr:opaque-normalize, r=nikomatsakis
bors [Thu, 13 Aug 2020 15:03:40 +0000 (15:03 +0000)]
Auto merge of #75443 - lcnr:opaque-normalize, r=nikomatsakis

allow escaping bound vars when normalizing `ty::Opaque`

implements https://github.com/rust-lang/rust/issues/75313#issuecomment-672216146 and fixes #75313

cc @eddyb @RalfJung

r? @nikomatsakis

3 years agomerge `as_local_hir_id` with `local_def_id_to_hir_id`
Bastian Kauschke [Wed, 12 Aug 2020 10:22:56 +0000 (12:22 +0200)]
merge `as_local_hir_id` with `local_def_id_to_hir_id`

3 years agoReverts the fundamental changes in #74762 and #75257
Stein Somers [Thu, 13 Aug 2020 13:22:43 +0000 (15:22 +0200)]
Reverts the fundamental changes in #74762 and #75257

3 years agoSet CMAKE_SYSTEM_NAME when cross-compiling
Tomasz Miąsko [Thu, 13 Aug 2020 00:00:00 +0000 (00:00 +0000)]
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.

3 years agoAuto merge of #75212 - JulianKnodt:array_map, r=LukasKalbertodt
bors [Thu, 13 Aug 2020 12:43:12 +0000 (12:43 +0000)]
Auto merge of #75212 - JulianKnodt:array_map, r=LukasKalbertodt

Add `array` lang item and `[T; N]::map(f: FnMut(T) -> S)`

This introduces an `array` lang item so functions can be defined on top of `[T; N]`. This was previously not done because const-generics was not complete enough to allow for this. Now it is in a state that is usable enough to start adding functions.

The function added is a monadic (I think?) map from `[T; N] -> [S; N]`. Until transmute can function on arrays, it also allocates an extra temporary array, but this can be removed at some point.

r? @lcnr

3 years agoself-profile: Cache more query key strings when doing self-profiling.
Michael Woerister [Tue, 11 Aug 2020 13:19:16 +0000 (15:19 +0200)]
self-profile: Cache more query key strings when doing self-profiling.