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

3 years agoAuto merge of #75322 - JulianKnodt:revisions, r=lcnr
bors [Thu, 13 Aug 2020 10:31:57 +0000 (10:31 +0000)]
Auto merge of #75322 - JulianKnodt:revisions, r=lcnr

Add a bunch of const-generic revisions for `min_const_generics`

This adds a bunch of revisions to `const-generic` tests which is part of #75279, but doesn't cover everything.

r? @lcnr

3 years agomake rustc-docs component available to rustup
Matthias Krüger [Thu, 13 Aug 2020 09:29:20 +0000 (11:29 +0200)]
make rustc-docs component available to rustup

3 years agoAuto merge of #75478 - RalfJung:miri, r=RalfJung
bors [Thu, 13 Aug 2020 08:24:00 +0000 (08:24 +0000)]
Auto merge of #75478 - RalfJung:miri, r=RalfJung

update miri

Fixes https://github.com/rust-lang/rust/issues/75441

3 years agoAdd 64bit / 32bit files
kadmin [Thu, 13 Aug 2020 07:55:58 +0000 (07:55 +0000)]
Add 64bit / 32bit files

3 years agoLink sanitizers when creating dynamic libraries on macOS
Tomasz MiÄ…sko [Sat, 25 Jul 2020 00:00:00 +0000 (00:00 +0000)]
Link sanitizers when creating dynamic libraries on macOS

3 years agoStop BTreeMap casts from reborrowing
Stein Somers [Sat, 1 Aug 2020 12:01:43 +0000 (14:01 +0200)]
Stop BTreeMap casts from reborrowing

3 years agoupdate miri
Ralf Jung [Thu, 13 Aug 2020 07:18:46 +0000 (09:18 +0200)]
update miri

3 years agobless diff
kadmin [Wed, 12 Aug 2020 21:35:32 +0000 (21:35 +0000)]
bless diff

Just output the current bless'd MIR diff
The tests are still fairly broken rn

3 years agoUpdate to pick Eq or Ne
kadmin [Wed, 12 Aug 2020 08:28:14 +0000 (08:28 +0000)]
Update to pick Eq or Ne

3 years agoUpdate w/ comments from oli
kadmin [Tue, 11 Aug 2020 22:04:49 +0000 (22:04 +0000)]
Update w/ comments from oli

This also updates a check to ensure that this is only applied to bools

3 years agoUpdate to actually use transform
kadmin [Tue, 11 Aug 2020 02:36:32 +0000 (02:36 +0000)]
Update to actually use transform

3 years agoFirst iteration of simplify match branches
kadmin [Mon, 10 Aug 2020 23:11:05 +0000 (23:11 +0000)]
First iteration of simplify match branches

3 years agoAuto merge of #75431 - ehuss:platform-support, r=Mark-Simulacrum
bors [Thu, 13 Aug 2020 06:17:25 +0000 (06:17 +0000)]
Auto merge of #75431 - ehuss:platform-support, r=Mark-Simulacrum

Move platform support to the rustc book.

This moves the [Platform Support](https://forge.rust-lang.org/release/platform-support.html) page from the forge to the rustc book. There are several reasons for doing this:

* The forge is not really oriented towards end-users (it mostly contains infrastructure, governance and policy, internal team pages, etc.). This platform support page is useful to user to know which targets are supported.
* This page can now be updated in-sync with any PRs that add or remove a target, or change its status.
* This is now automatically checked on CI to verify the list does not get out of sync. Currently it only checks the presence/absence of an entry, but more sophisticated checks could be added in the future.

I'm not 100% certain this is the best location, but I think it fits. I'd like to see the rustc guide continue to grow, including things like linking information and more platform-specific details.

3 years agoAuto merge of #75426 - ehuss:update-cargo, r=ehuss
bors [Thu, 13 Aug 2020 04:20:51 +0000 (04:20 +0000)]
Auto merge of #75426 - ehuss:update-cargo, r=ehuss

Update cargo

7 commits in 1653f354644834073d6d2541e27fae94588e685e..ab32ee88dade1b50c77347599e82ca2de3fb8a51
2020-08-04 23:14:37 +0000 to 2020-08-10 17:44:43 +0000
- Build manpage archive deterministically (rust-lang/cargo#8600)
- doc: Qualify GNU licenses in example license field (rust-lang/cargo#8604)
- Fix jobserver_exists test on single-cpu systems (rust-lang/cargo#8598)
- Fix small typo in reference/profiles.md (rust-lang/cargo#8605)
- Default cargo publish to the alt registry if it's the only allowed one (rust-lang/cargo#8571)
- cargo install with specific yanked version gives confusing "not found" error (rust-lang/cargo#8565)
- Fix typo (rust-lang/cargo#8589)

3 years agoAdd drop check test & MaybeUninit::first_ptr_mut
kadmin [Tue, 11 Aug 2020 18:39:12 +0000 (18:39 +0000)]
Add drop check test & MaybeUninit::first_ptr_mut

Also in drop check test add hacky workaround for platforms that don't support
panic=unwind

3 years agoRm hiding feature gate & add 1 more example
kadmin [Sat, 8 Aug 2020 23:20:28 +0000 (23:20 +0000)]
Rm hiding feature gate & add 1 more example

Update order docs for `map`

3 years agoAdd tracking issue #75243
kadmin [Fri, 7 Aug 2020 06:00:52 +0000 (06:00 +0000)]
Add tracking issue #75243

Add note & example about iter order

Add doc changes

Update doc comments

3 years agoAdd recommend changes to array
kadmin [Thu, 6 Aug 2020 23:36:50 +0000 (23:36 +0000)]
Add recommend changes to array

Switch from indexing to zip, and also use `write` on `MaybeUninit`.

Add array_map feature to core/src/lib

Attempt to fix issue of no such feature

Update w/ pickfire's review

This changes a couple of names around, adds another small test of variable size,
and hides the rustdoc #![feature(..)].

Fmt doctest

Add suggestions from lcnr

3 years agoAdd Array Impl Lang Item in various places
kadmin [Thu, 6 Aug 2020 22:08:56 +0000 (22:08 +0000)]
Add Array Impl Lang Item in various places

Add basic test

And also run fmt which is where the other changes are from

Fix mut issues

These only appear when running tests, so resolved by adding mut

Swap order of forget

Add pub and rm guard impl

Add explicit type to guard

Add safety note

Change guard type from T to S

It should never have been T, as it guards over [MaybeUninit<S>; N]
Also add feature to test

3 years agoCreate lang item array and add map fn
kadmin [Thu, 6 Aug 2020 07:40:06 +0000 (07:40 +0000)]
Create lang item array and add map fn

This creates the language item for arrays, and adds the map fn which is like map in options or
iterators. It currently allocates an extra array, unfortunately.

Added fixme for transmuting

Fix typo

Add drop guard

3 years agoAuto merge of #75476 - JohnTitor:rollup-ap1rqf1, r=JohnTitor
bors [Thu, 13 Aug 2020 02:26:20 +0000 (02:26 +0000)]
Auto merge of #75476 - JohnTitor:rollup-ap1rqf1, r=JohnTitor

Rollup of 11 pull requests

Successful merges:

 - #75189 (Fix wasi::fs::OpenOptions to imply write when append is on)
 - #75201 (Fix some Clippy warnings in librustc_serialize)
 - #75372 (Fix suggestion to use lifetime in type and in assoc const)
 - #75400 (Fix minor things in the `f32` primitive docs)
 - #75449 (add regression test for #74739 (mir const-prop bug))
 - #75451 (Clean up E0751 explanation)
 - #75455 (Use explicit path link in place for doc in time)
 - #75457 (Remove some dead variants in LLVM FFI)
 - #75466 (Move to intra doc links whenever possible within std/src/lib.rs)
 - #75469 (Switch to intra-doc links in `std/io/mod.rs`)
 - #75473 (Flip order of const & type)

Failed merges:

r? @ghost

3 years agoRollup merge of #75473 - JulianKnodt:swap_order_oops, r=varkor
Yuki Okushi [Thu, 13 Aug 2020 02:05:48 +0000 (11:05 +0900)]
Rollup merge of #75473 - JulianKnodt:swap_order_oops, r=varkor

Flip order of const & type

Fix swapped order of consts & types in error message introduced in #74953

r? @varkor cc @lcnr

3 years agoRollup merge of #75469 - camelid:intra-doc-links-std-io-mod, r=KodrAus
Yuki Okushi [Thu, 13 Aug 2020 02:05:47 +0000 (11:05 +0900)]
Rollup merge of #75469 - camelid:intra-doc-links-std-io-mod, r=KodrAus

Switch to intra-doc links in `std/io/mod.rs`

Part of #75080.

3 years agoRollup merge of #75466 - poliorcetics:intra-links-std-lib, r=KodrAus
Yuki Okushi [Thu, 13 Aug 2020 02:05:45 +0000 (11:05 +0900)]
Rollup merge of #75466 - poliorcetics:intra-links-std-lib, r=KodrAus

Move to intra doc links whenever possible within std/src/lib.rs

Helps with #75080.

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

There are some things like

```rust
`//! [`Option<T>`]: option::Option`
```

that will either be fixed in the future or have open issues about them.

3 years agoRollup merge of #75457 - Mark-Simulacrum:llvm-clean, r=cuviper
Yuki Okushi [Thu, 13 Aug 2020 02:05:44 +0000 (11:05 +0900)]
Rollup merge of #75457 - Mark-Simulacrum:llvm-clean, r=cuviper

Remove some dead variants in LLVM FFI

r? @nikic or @cuviper

3 years agoRollup merge of #75455 - pickfire:patch-3, r=jyn514
Yuki Okushi [Thu, 13 Aug 2020 02:05:42 +0000 (11:05 +0900)]
Rollup merge of #75455 - pickfire:patch-3, r=jyn514

Use explicit path link in place for doc in time

r? @jyn514

More worth for your time. :P

3 years agoRollup merge of #75451 - GuillaumeGomez:cleanup-e0751, r=pickfire
Yuki Okushi [Thu, 13 Aug 2020 02:05:40 +0000 (11:05 +0900)]
Rollup merge of #75451 - GuillaumeGomez:cleanup-e0751, r=pickfire

Clean up E0751 explanation

r? @Dylan-DPC

cc @pickfire

3 years agoRollup merge of #75449 - RalfJung:const-prop-test, r=wesleywiser
Yuki Okushi [Thu, 13 Aug 2020 02:05:38 +0000 (11:05 +0900)]
Rollup merge of #75449 - RalfJung:const-prop-test, r=wesleywiser

add regression test for #74739 (mir const-prop bug)

Fixes https://github.com/rust-lang/rust/issues/74739

3 years agoRollup merge of #75400 - LukasKalbertodt:fix-f32-docs, r=KodrAus
Yuki Okushi [Thu, 13 Aug 2020 02:05:37 +0000 (11:05 +0900)]
Rollup merge of #75400 - LukasKalbertodt:fix-f32-docs, r=KodrAus

Fix minor things in the `f32` primitive docs

All of these were review comments in #74621 that I first fixed in that PR, but later accidentally overwrote by a force push.

Thanks @the8472 for noticing.

r? @KodrAus

3 years agoRollup merge of #75372 - estebank:lt-sugg-in-type, r=lcnr
Yuki Okushi [Thu, 13 Aug 2020 02:05:35 +0000 (11:05 +0900)]
Rollup merge of #75372 - estebank:lt-sugg-in-type, r=lcnr

Fix suggestion to use lifetime in type and in assoc const

_Do not merge until #75363 has landed, as it has the test case for this._

* Account for associated types
* Associated `const`s can't have generics (fix #74264)
* Do not suggest duplicate lifetimes and suggest `for<'a>` more (fix #72404)

3 years agoRollup merge of #75201 - Hirrolot:hirrolot/fix-clippy-warnings, r=varkor
Yuki Okushi [Thu, 13 Aug 2020 02:05:33 +0000 (11:05 +0900)]
Rollup merge of #75201 - Hirrolot:hirrolot/fix-clippy-warnings, r=varkor

Fix some Clippy warnings in librustc_serialize

3 years agoRollup merge of #75189 - kawamuray:bugfix-wasi-append, r=KodrAus
Yuki Okushi [Thu, 13 Aug 2020 02:05:31 +0000 (11:05 +0900)]
Rollup merge of #75189 - kawamuray:bugfix-wasi-append, r=KodrAus

Fix wasi::fs::OpenOptions to imply write when append is on

This PR fixes a bug in `OpenOptions` of `wasi` platform that it currently doesn't imply write mode when only `append` is enabled.
As explained in the [doc of OpenOptions#append](https://doc.rust-lang.org/std/fs/struct.OpenOptions.html#method.append), calling `.append(true)` should imply `.write(true)` as well.

## Reproduce

Given below simple Rust program:

```rust
use std::fs::OpenOptions;
use std::io::Write;

fn main() {
    let mut file = OpenOptions::new()
        .write(true)
        .create(true)
        .open("foo.txt")
        .unwrap();
    writeln!(file, "abc").unwrap();
}
```

it can successfully compiled into wasm and execute by `wasmtime` runtime:

```sh
$ rustc --target wasm32-wasi write.rs
$ ~/wasmtime/target/debug/wasmtime run --dir=. write.wasm
$ cat foo.txt
abc
```

However when I change `.write(true)` to `.append(true)`, it fails to execute by the error "Capabilities insufficient":

```sh
$ ~/wasmtime/target/debug/wasmtime run --dir=. append.wasm
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 76, kind: Other, message: "Capabilities insufficient" }', append.rs:10:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Error: failed to run main module `append.wasm`
...
```

This is because of lacking "rights" on the opened file:

```sh
$ RUST_LOG=trace ~/wasmtime/target/debug/wasmtime run --dir=. append.wasm 2>&1 | grep validate_rights
 TRACE wasi_common::entry                                  >      | validate_rights failed: required rights = HandleRights { base: fd_write (0x40), inheriting: empty (0x0) }; actual rights = HandleRights { base: fd_seek|fd_fdstat_set_flags|fd_sync|fd_tell|fd_advise|fd_filestat_set_times|poll_fd_readwrite (0x88000bc), inheriting: empty (0x0) }
```

3 years agoFlip order of const & type
kadmin [Wed, 12 Aug 2020 23:19:07 +0000 (23:19 +0000)]
Flip order of const & type

3 years agoChange registered "program name" for -Cllvm-args usage messages
Rich Kadel [Wed, 12 Aug 2020 22:30:41 +0000 (15:30 -0700)]
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.)

3 years agoAuto merge of #74512 - LukasKalbertodt:debloat-copy-from-slice, r=KodrAus
bors [Wed, 12 Aug 2020 23:03:28 +0000 (23:03 +0000)]
Auto merge of #74512 - LukasKalbertodt:debloat-copy-from-slice, r=KodrAus

Put panic code path from `copy_from_slice` into cold function

The previous `assert_eq` generated quite some code, which is especially problematic when this call is inlined. This commit also slightly improves the panic message from:

    assertion failed: `(left == right)`
      left: `3`,
     right: `2`: destination and source slices have different lengths

...to:

    source slice length (2) does not match destination slice length (3)

You can see the code bloat in assembly [here](https://rust.godbolt.org/z/74a3qo).

3 years agoFix intra-doc link
Camelid [Wed, 12 Aug 2020 22:30:15 +0000 (15:30 -0700)]
Fix intra-doc link

3 years agoSwitch to intra-doc links in `std/io/mod.rs`
Camelid [Wed, 12 Aug 2020 22:09:55 +0000 (15:09 -0700)]
Switch to intra-doc links in `std/io/mod.rs`

3 years agoFix E0741 error code explanation
Ruben Gonzalez [Wed, 12 Aug 2020 21:42:10 +0000 (23:42 +0200)]
Fix E0741 error code explanation

Use OK ! like other explanations

3 years agoMove to intra doc links whenever possible within std/src/lib.rs
Alexis Bourget [Wed, 12 Aug 2020 21:23:07 +0000 (23:23 +0200)]
Move to intra doc links whenever possible within std/src/lib.rs

3 years agoAuto merge of #75396 - RalfJung:miri-spans, r=oli-obk
bors [Wed, 12 Aug 2020 20:44:19 +0000 (20:44 +0000)]
Auto merge of #75396 - RalfJung:miri-spans, r=oli-obk

Miri: improve spans of required_const failures

In https://github.com/rust-lang/rust/pull/75339 I added a loop evaluating all consts required by a function body. Unfortunately, if one of their evaluations fails, then the span used for that was that of the first statement in the function body, which happened to work form some existing test but is not sensible in general.

This PR changes it to point to the whole function instead, which is at least not wrong.

r? @oli-obk

3 years agoUpdate stderr files
kadmin [Mon, 10 Aug 2020 18:50:58 +0000 (18:50 +0000)]
Update stderr files

And also fix some comments as suggested by lcnr

3 years agoRemove unused tcx parameter
Mark Rousskov [Wed, 12 Aug 2020 20:00:44 +0000 (16:00 -0400)]
Remove unused tcx parameter

3 years agoPut panic code path from `copy_from_slice` into cold function
Lukas Kalbertodt [Sun, 19 Jul 2020 12:04:30 +0000 (14:04 +0200)]
Put panic code path from `copy_from_slice` into cold function

The previous `assert_eq` generated quite some code, which is especially
problematic when this call is inlined. This commit also slightly
improves the panic message from:

  assertion failed: `(left == right)`
    left: `3`,
   right: `2`: destination and source slices have different lengths

...to:

  source slice length (2) does not match destination slice length (3)

3 years agoAuto merge of #75354 - estebank:tuple-struct-as-struct-pat, r=petrochenkov
bors [Wed, 12 Aug 2020 18:50:20 +0000 (18:50 +0000)]
Auto merge of #75354 - estebank:tuple-struct-as-struct-pat, r=petrochenkov

Detect tuple variants used as struct pattern and suggest correct pattern

Fix #61326

r? @petrochenkov

3 years agofix LocalInfo doc comment
Ralf Jung [Wed, 12 Aug 2020 17:37:08 +0000 (19:37 +0200)]
fix LocalInfo doc comment

3 years agoAuto merge of #75019 - nanpuyue:to_ipv4_mapped, r=LukasKalbertodt
bors [Wed, 12 Aug 2020 16:30:46 +0000 (16:30 +0000)]
Auto merge of #75019 - nanpuyue:to_ipv4_mapped, r=LukasKalbertodt

Add Ipv6Addr::to_ipv4_mapped

* add Ipv6Addr::to_ipv4_mapped
* ~~deprecate Ipv4Addr::to_ipv6_compatible & Ipv6Addr::to_ipv4~~ reference: #75150

According to [IETF RFC 4291](https://tools.ietf.org/html/rfc4291#page-10), the "IPv4-Compatible IPv6 address" is deprecated.

> 2.5.5.1.  IPv4-Compatible IPv6 Address
>
>    The "IPv4-Compatible IPv6 address" was defined to assist in the IPv6
>    transition.  The format of the "IPv4-Compatible IPv6 address" is as
>    follows:
>
>    |                80 bits               | 16 |      32 bits        |
>    +--------------------------------------+--------------------------+
>    |0000..............................0000|0000|    IPv4 address     |
>    +--------------------------------------+----+---------------------+
>
>    Note: The IPv4 address used in the "IPv4-Compatible IPv6 address"
>    must be a globally-unique IPv4 unicast address.
>
>    The "IPv4-Compatible IPv6 address" is now deprecated because the
>    current IPv6 transition mechanisms no longer use these addresses.
>    New or updated implementations are not required to support this
>    address type.

And the current implementation of `Ipv4Addr::to_ipv6_compatible`is incorrect: it does not check whether the IPv4 address is a globally-unique IPv4 unicast address.

Please let me know if there are any issues with this pull request.

3 years agoRemove ArchiveKind::Other
Mark Rousskov [Wed, 12 Aug 2020 16:03:44 +0000 (12:03 -0400)]
Remove ArchiveKind::Other

Also unused since introduction in #35174

3 years agoRemove CodeGenOptLevel::Other
Mark Rousskov [Wed, 12 Aug 2020 16:01:20 +0000 (12:01 -0400)]
Remove CodeGenOptLevel::Other

Also introduced in #35174, and immediately unused.

3 years agoRemove AsmDialect::Other
Mark Rousskov [Wed, 12 Aug 2020 15:58:58 +0000 (11:58 -0400)]
Remove AsmDialect::Other

Added in #35174, this was already unused (and new uses have not been introduced
since then).

3 years agoRemove FileType::Other
Mark Rousskov [Wed, 12 Aug 2020 15:53:05 +0000 (11:53 -0400)]
Remove FileType::Other

Added in #35174, this was already unused (and new uses have not been introduced
since then).

3 years agoAdd a script to verify the Platform Support page is up-to-date.
Eric Huss [Tue, 11 Aug 2020 23:49:39 +0000 (16:49 -0700)]
Add a script to verify the Platform Support page is up-to-date.

3 years agoImprove wording
Guillaume Gomez [Wed, 12 Aug 2020 14:46:40 +0000 (16:46 +0200)]
Improve wording

3 years agoAuto merge of #75066 - poliorcetics:document-unsafety-in-core-slice, r=LukasKalbertodt
bors [Wed, 12 Aug 2020 14:18:15 +0000 (14:18 +0000)]
Auto merge of #75066 - poliorcetics:document-unsafety-in-core-slice, r=LukasKalbertodt

Document unsafety in library/core/src/slice/mod.rs

Restart where #73555 left off, helping with #66219.

3 years agoUse explicit path link in place for doc in time
Ivan Tham [Wed, 12 Aug 2020 14:17:12 +0000 (22:17 +0800)]
Use explicit path link in place for doc in time

3 years agoAuto merge of #75450 - pietroalbini:fix-toolstate, r=pietroalbini
bors [Wed, 12 Aug 2020 12:21:09 +0000 (12:21 +0000)]
Auto merge of #75450 - pietroalbini:fix-toolstate, r=pietroalbini

Remove embedded-resources alumni from toolstate

Some people left the embedded-resources working group (https://github.com/rust-lang/team/pull/401), making them unassignable in toolstate issues. This PR removes them from the toolstate assignees list, fixing CI.

3 years agoClean up E0751 explanation
Guillaume Gomez [Wed, 12 Aug 2020 12:15:44 +0000 (14:15 +0200)]
Clean up E0751 explanation

3 years agotoolstate: remove embedded-resources alumni from toolstate
Pietro Albini [Wed, 12 Aug 2020 11:53:50 +0000 (13:53 +0200)]
toolstate: remove embedded-resources alumni from toolstate

3 years agoadd regression test for #74739 (mir const-prop bug)
Ralf Jung [Wed, 12 Aug 2020 10:50:24 +0000 (12:50 +0200)]
add regression test for #74739 (mir const-prop bug)

3 years agofix span of stack size error
Ralf Jung [Wed, 12 Aug 2020 08:18:21 +0000 (10:18 +0200)]
fix span of stack size error

3 years agofix typos
Ralf Jung [Wed, 12 Aug 2020 06:50:17 +0000 (08:50 +0200)]
fix typos

Co-authored-by: Oliver Scherer <github35764891676564198441@oli-obk.de>
3 years agomore precise span for erroneous consts during CTFE/Miri
Ralf Jung [Tue, 11 Aug 2020 12:54:02 +0000 (14:54 +0200)]
more precise span for erroneous consts during CTFE/Miri

3 years agobless tests
Ralf Jung [Tue, 11 Aug 2020 10:42:05 +0000 (12:42 +0200)]
bless tests

3 years agomiri: fall back to whole-function span when loc==None
Ralf Jung [Tue, 11 Aug 2020 10:38:40 +0000 (12:38 +0200)]
miri: fall back to whole-function span when loc==None

3 years agoAuto merge of #75321 - estebank:js-goes-gaga, r=davidtwco
bors [Wed, 12 Aug 2020 08:40:36 +0000 (08:40 +0000)]
Auto merge of #75321 - estebank:js-goes-gaga, r=davidtwco

Detect JS-style `===` and `!==` and recover

Fix #75312.

3 years agoAdd missing tests in root const-gen dir
kadmin [Sun, 9 Aug 2020 06:19:57 +0000 (06:19 +0000)]
Add missing tests in root const-gen dir