Commit graph

141881 commits

Author SHA1 Message Date
hyd-dev
2fd4dd20d7
Allow using -C force-unwind-tables=no when panic=unwind 2021-04-11 22:32:40 +08:00
Amanieu d'Antras
83c2c5b98c Add test to allow bad_asm_style 2021-04-11 15:11:02 +01:00
Ximin Luo
be5d72129e bootstrap: check local_rebuild before adding --cfg=bootstrap, closes #84057 2021-04-11 14:02:28 +01:00
bors
7953910464 Auto merge of #81469 - tweksteen:android_set_message, r=m-ou-se
android: set abort message

Android has the ability to supply an abort message [1]. This message is
automatically included in the debug trace, which helps debugging [2].
Modify panic_abort to populate this message before calling abort().

[1] https://android.googlesource.com/platform/bionic/+/master/libc/include/android/set_abort_message.h
[2] https://source.android.com/devices/tech/debug/native-crash
2021-04-11 12:29:36 +00:00
marmeladema
7d89148385 Stabilize feature duration_saturating_ops
Closes #76416
2021-04-11 11:34:42 +01:00
bors
58f32da346 Auto merge of #84063 - LingMan:patch-1, r=nagisa
Add note about reverting a workaround in the future

The root cause was fixed upstream in LLVM main. This adds a reminder to revert the workaround once the LLVM rustc depends on is new enough. Since I'm not sure how such optimizations get routed to LLVM releases, I used the conservative assumption that it will only show up with LLVM 13.
2021-04-11 10:04:46 +00:00
Mara Bos
1a62bdbc30 Stabilize is_subnormal. 2021-04-11 11:48:26 +02:00
Mara Bos
d331e5e50c Stabilize atomic_fetch_update methods on AtomicBool and AtomicPtr. 2021-04-11 11:45:46 +02:00
bors
ba6275b6a9 Auto merge of #82608 - Aaron1011:feature/final-preexp-tts, r=petrochenkov
Implement token-based handling of attributes during expansion

This PR modifies the macro expansion infrastructure to handle attributes
in a fully token-based manner. As a result:

* Derives macros no longer lose spans when their input is modified
  by eager cfg-expansion. This is accomplished by performing eager
  cfg-expansion on the token stream that we pass to the derive
  proc-macro
* Inner attributes now preserve spans in all cases, including when we
  have multiple inner attributes in a row.

This is accomplished through the following changes:

* New structs `AttrAnnotatedTokenStream` and `AttrAnnotatedTokenTree` are introduced.
  These are very similar to a normal `TokenTree`, but they also track
  the position of attributes and attribute targets within the stream.
  They are built when we collect tokens during parsing.
  An `AttrAnnotatedTokenStream` is converted to a regular `TokenStream` when
  we invoke a macro.
* Token capturing and `LazyTokenStream` are modified to work with
  `AttrAnnotatedTokenStream`. A new `ReplaceRange` type is introduced, which
  is created during the parsing of a nested AST node to make the 'outer'
  AST node aware of the attributes and attribute target stored deeper in the token stream.
* When we need to perform eager cfg-expansion (either due to `#[derive]` or `#[cfg_eval]`), we tokenize and reparse our target, capturing additional information about the locations of `#[cfg]` and `#[cfg_attr]` attributes at any depth within the target. This is a performance optimization, allowing us to perform less work in the typical case where captured tokens never have eager cfg-expansion run.
2021-04-11 07:36:33 +00:00
Aaron Hill
a93c4f05de
Implement token-based handling of attributes during expansion
This PR modifies the macro expansion infrastructure to handle attributes
in a fully token-based manner. As a result:

* Derives macros no longer lose spans when their input is modified
  by eager cfg-expansion. This is accomplished by performing eager
  cfg-expansion on the token stream that we pass to the derive
  proc-macro
* Inner attributes now preserve spans in all cases, including when we
  have multiple inner attributes in a row.

This is accomplished through the following changes:

* New structs `AttrAnnotatedTokenStream` and `AttrAnnotatedTokenTree` are introduced.
  These are very similar to a normal `TokenTree`, but they also track
  the position of attributes and attribute targets within the stream.
  They are built when we collect tokens during parsing.
  An `AttrAnnotatedTokenStream` is converted to a regular `TokenStream` when
  we invoke a macro.
* Token capturing and `LazyTokenStream` are modified to work with
  `AttrAnnotatedTokenStream`. A new `ReplaceRange` type is introduced, which
  is created during the parsing of a nested AST node to make the 'outer'
  AST node aware of the attributes and attribute target stored deeper in the token stream.
* When we need to perform eager cfg-expansion (either due to `#[derive]` or `#[cfg_eval]`),
we tokenize and reparse our target, capturing additional information about the locations of
`#[cfg]` and `#[cfg_attr]` attributes at any depth within the target.
This is a performance optimization, allowing us to perform less work
in the typical case where captured tokens never have eager cfg-expansion run.
2021-04-11 01:31:36 -04:00
bors
28b948fc5c Auto merge of #83806 - JohnTitor:issue-51446, r=estebank
Add a regression test for issue-51446

Closes #51446
r? `@estebank`
2021-04-11 05:23:11 +00:00
bors
ea1252e7e3 Auto merge of #84071 - nagisa:nixos-patching-fix, r=Mark-Simulacrum
Fix NixOS patching

Moving the `.nix-deps` has resulted in rpath links being broken and
therefore bootstrap on NixOS broken entirely.

This PR still produces a `.nix-deps` but only for the purposes of
producing a gc root. We rpath a symlink-resolved result instead.

For purposes of simplicity we also use joinSymlink to produce a single
merged output directory so that we don't need to update multiple
locations every time we add a library or something.

Fixes a regression from https://github.com/rust-lang/rust/pull/82739.
2021-04-11 02:59:30 +00:00
Joshua Nelson
47d1ed9690 Preprocess intra-doc links consistently
Previously, rustdoc would panic on links to external crates if they were
surrounded by backticks.
2021-04-10 22:32:09 -04:00
Camelid
aabc363bc2 Run rustfix for bare-urls test
This will help us ensure that it emits valid suggestions.
2021-04-10 18:39:05 -07:00
Camelid
d931e2b7bf Rename url-improvements test to bare-urls
The lint used to be called `non-autolinks`, and linted more than just
bare URLs. Now, it is called `bare-urls` and only lints against bare
URLs. So, `bare-urls` is a better name for the test.
2021-04-10 18:37:51 -07:00
bors
ef38b45e8b Auto merge of #84053 - RalfJung:liballoc-miri, r=Manishearth
fix incorrect Box::from_raw_in doctest

Now that Miri can run doctests, I ran it on liballoc, and found exactly one problem: this test creates a `Box<u8>` to deallocate a 4-byte allocation!

Introduced by https://github.com/rust-lang/rust/pull/80310 so r? `@Manishearth` `@kennytm`
2021-04-11 00:27:23 +00:00
Tomasz Miąsko
60780e438a Remove FixedSizeArray 2021-04-11 00:00:00 +00:00
bors
25ea6be13e Auto merge of #84023 - Aaron1011:derive-invoc-order, r=petrochenkov
Expand derive invocations in left-to-right order

While derives were being collected in left-to-order order, the
corresponding `Invocation`s were being pushed in the wrong order.
2021-04-10 22:04:37 +00:00
Aaron Hill
21e6cc19fe
Expand derive invocations in left-to-right order
While derives were being collected in left-to-order order, the
corresponding `Invocation`s were being pushed in the wrong order.
2021-04-10 17:29:20 -04:00
Simonas Kazlauskas
3dabab1c1e Fix NixOS patching
Moving the `.nix-deps` has resulted in rpath links being broken and
therefore bootstrap on NixOS broken entirely.

This PR still produces a `.nix-deps` but only for the purposes of
producing a gc root. We rpath a symlink-resolved result instead.

For purposes of simplicity we also use joinSymlink to produce a single
merged output directory so that we don't need to update multiple
locations every time we add a library or something.
2021-04-10 23:05:28 +03:00
bors
a836d9b641 Auto merge of #84016 - Aaron1011:new-preexp-tests, r=petrochenkov
Add some proc-macro attribute token handling tests

Split out from https://github.com/rust-lang/rust/pull/82608

r? `@petrochenkov`
2021-04-10 19:20:16 +00:00
Aaron Hill
6c591112ce
Add some proc-macro attribute token handling tests 2021-04-10 14:58:12 -04:00
Amanieu d'Antras
e9d3085cb6 Add bad_asm_style to HardwiredLints 2021-04-10 19:24:24 +01:00
Steve Klabnik
c2f4a5b9f9
clean up example on read_to_string
This is the same thing, but simpler.
2021-04-10 12:50:04 -05:00
LingMan
9aa11a128d
Add note about reverting a workaround in the future
The root cause was fixed upstream in LLVM main. This adds a reminder to revert the workaround once the LLVM rustc depends on is new enough. Since I'm not sure how such optimizations get routed to LLVM releases, I used the conservative assumption that it will only show up with LLVM 13.
2021-04-10 18:47:48 +02:00
bors
72c63de2cc Auto merge of #84052 - RalfJung:libcore-miri, r=Mark-Simulacrum
fix Miri errors in libcore doctests

Now that Miri can run doctests, it found some issues in the libcore doctests:
* The `AtomicPtr` tests accessed dangling memory! `AtomicPtr::new(&mut 10);` makes the `10` a temporary that is deallocated after the end of this expression.
* The tests for `set_ptr_value` used `&array[0] as *const _` to get a pointer to the array; this needs to be `array.as_ptr()` instead (Cc https://github.com/rust-lang/unsafe-code-guidelines/issues/134).
* I reduced a buffer size in a `MaybeUninit` test to make it less slow in Miri, and added a spin loop hint to fix a diverging loop in Miri.
2021-04-10 16:23:35 +00:00
Oleksandr Povar
63d6e32782
Bump libc dependency of std to 0.2.93 2021-04-10 16:12:46 +02:00
bors
4029d4d0be Auto merge of #84055 - kornelski:z-edition, r=petrochenkov
Don't tell users to use a nightly flag on the stable channel

When a crate requires a newer edition, currently rustc tells users to use `-Z unstable-options`. This is not ideal, because:

* This flag doesn't work on the stable channel, so solution to one error only causes another error, which is frustrating.

* Directs users towards the nightly channel, which is not necessarily the correct solution. Once the next edition is released, this message will be mostly seen by users of out-of-date stable Rust versions who merely need to update their Rust to the latest stable.
2021-04-10 14:00:22 +00:00
Kornel
40af086ee4 Don't tell users to use a nightly flag on the stable channel
Hint upgrading to a newer Rust version instead
2021-04-10 13:35:35 +01:00
bors
18c524fbae Auto merge of #84051 - Amanieu:update_llvm, r=nikic
Update LLVM submodule

Fixes #84028
2021-04-10 11:17:00 +00:00
Ralf Jung
63b682b3ec fix incorrect from_raw_in doctest 2021-04-10 12:24:19 +02:00
Ralf Jung
b35ac6949f fix Miri errors in libcore doctests 2021-04-10 11:58:48 +02:00
Amanieu d'Antras
4781ac2149 Update LLVM submodule 2021-04-10 10:51:54 +01:00
bors
9e48be9e06 Auto merge of #84050 - RalfJung:miri, r=RalfJung
update Miri

Let's ship https://github.com/rust-lang/miri/pull/1761.
Cc `@rust-lang/miri` r? `@ghost`
2021-04-10 09:05:36 +00:00
Ralf Jung
98c8b1778f update Miri 2021-04-10 11:03:34 +02:00
bors
481598b26d Auto merge of #84024 - estebank:unclosed-brace-use, r=jackh726
Avoid `;` -> `,` recovery and unclosed `}` recovery from being too verbose

Those two recovery attempts have a very bad interaction that causes too
unnecessary output. Add a simple gate to avoid interpreting a `;` as a
`,` when there are unclosed braces.

Fix #83498.
2021-04-10 03:02:46 +00:00
bors
dbcf3453ea Auto merge of #84015 - tdelabro:issue-76704-fix, r=Amanieu
doc asm feature - Added new 'Label' section with example and explanations

Fixes #76704
2021-04-10 00:35:38 +00:00
bors
dae9d6ac3e Auto merge of #84004 - mattico:print-target-features-improvements, r=petrochenkov
Categorize and explain target features support

There are 3 different uses of the `-C target-feature` args passed to rustc:
1. All of the features are passed to LLVM, which uses them to configure code-generation. This is sort-of stabilized since 1.0 though LLVM does change/add/remove target features regularly.
2. Target features which are in [the compiler's allowlist](69e1d22ddb/compiler/rustc_codegen_ssa/src/target_features.rs (L12-L34)) can be used in `cfg!(target_feature)` etc. These may have different names than in LLVM and are renamed before passing them to LLVM.
3. Target features which are in the allowlist and which are stabilized or feature-gate-enabled can be used in `#[target_feature]`.

It can be confusing that `rustc --print target-features` just prints out the LLVM features without separating out the rustc features or even mentioning that the dichotomy exists.

This improves the situation by separating out the rustc and LLVM target features and adding a brief explanation about the difference.

Abbreviated Example Output:
```
$ rustc --print target-features
Features supported by rustc for this target:
    adx                         - Support ADX instructions.
    aes                         - Enable AES instructions.
...
    xsaves                      - Support xsaves instructions.
    crt-static                  - Enables libraries with C Run-time Libraries(CRT) to be statically linked.

Code-generation features supported by LLVM for this target:
    16bit-mode                  - 16-bit mode (i8086).
    32bit-mode                  - 32-bit mode (80386).
...
    x87                         - Enable X87 float instructions.
    xop                         - Enable XOP instructions.

Use +feature to enable a feature, or -feature to disable it.
For example, rustc -C target-cpu=mycpu -C target-feature=+feature1,-feature2

Code-generation features cannot be used in cfg or #[target_feature],
and may be renamed or removed in a future version of LLVM or rustc.

```

Motivated by #83975.
CC https://github.com/rust-lang/rust/issues/49653
2021-04-09 21:14:50 +00:00
bors
8513e78dbb Auto merge of #84034 - jyn514:regex-in-loop, r=Mark-Simulacrum
Fix perf regression in rustdoc::bare_urls

This regressed in #81764. After that PR, rustdoc compiled the regex for every single item in the crate: https://perf.rust-lang.org/compare.html?start=125505306744a0a5bb01d62337260a95d9ff8d57&end=2e495d2e845cf27740e3665f718acfd3aa17253e&stat=instructions%3Au

This would have been caught by `clippy::declare_interior_mutable_const` (cc https://github.com/rust-lang/rust/issues/77983).
2021-04-09 18:47:52 +00:00
Esteban Küber
0d7167698f Avoid ; -> , recovery and unclosed } recovery from being too verbose
Those two recovery attempts have a very bad interaction that causes too
unnecessary output. Add a simple gate to avoid interpreting a `;` as a
`,` when there are unclosed braces.
2021-04-09 10:22:41 -07:00
bors
da0b9b6485 Auto merge of #81942 - the8472:reduce-ui-test-threads, r=Mark-Simulacrum
reduce threads spawned by ui-tests

The test harness already spawns enough tests to keep all cores busy.
Individual tests should keep their own threading to a minimum to avoid context switch overhead.

When running ui tests with lld enabled this shaves about 10% off that testsuite on my machine.

Resolves #81946
2021-04-09 16:22:23 +00:00
Matt Ickstadt
e258a5ba6e Categorize and explain target features support 2021-04-09 10:16:04 -05:00
Joshua Nelson
8c7b7dd041 Fix perf regression in non-autolinks
Before, this was compiling the regex on every single item in the crate.

This would have been caught by `clippy::declare_interior_mutable_const`.
2021-04-09 09:58:40 -04:00
bors
e43c2005f2 Auto merge of #84030 - jyn514:no-blanket-impls, r=GuillaumeGomez
rustdoc: Don't generate blanket impls when running --show-coverage

`get_blanket_impls` is the slowest part of rustdoc, and the coverage pass
completely ignores blanket impls. This stops running it at all, and also
removes some unnecessary checks in `calculate_doc_coverage` that ignored
the impl anyway.

We don't currently measure --show-coverage in perf.rlo, but I tested
this locally on cargo and it brought the time down from 2.9 to 1.6
seconds.

This also adds back a commented-out test; Rustdoc has been able to deal with `impl trait` for almost a year now.

r? `@GuillaumeGomez`
2021-04-09 13:52:56 +00:00
Timothée Delabrouille
1f7de3fa98 set allow_fail back on each example 2021-04-09 15:41:26 +02:00
Thiébaud Weksteen
52ee9fbc02 android: set abort message
Android has the ability to supply an abort message [1]. This message is
automatically included in the debug trace, which helps debugging [2].
Modify panic_abort to populate this message before calling abort().

[1] https://android.googlesource.com/platform/bionic/+/master/libc/include/android/set_abort_message.h
[2] https://source.android.com/devices/tech/debug/native-crash
2021-04-09 15:33:43 +02:00
Joshua Nelson
f67103b9b2 Add back missing trait test
Rustdoc has been able to deal with `impl trait` for almost a year now.
2021-04-09 09:10:11 -04:00
Joshua Nelson
40ca3521ad rustdoc: Don't generate blanket impls when running --show-coverage
get_blanket_impls is the slowest part of rustdoc, and the coverage pass
completely ignores blanket impls. This stops running it at all, and also
removes some unnecessary checks in `calculate_doc_coverage` that ignored
the impl anyway.

We don't currently measure --show-coverage in perf.rlo, but I tested
this locally on cargo and it brought the time down from 2.9 to 1.6
seconds.
2021-04-09 09:09:19 -04:00
Timothée Delabrouille
4f8dbf66de fix misspelling of register xmm23 which made xmm13 being clobbered twice 2021-04-09 14:08:49 +02:00
Timothée Delabrouille
d58a0de505 conjugation 2021-04-09 12:39:35 +02:00