Commit graph

153496 commits

Author SHA1 Message Date
Tomasz Miąsko
9a0ee05c3d Split critical edge targeting the start block 2021-08-17 00:00:00 +00:00
bors
0e41c6201f Auto merge of #88094 - m-ou-se:rollup-2fxss0q, r=m-ou-se
Rollup of 10 pull requests

Successful merges:

 - #87178 ([rustdoc] Copy only item path to clipboard rather than full `use` statement.)
 - #87677 (Adding explicit notice of lack of documentation for Tier 2 Platforms)
 - #87958 (Closure migration multispan suggestions)
 - #87967 (Detect fake spans in non_fmt_panic lint.)
 - #88011 (Enable `--all-targets` for `x.py check` unconditionally)
 - #88030 (Assign FIXMEs to me and remove obsolete ones)
 - #88052 (Update redox_syscall)
 - #88055 (Update RELEASES.md for 1.55.0)
 - #88080 (Skip assert ICE with default_method_body_is_const)
 - #88089 (Rustdoc font test)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-08-16 22:33:36 +00:00
Mara Bos
d5ec5aa783
Rollup merge of #88089 - dns2utf8:rustdoc_font_test, r=GuillaumeGomez
Rustdoc font test

 Add a font test based on #85669 fixes #85632.

r? `@jsha` `@GuillaumeGomez`
2021-08-16 23:37:35 +02:00
Mara Bos
4de53c427b
Rollup merge of #88080 - fee1-dead:iterator-const, r=oli-obk
Skip assert ICE with default_method_body_is_const

functions marked with #[default_method_body_is_const] would
ICE when being const checked due to it not being a const function:
`tcx.is_const_fn_raw(did)` returns false. We should skip this assert
when it is marked with that attribute.

r? `@oli-obk`
2021-08-16 23:37:34 +02:00
Mara Bos
18a7b6d32a
Rollup merge of #88055 - Mark-Simulacrum:relnotes-1.55, r=Mark-Simulacrum
Update RELEASES.md for 1.55.0

Reopening https://github.com/rust-lang/rust/pull/87624 after some edits and a force-push caused GitHub to close the PR.
2021-08-16 23:37:33 +02:00
Mara Bos
280ac7f49f
Rollup merge of #88052 - bjorn3:update_redox_syscall, r=Mark-Simulacrum
Update redox_syscall

The currently pinned version doesn't compile with the latest rustc nightly

cc ``@jackpot51``
2021-08-16 23:37:31 +02:00
Mara Bos
fa4edcc851
Rollup merge of #88030 - fee1-dead:fixme, r=oli-obk
Assign FIXMEs to me and remove obsolete ones

Also fixed capitalization of documentation

We also don't need to transform predicates to be non-const since we basically ignore const predicates in non-const contexts.

r? `````@oli-obk`````
2021-08-16 23:37:30 +02:00
Mara Bos
fe71be7f34
Rollup merge of #88011 - jyn514:check-all-targets, r=Mark-Simulacrum
Enable `--all-targets` for `x.py check` unconditionally

Now that Cargo deduplicates diagnostics from different targets, this doesn't flood the console with
duplicate errors.

Note that this doesn't add `--all-targets` in `Builder::cargo` directly because `impl Step for Std`
actually wants to omit `--all-targets` the first time while it's still building libtest.

When passed `--all-targets`, this warns that the option isn't needed, but still continues to compile.

Fixes https://github.com/rust-lang/rust/issues/87846.
r? ``@Mark-Simulacrum``
2021-08-16 23:37:29 +02:00
Mara Bos
beeff0440f
Rollup merge of #87967 - m-ou-se:non-fmt-panic-detect-fake-spans, r=cjgillot
Detect fake spans in non_fmt_panic lint.

This addresses https://github.com/rust-lang/rust/issues/87621

Some proc_macros claim that the user wrote all of the tokens it outputs, by applying a span from the input to all of the produced tokens. That can result in confusing suggestions, as in #87621. This is a simple patch that avoids suggesting anything for `panic!("{}")` if the span of `"{}"` and `panic!(..)` are identical, which is normally not possible.
2021-08-16 23:37:28 +02:00
Mara Bos
d7df1b13da
Rollup merge of #87958 - m-ou-se:closure-migration-multispan-suggestions, r=estebank
Closure migration multispan suggestions

This changes the `rust_2021_incompatible_closure_captures` lint to only suggest inserting the parts that need to be inserted, instead of suggesting to replace the entire closure by an almost identical closure with one statement added.

Before:
```
[...]
help: add a dummy let to cause `a` to be fully captured
   |
5  ~     let _ = || {
6  +         let _ = &a;
7  +         dbg!(a.0);
8  +         println!("1");
9  +         println!("2");
10 +         println!("3");
 ...
   |

[...]
help: add a dummy let to cause `b` to be fully captured
   |
14 |     let _ = || { let _ = &b; dbg!(b.0); };
   |                ~~~~~~~~~~~~~~~~~~~~~~~~~~

[...]
help: add a dummy let to cause `c` to be fully captured
   |
16 |     let _ = || { let _ = &c; dbg!(c.0) };
   |                ~~~~~~~~~~~~~~~~~~~~~~~~~
```

After:
```
[...]
help: add a dummy let to cause `a` to be fully captured
   |
5  ~     let _ = || {
6  +         let _ = &a;
   |

[...]
help: add a dummy let to cause `b` to be fully captured
   |
14 |     let _ = || { let _ = &b; dbg!(b.0); };
   |                  +++++++++++

[...]
help: add a dummy let to cause `c` to be fully captured
   |
16 |     let _ = || { let _ = &c; dbg!(c.0) };
   |                +++++++++++++           +
```
2021-08-16 23:37:27 +02:00
Mara Bos
84ca374bcb
Rollup merge of #87677 - amalik18:issue-2788-fix, r=pietroalbini
Adding explicit notice of lack of documentation for Tier 2 Platforms

Fixing: https://github.com/rust-lang/rustup/issues/2788
2021-08-16 23:37:26 +02:00
Mara Bos
2dbb2f7420
Rollup merge of #87178 - moxian:rd-use, r=jyn514
[rustdoc] Copy only item path to clipboard rather than full `use` statement.

The (somewhat) recent addition of the "copy item import to clipboard" button is extremely nice.

However, i tend to write my code with fully qualified paths wherever feasible and only resort to `use` statements as a refactoring pass. This makes the "copy to clipboard" workflow awkward to use, as i would be copy-pasting that as, say

```rust
impl use std::ops::Add; for MyType {
```

and then go back  and remove the `use ` and `;`.

This PR removes the `use ;` decorations, making it much nicer to use for fully-qualified items. I argue, however, that this does not noticeably degrade experience for those who prefer to import items, since the hard part about those is getting the path right, and writing the `use ;` decoration can be done by hand with little effort.
2021-08-16 23:37:25 +02:00
Guillaume Gomez
d4293ffcb3 Move working checks into separate test files 2021-08-16 23:17:27 +02:00
Guillaume Gomez
4ba54ff60b Add UI tests for doc(test(...)) attribute checks 2021-08-16 23:17:27 +02:00
Guillaume Gomez
cbfe8749c2 Add check for doc(test(...)) attribute 2021-08-16 23:17:26 +02:00
The8472
ff12ab2d99 correct overflows in the backslide case, add test 2021-08-16 22:15:52 +02:00
Stefan Schindler
2f486d5f8d Merge the two test files as they are testing the same features 2021-08-16 21:50:13 +02:00
Stefan Schindler
ee4521e19b Add a font test based on #85669 2021-08-16 21:50:12 +02:00
Stefan Schindler
5e4657d3f7 Fix double output of the summary line 2021-08-16 21:50:12 +02:00
Nikita Popov
f3ae726f30 Update to LLVM 13 2021-08-16 20:24:02 +02:00
Nikita Popov
3cfb7305dd Relax internal/private checks in coverage IR test
Since https://reviews.llvm.org/D103355 this will usually also use
internal rather than private on Windows as well. We don't
particularly care about this implementation detail, just accept
either.
2021-08-16 20:24:02 +02:00
Esteban Küber
39f220ce12 Use note to point at bound introducing requirement 2021-08-16 17:47:22 +00:00
Guillaume Gomez
9c21da6ece Take into account jobs number for rustdoc gui tests 2021-08-16 19:22:27 +02:00
Cameron Steffen
b1e07b82dc Fix a coverage-reports test 2021-08-16 16:29:34 +00:00
Cameron Steffen
d3097fc496 clippy: Fix format_args expansion parsing 2021-08-16 16:29:23 +00:00
Nikita Popov
6a454edce9 Dispose LLVM context after TargetMachine
The TargetMachine may be referencing data in the context. In
particular, at least the GlobalISel instruction selector stored
in the TM may reference a TrackedMDNode DebugLoc that destruction
of the TargetMachine will try to untrack.
2021-08-16 18:28:18 +02:00
Nikita Popov
d20e798ad8 Set LLVM_INCLUDE_TESTS=OFF when building LLVM
When LLVM_INCLUDE_TESTS is enabled (by default), LLVM requires
Python 3.6 for the lit test runner, otherwise only Python 3.0 is
required.

As we have many docker images using Ubuntu 16.04, which only has
Python 3.5, this avoids the need to install a newer Python version
for them.
2021-08-16 18:28:18 +02:00
Nikita Popov
7c015648dd Use llvm.compiler.used insetad of llvm.used
The #[used] attribute explicitly only requires symbols to be
retained in object files, but allows the linker to drop them
if dead. This corresponds to llvm.compiler.used semantics.

The motivation to change this *now* is that https://reviews.llvm.org/D97448
starts emitting #[used] symbols into unique sections with
SHF_GNU_RETAIN flag. This triggers a bug in some version of gold,
resulting in the ARGV_INIT_ARRAY symbol part of the .init_array
section to be incorrectly placed.
2021-08-16 18:28:18 +02:00
Nikita Popov
154c8408e9 Update coverage LLVM IR test
This uses comdats since LLVM 13, causing various minor changes to the
output.
2021-08-16 18:28:18 +02:00
Nikita Popov
b5cc03b71a Update powerpc64 data layout 2021-08-16 18:28:18 +02:00
Nikita Popov
6eaf227ce1 Update wasm data layout 2021-08-16 18:28:18 +02:00
Nikita Popov
335f003b02 Remove codegen/issue-83623-SIMD-PartialEq.rs
This has regressed due to https://bugs.llvm.org/show_bug.cgi?id=51211.
It's pretty likely that we'll have to eat this regression for this
release.
2021-08-16 18:28:18 +02:00
Nikita Popov
621f5146c3 Handle SrcMgr diagnostics
This is how InlineAsm diagnostics with source information are
reported now. Previously a separate InlineAsm diagnostic handler
was used.
2021-08-16 18:28:17 +02:00
Cameron Steffen
51979ac1c7 Fix a debuginfo test 2021-08-16 16:28:16 +00:00
Cameron Steffen
46377c48a4 Add unnecessary unsafe test 2021-08-16 16:28:16 +00:00
Cameron Steffen
f4ef07c2a9 Get piece unchecked in write 2021-08-16 16:28:16 +00:00
Cameron Steffen
975bc18481 Make Arguments constructors unsafe 2021-08-16 16:28:16 +00:00
Nikita Popov
2967036f57 Update codegen tests for LLVM 13 2021-08-16 18:26:57 +02:00
Mara Bos
ab8cbc3190 Show correct macro name in non_fmt_panics message. 2021-08-16 17:39:50 +02:00
bors
0035d9dcec Auto merge of #87050 - jyn514:no-doc-primitive, r=manishearth
Add future-incompat lint for `doc(primitive)`

## What is `doc(primitive)`?

`doc(primitive)` is an attribute recognized by rustdoc which adds documentation for the built-in primitive types, such as `usize` and `()`. It has been stable since Rust 1.0.

## Why change anything?

`doc(primitive)` is useless for anyone outside the standard library. Since rustdoc provides no way to combine the documentation on two different primitive items, you can only replace the docs, and since the standard library already provides extensive documentation there is no reason to do so.

While fixing rustdoc's handling of primitive items (https://github.com/rust-lang/rust/pull/87073) I discovered that even rustdoc's existing handling of primitive items was broken if you had more than two crates using it (it would pick randomly between them). That meant both:
- Keeping rustdoc's existing treatment was nigh-impossible, because it was random.
- doc(primitive) was even more useless than it would otherwise be.

The only use-case for this outside the standard library is for no-std libraries which want to link to primitives (https://github.com/rust-lang/rust/issues/73423) which is being fixed in https://github.com/rust-lang/rust/pull/87073.

https://github.com/rust-lang/rust/pull/87073 makes various breaking changes to `doc(primitive)` (breaking in the sense that they change the semantics, not in that they cause code to fail to compile). It's not possible to avoid these and still fix rustdoc's issues.

## What can we do about it?

As shown by the crater run (https://github.com/rust-lang/rust/pull/87050#issuecomment-886166706), no one is actually using doc(primitive), there wasn't a single true regression in the whole run. We can either:
1. Feature gate it completely, breaking anyone who crater missed. They can easily fix the breakage just by removing the attribute.
2. add it to the `INVALID_DOC_ATTRIBUTES` future-incompat lint, and at the same time make it a no-op unless you add a feature gate. That would mean rustdoc has to look at the features of dependent crates, because it needs to know where primitives are defined in order to link to them.
3. add it to `INVALID_DOC_ATTRIBUTES`, but still use it to determine where primitives come from
4. do nothing; the behavior will silently change in https://github.com/rust-lang/rust/pull/87073.

My preference is for 2, but I would also be happy with 1 or 3. I don't think we should silently change the behavior.

This PR currently implements 3.
2021-08-16 15:36:44 +00:00
Mara Bos
86bc236a4c Add more assert!() tests for non_fmt_panics. 2021-08-16 17:35:49 +02:00
Mara Bos
82d530577b Add tests for non_fmt_panics in generic functions. 2021-08-16 17:33:42 +02:00
Mara Bos
00ca4d0dd3 Update non_fmt_panics test. 2021-08-16 17:26:08 +02:00
Mara Bos
0a313250a4 Improve non_fmt_panics suggestion based on trait impls. 2021-08-16 17:25:35 +02:00
Deadbeef
85abdf0757
Add ui test 2021-08-16 15:15:28 +00:00
Deadbeef
ee85704c04
Skip assert ICE with default_method_body_is_const
functions marked with #[default_method_body_is_const] would
ICE when being const checked due to it not being a const function:
`tcx.is_const_fn_raw(did)` returns false. We should skip this assert
when it is marked with that attribute.
2021-08-16 12:04:01 +00:00
Mara Bos
64310977e6 Update test output. 2021-08-16 11:38:32 +02:00
Mara Bos
111201d27c Use multi span suggestions for closure migrations. 2021-08-16 11:38:28 +02:00
bors
73d96b090b Auto merge of #88032 - hyd-dev:no-mangle-method, r=petrochenkov
Fix `reachable_set` for non-function items in non-library crates

I unintentionally changed `reachable_set` to ignore non-function items when `!self.any_library` in https://github.com/rust-lang/rust/pull/86492, which can lead to "undefined reference" errors in non-library (`cdylib`/`staticlib`/`bin`) crates, for example: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=6bb2c5065a9be7e40943d0541e161b5a

This PR restores the behavior of `reachable_set` for non-function items.

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

<details>
<summary>The modified test will fail with this output without the `reachable_set` change</summary>

```
---- [codegen] codegen/external-no-mangle-statics.rs#staticlib stdout ----

error in revision `staticlib`: verification with 'FileCheck' failed
status: exit status: 1
command: "/checkout/build/x86_64-unknown-linux-gnu/ci-llvm/bin/FileCheck" "--input-file" "/checkout/build/x86_64-unknown-linux-gnu/test/codegen/external-no-mangle-statics.staticlib/external-no-mangle-statics.ll" "/checkout/src/test/codegen/external-no-mangle-statics.rs" "--check-prefixes" "CHECK,NONMSVC,staticlib"
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------
/checkout/src/test/codegen/external-no-mangle-statics.rs:10:11: error: CHECK: expected string not found in input
// CHECK: `@A` = local_unnamed_addr constant
          ^
/checkout/build/x86_64-unknown-linux-gnu/test/codegen/external-no-mangle-statics.staticlib/external-no-mangle-statics.ll:1:1: note: scanning from here
; ModuleID = 'external_no_mangle_statics.b50529d3-cgu.0'
^
/checkout/build/x86_64-unknown-linux-gnu/test/codegen/external-no-mangle-statics.staticlib/external-no-mangle-statics.ll:1:6: note: possible intended match here
; ModuleID = 'external_no_mangle_statics.b50529d3-cgu.0'
     ^

Input file: /checkout/build/x86_64-unknown-linux-gnu/test/codegen/external-no-mangle-statics.staticlib/external-no-mangle-statics.ll
Check file: /checkout/src/test/codegen/external-no-mangle-statics.rs

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            1: ; ModuleID = 'external_no_mangle_statics.b50529d3-cgu.0'
check:10'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
check:10'1          ?                                                   possible intended match
            2: source_filename = "external_no_mangle_statics.b50529d3-cgu.0"
check:10'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            3: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
check:10'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            4: target triple = "x86_64-unknown-linux-gnu"
check:10'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            5:
check:10'0     ~
            6: !llvm.module.flags = !{!0, !1}
check:10'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            .
            .
            .
>>>>>>

------------------------------------------

failures:
    [codegen] codegen/external-no-mangle-statics.rs#staticlib
```
</details>
2021-08-16 09:38:18 +00:00
kit
13e2f807a1 Generate an iOS LLVM target with a specific version
Without the specific version, the mach-o header will be missing the
minimum supported operating system version. This is mandatory for
running Rust binaries on iOS devices.
2021-08-16 17:31:37 +10:00