Commit graph

133131 commits

Author SHA1 Message Date
Ethan Brierley ad7f330f52 Add test default_function_param 2020-11-11 22:48:52 +00:00
bors 77180db6f8 Auto merge of #78956 - jonas-schievink:rollup-r53giob, r=jonas-schievink
Rollup of 11 pull requests

Successful merges:

 - #78216 (Duration::zero() -> Duration::ZERO)
 - #78354 (Support enable/disable sanitizers/profiler per target)
 - #78417 (BTreeMap: split off most code of append)
 - #78832 (look at assoc ct, check the type of nodes)
 - #78873 (Add flags customizing behaviour of MIR inlining)
 - #78899 (Support inlining diverging function calls)
 - #78923 (Cleanup and comment intra-doc link pass)
 - #78929 (rustc_target: Move target env "gnu" from `linux_base` to `linux_gnu_base`)
 - #78930 (rustc_taret: Remove `TargetOptions::is_like_android`)
 - #78942 (Fix typo in comment)
 - #78947 (Ship llvm-cov through llvm-tools)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2020-11-11 22:20:07 +00:00
Bastian Kauschke a9eacf33b7 add error-in-impl-trait const generics test 2020-11-11 21:24:03 +01:00
Bastian Kauschke 7d9f81517b add rustdoc test 2020-11-11 21:24:03 +01:00
Jonas Schievink 61c0a2c4ac
Rollup merge of #78947 - dalance:llvm_cov, r=Mark-Simulacrum
Ship llvm-cov through llvm-tools

`llvm-cov` is used to generate coverage report with LLVM InstrProf-based code coverage #34701.
So if `llvm-cov` is shipped through llvm-tools, users can try it easily accorging to the instruction of [The Rust Unstable Book](https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/source-based-code-coverage.html).
2020-11-11 20:59:14 +01:00
Jonas Schievink f311458e42
Rollup merge of #78942 - eltociear:patch-1, r=jonas-schievink
Fix typo in comment

occurences -> occurrences
2020-11-11 20:59:12 +01:00
Jonas Schievink 904b658303
Rollup merge of #78930 - petrochenkov:notlikeandroid, r=Mark-Simulacrum
rustc_taret: Remove `TargetOptions::is_like_android`

This option was replaced by more specific options and is no longer used by the compiler.
2020-11-11 20:59:10 +01:00
Jonas Schievink 5ac0ae4ae4
Rollup merge of #78929 - petrochenkov:linuxbase, r=joshtriplett
rustc_target: Move target env "gnu" from `linux_base` to `linux_gnu_base`

Follow up to https://github.com/rust-lang/rust/pull/77729.

Changes the target spec hierarchy for Linux from
```
linux_base
├── linux_musl_base
└── linux_uclibc_base
```
where `linux_base` is really `linux_gnu_base` and the inheriting targets replace target env "gnu" with "musl"/"uclibc" to
```
linux_base
├── linux_gnu_base
├── linux_musl_base
└── linux_uclibc_base
```
which is slightly less confusing (I think).
2020-11-11 20:59:09 +01:00
Jonas Schievink a8a0c65229
Rollup merge of #78923 - jyn514:intra-doc-comments, r=Manishearth
Cleanup and comment intra-doc link pass

r? ```@Manishearth```
cc ```@seeplusplus```
2020-11-11 20:59:07 +01:00
Jonas Schievink 0b521e5c47
Rollup merge of #78899 - tmiasko:inline-diverging, r=oli-obk
Support inlining diverging function calls

The existing heuristic does penalize diverging calls to some degree, but since
it never inlined them previously it might need some further modifications.

Additionally introduce storage markers for all temporaries created by
the inliner. The temporary introduced for destination rebrorrow, didn't
use them previously.
2020-11-11 20:59:05 +01:00
Jonas Schievink 919177f7e4
Rollup merge of #78873 - tmiasko:inline-opts, r=oli-obk
Add flags customizing behaviour of MIR inlining

* `-Zinline-mir-threshold` to change the default threshold.
* `-Zinline-mir-hint-threshold` to change the threshold used by
  functions with inline hint.

Having those as configurable flags makes it possible to experiment with with
different inlining thresholds and substantially increase test coverage of MIR
inlining when used with increased thresholds (for example, necessary to test
#78844).
2020-11-11 20:59:03 +01:00
Jonas Schievink 2e0a0b42ad
Rollup merge of #78832 - lcnr:const-evaluatable-unevaluated, r=oli-obk
look at assoc ct, check the type of nodes

an example where types matter are function objects, see the added test which previously passed.

Now does a shallow comparison of unevaluated constants.

r? ```@oli-obk```
2020-11-11 20:59:02 +01:00
Jonas Schievink 56e0806a1a
Rollup merge of #78417 - ssomers:btree_chop_up_2, r=Mark-Simulacrum
BTreeMap: split off most code of append

To complete #78056, move the last single-purpose pieces of code out of map.rs into a separate module. Also, tweaked documentation and safeness - I doubt think this code would be safe if the iterators passed in wouldn't be as sorted as the method says they should be - and bounds on MergeIterInner.

r? ```@Mark-Simulacrum```
2020-11-11 20:59:00 +01:00
Jonas Schievink 194b96852f
Rollup merge of #78354 - 12101111:rustbuild_profiler, r=Mark-Simulacrum
Support enable/disable sanitizers/profiler per target

This PR add options under `[target.*]` of `config.toml` which can enable or disable sanitizers/profiler runtime for corresponding target.
If these options are empty, the global options under `[build]` will take effect.

Fix #78329
2020-11-11 20:58:56 +01:00
Jonas Schievink 62f0a78056
Rollup merge of #78216 - workingjubilee:duration-zero, r=m-ou-se
Duration::zero() -> Duration::ZERO

In review for #72790, whether or not a constant or a function should be favored for `#![feature(duration_zero)]` was seen as an open question. In https://github.com/rust-lang/rust/issues/73544#issuecomment-691701670 an invitation was opened to either stabilize the methods or propose a switch to the constant value, supplemented with reasoning. Followup comments suggested community preference leans towards the const ZERO, which would be reason enough.

ZERO also "makes sense" beside existing associated consts for Duration. It is ever so slightly awkward to have a series of constants specifying 1 of various units but leave 0 as a method, especially when they are side-by-side in code. It seems unintuitive for the one non-dynamic value (that isn't from Default) to be not-a-const, which could hurt discoverability of the associated constants overall. Elsewhere in `std`, methods for obtaining a constant value were even deprecated, as seen with [std::u32::min_value](https://doc.rust-lang.org/std/primitive.u32.html#method.min_value).

Most importantly, ZERO costs less to use. A match supports a const pattern, but const fn can only be used if evaluated through a const context such as an inline `const { const_fn() }` or a `const NAME: T = const_fn()` declaration elsewhere. Likewise, while https://github.com/rust-lang/rust/issues/73544#issuecomment-691949373 notes `Duration::zero()` can optimize to a constant value, "can" is not "will". Only const contexts have a strong promise of such. Even without that in mind, the comment in question still leans in favor of the constant for simplicity. As it costs less for a developer to use, may cost less to optimize, and seems to have more of a community consensus for it, the associated const seems best.

r? ```@LukasKalbertodt```
2020-11-11 20:58:52 +01:00
bors 5404efc28a Auto merge of #78946 - jethrogb:linux-x86-llvm-no-gnu-unique, r=Mark-Simulacrum
Linux dist: don't include unique symbols in libLLVM

Fixes #76980
2020-11-11 19:37:31 +00:00
Joshua Nelson 6e9ed8b486 Enable thread names in debug logging only for parallel_compiler 2020-11-11 13:28:30 -05:00
khyperia 0e34b73996 Change capitalization of Spirv to SpirV
This matches the capitalization of RiscV
2020-11-11 19:18:06 +01:00
khyperia f3441348e0 Add asm register information for SPIR-V 2020-11-11 17:38:02 +01:00
bors 7afc517230 Auto merge of #78790 - Gankra:rust-src-vendor, r=Mark-Simulacrum
Vendor libtest's dependencies in the rust-src component

This is the Rust side of https://github.com/rust-lang/wg-cargo-std-aware/issues/23

Note that this won't produce a useful result for `cargo -Zbuild-std` if there are multiple versions of a crate vendored, but will otherwise produce a valid vendor dir.

See https://github.com/rust-lang/cargo/pull/8834 for the other half of this change.
2020-11-11 16:24:43 +00:00
dalance 2453ce717a Ship llvm-cov through llvm-tools 2020-11-12 00:03:09 +09:00
Jethro Beekman d2ad47269b Linux dist: don't include unique symbols in libLLVM 2020-11-11 14:46:04 +01:00
Fabian Zaiser de84ad95b4 Implement destructuring assignment for structs and slices
Co-authored-by: varkor <github@varkor.com>
2020-11-11 12:10:52 +00:00
Ikko Ashimine 1854425758
Fix typo in comment
occurences -> occurrences
2020-11-11 20:23:08 +09:00
bors d4ea0b3e46 Auto merge of #78825 - Nicholas-Baron:unwrap_or_corrected, r=lcnr
`unwrap_or` lint corrected

https://github.com/rust-lang/rust/issues/78814#issuecomment-723305713

This pull request fixes the lint from clippy where `unwrap_or` could be better done as a `unwrap_or_else` or a `unwrap_or_default`.
2020-11-11 09:10:30 +00:00
Vadim Petrochenkov ca17a91fb7 rustc_target: Move target env "gnu" from linux_base to linux_gnu_base 2020-11-11 11:38:40 +03:00
Nicholas-Baron 261ca04c92 Changed unwrap_or to unwrap_or_else in some places.
The discussion seems to have resolved that this lint is a bit "noisy" in
that applying it in all places would result in a reduction in
readability.

A few of the trivial functions (like `Path::new`) are fine to leave
outside of closures.

The general rule seems to be that anything that is obviously an
allocation (`Box`, `Vec`, `vec![]`) should be in a closure, even if it
is a 0-sized allocation.
2020-11-10 20:07:47 -08:00
bors 38030ffb4e Auto merge of #78920 - jonas-schievink:rollup-w2mjsuh, r=jonas-schievink
Rollup of 14 pull requests

Successful merges:

 - #76765 (Make it more clear what an about async fn's returns when referring to what it returns)
 - #78574 (Use check-pass instead of build-pass in regions ui test suite)
 - #78669 (Use check-pass instead of build-pass in some consts ui test suits)
 - #78847 (Assert that a return place is not used for indexing during integration)
 - #78854 (Workaround for "could not fully normalize" ICE )
 - #78875 (rustc_target: Further cleanup use of target options)
 - #78887 (Add comments to explain memory usage optimization)
 - #78890 (comment attribution fix)
 - #78896 (Clarified description of write! macro)
 - #78897 (Add missing newline to error message of the default OOM hook)
 - #78898 (add regression test for #78892)
 - #78908 ((rustdoc) [src] link for types defined by macros shows invocation, not defintion)
 - #78910 (Fix links to stabilized versions of some intrinsics)
 - #78912 (Add macro test for min-const-generics)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2020-11-11 01:18:18 +00:00
Joshua Nelson 9cf8a49f5d Don't print thread ids and names in tracing logs
Before:

```
2:rustc INFO rustc_interface::passes Pre-codegen
2:rustcTy interner             total           ty lt ct all
2:rustc    Adt               :   1078 81.3%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Array             :      1  0.1%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Slice             :      1  0.1%,  0.0%   0.0%  0.0%  0.0%
2:rustc    RawPtr            :      2  0.2%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Ref               :      4  0.3%,  0.1%   0.1%  0.0%  0.0%
2:rustc    FnDef             :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    FnPtr             :     76  5.7%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Placeholder       :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Generator         :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    GeneratorWitness  :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Dynamic           :      3  0.2%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Closure           :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Tuple             :     13  1.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Bound             :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Param             :    146 11.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Infer             :      2  0.2%,  0.1%   0.0%  0.0%  0.0%
2:rustc    Projection        :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Opaque            :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Foreign           :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc                  total   1326         0.2%   0.1%  0.0%  0.0%
2:rustcInternalSubsts interner: #437
2:rustcRegion interner: #355
2:rustcStability interner: #1
2:rustcConst Stability interner: #0
2:rustcAllocation interner: #0
2:rustcLayout interner: #0
```

After:

```
 INFO rustc_interface::passes Post-codegen
Ty interner             total           ty lt ct all
    Adt               :   1078 81.3%,  0.0%   0.0%  0.0%  0.0%
    Array             :      1  0.1%,  0.0%   0.0%  0.0%  0.0%
    Slice             :      1  0.1%,  0.0%   0.0%  0.0%  0.0%
    RawPtr            :      2  0.2%,  0.0%   0.0%  0.0%  0.0%
    Ref               :      4  0.3%,  0.1%   0.1%  0.0%  0.0%
    FnDef             :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    FnPtr             :     76  5.7%,  0.0%   0.0%  0.0%  0.0%
    Placeholder       :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Generator         :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    GeneratorWitness  :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Dynamic           :      3  0.2%,  0.0%   0.0%  0.0%  0.0%
    Closure           :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Tuple             :     13  1.0%,  0.0%   0.0%  0.0%  0.0%
    Bound             :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Param             :    146 11.0%,  0.0%   0.0%  0.0%  0.0%
    Infer             :      2  0.2%,  0.1%   0.0%  0.0%  0.0%
    Projection        :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Opaque            :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Foreign           :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
                  total   1326         0.2%   0.1%  0.0%  0.0%
InternalSubsts interner: #437
Region interner: #355
Stability interner: #1
Const Stability interner: #0
Allocation interner: #0
Layout interner: #0
```
2020-11-10 17:32:29 -05:00
Vadim Petrochenkov ce91c68943 rustc_taret: Remove TargetOptions::is_like_android 2020-11-10 23:51:34 +03:00
Joshua Nelson 03eec5cc73 Cleanup and comment intra-doc link pass 2020-11-10 11:15:13 -05:00
Guillaume Gomez 46c921d3ab Improve the page title switch handling between search and doc 2020-11-10 15:01:01 +01:00
Jonas Schievink fa4d0f2327
Rollup merge of #78912 - JulianKnodt:mcg_macro, r=lcnr
Add macro test for min-const-generics

Adds a test which uses a macro inside a block for a const-expression, as per #78433

r? `@lcnr`
2020-11-10 14:45:36 +01:00
Jonas Schievink 42fae6bb65
Rollup merge of #78910 - tmiasko:intrinsics-link, r=jyn514
Fix links to stabilized versions of some intrinsics
2020-11-10 14:45:34 +01:00
Jonas Schievink a5f549eeb5
Rollup merge of #78908 - liketechnik:fix_macro_expand_src_link, r=jyn514
(rustdoc) [src] link for types defined by macros shows invocation, not defintion

Previously the [src] link on types defined by a macro pointed to the macro definition.

This pr makes the Clean-Implementation for Spans aware of macro defined types, so that the link points to the invocation instead.

I'm not totally sure if it's okay to add the 'macro awareness' in the Clean-Implementation, because it erases that knowledge for all following code. Maybe it would be more sensible to add the check only for the link generation at 25f6938da4/src/librustdoc/html/render/mod.rs (L1619)

Closes #39726.
2020-11-10 14:45:32 +01:00
Jonas Schievink 6b27f0d5b9
Rollup merge of #78898 - SNCPlay42:issue-78892, r=Mark-Simulacrum
add regression test for #78892

closes #78892, which was already fixed on nightly.
2020-11-10 14:45:30 +01:00
Jonas Schievink 354098ccdd
Rollup merge of #78897 - hyd-dev:alloc-error-hook-newline, r=m-ou-se
Add missing newline to error message of the default OOM hook

Currently the default OOM hook in libstd does not end the error message with a newline:
```
memory allocation of 4 bytes failedtimeout: the monitored command dumped core
/playground/tools/entrypoint.sh: line 11:     7 Aborted                 timeout --signal=KILL ${timeout} "$`@"`
```
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=030d8223eb57dfe47ef157709aa26542

This is because the `fmt::Arguments` passed to `dumb_print()` does not end with a newline. All other calls to `dumb_print()` in libstd pass a `\n`-ended `fmt::Arguments` to `dumb_print()`. For example:
25f6938da4/library/std/src/sys_common/util.rs (L18)
I think the `\n` was forgotten in #51264.

This PR appends `\n` to the error string.

~~Note that I didn't add a test, because I didn't find tests for functions in ` library/std/src/alloc.rs` or a test that is similar to the test of this change would be.~~ *Edit: CI told me there is an existing test. Sorry.*
2020-11-10 14:45:28 +01:00
Jonas Schievink 87ecb0afac
Rollup merge of #78896 - cyqsimon:master, r=m-ou-se
Clarified description of write! macro

Reordered the list of arguments in the description to match that in the actual macro.

Suggested and discussed [here](https://discord.com/channels/442252698964721669/443492145567891458/774341262609219624).
2020-11-10 14:45:27 +01:00
Jonas Schievink 1952f04a61
Rollup merge of #78890 - o752d:patch-2, r=jyn514
comment attribution fix

comment means to refer to the macro in its direct scope
2020-11-10 14:45:25 +01:00
Jonas Schievink a08e7afefd
Rollup merge of #78887 - camelid:dataflow-state-decl, r=jonas-schievink
Add comments to explain memory usage optimization

Add explanatory comments so that people understand that it's just an optimization and doesn't affect behavior.
2020-11-10 14:45:23 +01:00
Jonas Schievink 105f4b8792
Rollup merge of #78875 - petrochenkov:cleantarg, r=Mark-Simulacrum
rustc_target: Further cleanup use of target options

Follow up to https://github.com/rust-lang/rust/pull/77729.

Implements items 2 and 4 from the list in https://github.com/rust-lang/rust/pull/77729#issue-500228243.

The first commit collapses uses of `target.options.foo` into `target.foo`.

The second commit renames some target options to avoid tautology:
`target.target_endian` -> `target.endian`
`target.target_c_int_width` -> `target.c_int_width`
`target.target_os` -> `target.os`
`target.target_env` -> `target.env`
`target.target_vendor` -> `target.vendor`
`target.target_family` -> `target.os_family`
`target.target_mcount` -> `target.mcount`

r? `@Mark-Simulacrum`
2020-11-10 14:45:21 +01:00
Jonas Schievink e15fee9fe4
Rollup merge of #78854 - the8472:workaround-normalization-regression-master, r=Mark-Simulacrum
Workaround for "could not fully normalize" ICE

Workaround for "could not fully normalize" ICE (#78139) by removing the `needs_drop::<T>()` calls triggering it.
Corresponding beta PR: #78845

Fixes #78139 -- the underlying bug is likely not fixed but we don't have another test case isolated for now, so closing.
2020-11-10 14:45:19 +01:00
Jonas Schievink 9c486882e5
Rollup merge of #78847 - tmiasko:inline-return-place, r=matthewjasper
Assert that a return place is not used for indexing during integration

The inliner integrates call destination place with callee return place
by remapping the local and adding extra projections as necessary.

If a call destination place contains any projections (which is already
possible) and a return place is used in an indexing projection (most
likely doesn't happen yet) the end result would be incorrect.

Add an assertion to ensure that potential issue won't go unnoticed in
the presence of more sophisticated copy propagation scheme.
2020-11-10 14:45:17 +01:00
Jonas Schievink 3a2cbe6b83
Rollup merge of #78669 - sasurau4:test/check-pass-consts, r=jyn514
Use check-pass instead of build-pass in some consts ui test suits

Helps with #62277

Changed tests modified by https://github.com/rust-lang/rust/pull/57175 because of the stabilization `#![feature(const_let)]`.
They should be compile-fail because the feature gate checking disallow the feature before stabilization. So the feature gate checking have nothing to do with codegen according to https://rustc-dev-guide.rust-lang.org/feature-gate-ck.html.
2020-11-10 14:45:15 +01:00
Jonas Schievink 8c88c0324b
Rollup merge of #78574 - sasurau4:test/check-pass-regions, r=jyn514
Use check-pass instead of build-pass in regions ui test suite

## Overview

Helps with #62277

Region inference have nothing to do with codegen because they are erased before codegen.
Ref: https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Is.20region.20inference.20.20nothing.20to.20do.20with.20codegen.20process.3F/near/215956759
2020-11-10 14:45:13 +01:00
Jonas Schievink 9596e34ad4
Rollup merge of #76765 - guswynn:async_return, r=tmandry
Make it more clear what an about async fn's returns when referring to what it returns

see #76547

This is *likely* not the ONLY place that this happens to be unclear, but we can move this fn to rustc_middle or something like that and reuse it if need be, to apply it to more diagnostics

One outstanding question I have is, if the fn returns (), should I make the message more clear (what about `fn f()` vs `fn f() -> ()`, can you tell those apart in the hir?)

R? `@tmandry`

`@rustbot` modify labels +A-diagnostics +T-compiler
2020-11-10 14:45:09 +01:00
Daiki Ihara d757ecdc0c use check-pass instead of build-pass in consts ui test suits 2020-11-10 21:34:05 +09:00
Bastian Kauschke f4790ec2b6 add cross crate test 2020-11-10 12:31:57 +01:00
Bastian Kauschke 4b5cd04130 add test for where clauses mentioning const params 2020-11-10 12:31:57 +01:00
Bastian Kauschke de1ebbb0a7 const param in async 2020-11-10 12:31:57 +01:00