Commit Graph

125288 Commits

Author SHA1 Message Date
bors
55b9adfafa 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.
2020-08-14 14:08:05 +00:00
bors
7996182bc1 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.
2020-08-14 12:00:59 +00:00
bors
6b2ca8457a 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
2020-08-14 09:23:22 +00:00
kadmin
fd63bf7262 Rm allocation in uninhabited_enum_branching
Also convert `uninhabited_enum_branching` `Cow<[u128]>::to_mut`
2020-08-14 08:22:32 +00:00
bors
43bec40138 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.
2020-08-14 07:10:36 +00:00
bors
8e5a27766f 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
2020-08-14 02:59:44 +00:00
Tyler Mandry
e8acafd9d3
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.
2020-08-13 18:00:26 -07:00
Tyler Mandry
912b5b3067
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
2020-08-13 18:00:25 -07:00
Tyler Mandry
9cbc03112f
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
2020-08-13 18:00:23 -07:00
Tyler Mandry
33fca5ab8a
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
2020-08-13 18:00:21 -07:00
Tyler Mandry
d000fb1ca8
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
2020-08-13 18:00:19 -07:00
Tyler Mandry
b4966a8936
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.
2020-08-13 18:00:17 -07:00
Tyler Mandry
84f7991bf4
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.
2020-08-13 18:00:15 -07:00
Tyler Mandry
c76259a937
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](ded20c98be/src/librustc_mir/transform/check_unsafety.rs (L206)), so it is crucial for soundness, not just "nice to have".

Cc @oli-obk
2020-08-13 18:00:13 -07:00
Tyler Mandry
6f964f0a07
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
2020-08-13 18:00:11 -07:00
Tyler Mandry
1f73e898ee
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
2020-08-13 18:00:10 -07:00
Tyler Mandry
8c361aa28d
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.
2020-08-13 18:00:08 -07:00
Tyler Mandry
5b5eec7256
Rollup merge of #74650 - estebank:ambiguous-expr-binop, r=eddyb
Correctly parse `{} && false` in tail expression

Fix #74233, fix #54186.
2020-08-13 18:00:00 -07:00
kadmin
70ad31847d 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.
2020-08-13 21:59:47 +00:00
bors
81dc88f88f 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.
2020-08-13 21:36:02 +00:00
Mike Hommey
9302c17d18 Disable zlib in LLVM on aarch64-apple-darwin 2020-08-14 06:01:15 +09:00
Santiago Pastorino
264434fea5
Prioritization WG: Open Zulip topics only for I-prioritize issues 2020-08-13 17:04:36 -03:00
bors
5e3f1b148d 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
2020-08-13 19:26:35 +00:00
Dylan MacKenzie
662871f1cc 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.
2020-08-13 15:18:13 -04:00
rodrimati1992
18377082f1
Fixed transmute argument 2020-08-13 16:08:22 -03:00
rodrimati1992
1767c8bdf0
Replaced union with transmute 2020-08-13 15:56:23 -03:00
Ralf Jung
2338903260 fn type: structure, and talk a bit more about ABIs and how to create them 2020-08-13 20:18:00 +02:00
bors
b6396b75e7 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.
2020-08-13 17:22:36 +00:00
bors
0a49057dd3 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
2020-08-13 15:03:40 +00:00
bors
a0c290f951 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
2020-08-13 12:43:12 +00:00
Michael Woerister
08d951768f self-profile: Cache more query key strings when doing self-profiling. 2020-08-13 14:14:33 +02:00
bors
1a7d9f52bc 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
2020-08-13 10:31:57 +00:00
Matthias Krüger
2100e67126 make rustc-docs component available to rustup 2020-08-13 11:29:48 +02:00
bors
3fbed1739c Auto merge of #75478 - RalfJung:miri, r=RalfJung
update miri

Fixes https://github.com/rust-lang/rust/issues/75441
2020-08-13 08:24:00 +00:00
kadmin
46e5699af9 Add 64bit / 32bit files 2020-08-13 08:20:26 +00:00
Tomasz Miąsko
4fbbc81e5f Link sanitizers when creating dynamic libraries on macOS 2020-08-13 09:45:55 +02:00
Stein Somers
0522040233 Stop BTreeMap casts from reborrowing 2020-08-13 09:42:55 +02:00
Ralf Jung
7e4456f92f update miri 2020-08-13 09:18:46 +02:00
kadmin
9ef5b884b2 bless diff
Just output the current bless'd MIR diff
The tests are still fairly broken rn
2020-08-13 06:59:57 +00:00
kadmin
f51422b474 Update to pick Eq or Ne 2020-08-13 06:59:57 +00:00
kadmin
bce5eb0c08 Update w/ comments from oli
This also updates a check to ensure that this is only applied to bools
2020-08-13 06:59:57 +00:00
kadmin
6c0f2a9446 Update to actually use transform 2020-08-13 06:59:57 +00:00
kadmin
a6c2cb42d0 First iteration of simplify match branches 2020-08-13 06:59:57 +00:00
bors
d69b0997d7 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.
2020-08-13 06:17:25 +00:00
bors
814bc4fe93 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)
2020-08-13 04:20:51 +00:00
kadmin
af32db21c8 Add drop check test & MaybeUninit::first_ptr_mut
Also in drop check test add hacky workaround for platforms that don't support
panic=unwind
2020-08-13 03:51:08 +00:00
kadmin
412417d807 Rm hiding feature gate & add 1 more example
Update order docs for `map`
2020-08-13 03:51:05 +00:00
kadmin
54b821ebc0 Add tracking issue #75243
Add note & example about iter order

Add doc changes

Update doc comments
2020-08-13 03:51:01 +00:00
kadmin
56a651ca15 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
2020-08-13 03:50:59 +00:00
kadmin
f6411e4c66 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
2020-08-13 03:50:57 +00:00