]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoPretend Duration::MAX was part of duration_saturating_ops
Jubilee Young [Mon, 12 Apr 2021 04:37:46 +0000 (21:37 -0700)]
Pretend Duration::MAX was part of duration_saturating_ops

3 years agoAuto merge of #82300 - andersk:libtest-id, r=Amanieu
bors [Mon, 12 Apr 2021 13:30:30 +0000 (13:30 +0000)]
Auto merge of #82300 - andersk:libtest-id, r=Amanieu

libtest: Index tests by a unique TestId

This more robustly avoids problems with duplicate `TestDesc`. See #81852 and #82274.

Cc `@Mark-Simulacrum.`

3 years agoAuto merge of #84068 - Amanieu:fix_lint, r=lcnr
bors [Mon, 12 Apr 2021 10:49:39 +0000 (10:49 +0000)]
Auto merge of #84068 - Amanieu:fix_lint, r=lcnr

Add `bad_asm_style` to  HardwiredLints

This was missed when the lint was added, which prevents the lint from being ignored with `#[allow]`.

3 years agoAuto merge of #84095 - infinity0:master, r=Mark-Simulacrum
bors [Mon, 12 Apr 2021 08:03:59 +0000 (08:03 +0000)]
Auto merge of #84095 - infinity0:master, r=Mark-Simulacrum

bootstrap: check local_rebuild before adding --cfg=bootstrap, closes #84057

3 years agoAuto merge of #84090 - marmeladema:stabilize-duration-saturating-ops, r=m-ou-se
bors [Mon, 12 Apr 2021 05:44:25 +0000 (05:44 +0000)]
Auto merge of #84090 - marmeladema:stabilize-duration-saturating-ops, r=m-ou-se

Stabilize feature `duration_saturating_ops`

FCP here: https://github.com/rust-lang/rust/issues/76416#issuecomment-817201314

Closes #76416

r? `@m-ou-se`

3 years agoAuto merge of #84085 - m-ou-se:stabilize-atomic-fetch-update, r=kennytm
bors [Mon, 12 Apr 2021 03:13:33 +0000 (03:13 +0000)]
Auto merge of #84085 - m-ou-se:stabilize-atomic-fetch-update, r=kennytm

Stabilize atomic_fetch_update methods on AtomicBool and AtomicPtr.

FCP completed here: https://github.com/rust-lang/rust/issues/78639#issuecomment-817201315

3 years agoAuto merge of #84112 - Dylan-DPC:rollup-tapsrzz, r=Dylan-DPC
bors [Mon, 12 Apr 2021 00:38:20 +0000 (00:38 +0000)]
Auto merge of #84112 - Dylan-DPC:rollup-tapsrzz, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #83669 (Issue 81508 fix)
 - #84014 (Improve trait/impl method discrepancy errors)
 - #84059 (Bump libc dependency of std to 0.2.93)
 - #84067 (clean up example on read_to_string)
 - #84079 (Improve test for `rustdoc::bare_urls` lint)
 - #84094 (Remove FixedSizeArray)
 - #84101 (rustdoc: Move crate loader to collect_intra_doc_links::early )

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRollup merge of #84101 - jyn514:early-pass, r=Manishearth
Dylan DPC [Sun, 11 Apr 2021 23:04:10 +0000 (01:04 +0200)]
Rollup merge of #84101 - jyn514:early-pass, r=Manishearth

rustdoc: Move crate loader to collect_intra_doc_links::early

This groups the similar code together, and also allows making most of collect_intra_doc_links private again.

This builds on https://github.com/rust-lang/rust/pull/84066, but it wouldn't be too hard to base it off master if you want this to land first.
Helps with https://github.com/rust-lang/rust/issues/83761.

r? manishearth

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

3 years agoRollup merge of #84094 - tmiasko:remove-fixed-size-array, r=m-ou-se
Dylan DPC [Sun, 11 Apr 2021 23:04:09 +0000 (01:04 +0200)]
Rollup merge of #84094 - tmiasko:remove-fixed-size-array, r=m-ou-se

Remove FixedSizeArray

Remove `FixedSizeArray` trait, it has been superseded by const generics.

Closes #27778.

3 years agoRollup merge of #84079 - camelid:improve-bare-urls-test, r=jyn514
Dylan DPC [Sun, 11 Apr 2021 23:04:08 +0000 (01:04 +0200)]
Rollup merge of #84079 - camelid:improve-bare-urls-test, r=jyn514

Improve test for `rustdoc::bare_urls` lint

- Rename `url-improvements` test to `bare-urls`
- Run rustfix for `bare-urls` test

3 years agoRollup merge of #84067 - rust-lang:steveklabnik-patch-1, r=joshtriplett
Dylan DPC [Sun, 11 Apr 2021 23:04:07 +0000 (01:04 +0200)]
Rollup merge of #84067 - rust-lang:steveklabnik-patch-1, r=joshtriplett

clean up example on read_to_string

This is the same thing, but simpler.

This came out of a comment from a user: https://news.ycombinator.com/item?id=25318117 but rather than hide the signature of main, I think a `use` plus not including the `'static` makes more sense.

3 years agoRollup merge of #84059 - zvirja:update-libc, r=JohnTitor
Dylan DPC [Sun, 11 Apr 2021 23:04:06 +0000 (01:04 +0200)]
Rollup merge of #84059 - zvirja:update-libc, r=JohnTitor

Bump libc dependency of std to 0.2.93

Update `libc` dependency of `std` to the latest version. That allows to consume the https://github.com/rust-lang/libc/pull/2131 fix and fix build for the `mipsel-unknown-linux-uclibc` target.

r? `@JohnTitor`

3 years agoRollup merge of #84014 - estebank:cool-bears-hot-tip, r=varkor
Dylan DPC [Sun, 11 Apr 2021 23:04:04 +0000 (01:04 +0200)]
Rollup merge of #84014 - estebank:cool-bears-hot-tip, r=varkor

Improve trait/impl method discrepancy errors

* Use more accurate spans
* Clean up some code by removing previous hack
* Provide structured suggestions

Structured suggestions are particularly useful for cases where arbitrary self types are used, like in custom `Future`s, because the way to write `self: Pin<&mut Self>` is not necessarily self-evident when first encountered.

3 years agoRollup merge of #83669 - kwj2104:issue-81508-fix, r=varkor
Dylan DPC [Sun, 11 Apr 2021 23:04:03 +0000 (01:04 +0200)]
Rollup merge of #83669 - kwj2104:issue-81508-fix, r=varkor

Issue 81508 fix

Fix #81508

**Problem**: When variable name is used incorrectly as path, error and warning point to undeclared/unused name, when in fact the name is used, just incorrectly (should be used as a variable, not part of a path).

**Summary for fix**: When path resolution errs, diagnostics checks for variables in ```ValueNS``` that have the same name (e.g., variable rather than path named Foo), and adds additional suggestion that user may actually intend to use the variable name rather than a path.

The fix does not suppress or otherwise change the *warning* that results. I did not find a straightforward way in the code to modify this, but would love to make changes here as well with any guidance.

3 years agoAuto merge of #84100 - sjakobi:77548-reenable-check, r=jyn514
bors [Sun, 11 Apr 2021 22:11:31 +0000 (22:11 +0000)]
Auto merge of #84100 - sjakobi:77548-reenable-check, r=jyn514

tidy: Re-enable the "ignoring line length unnecessarily" check

Closes #77548.

3 years agoMove crate loader to collect_intra_doc_links::early
Joshua Nelson [Sun, 11 Apr 2021 13:28:03 +0000 (09:28 -0400)]
Move crate loader to collect_intra_doc_links::early

This groups the similar code together, and also allows making most of collect_intra_doc_links private again

3 years agoAuto merge of #83482 - hyd-dev:uwtable, r=nagisa
bors [Sun, 11 Apr 2021 19:50:19 +0000 (19:50 +0000)]
Auto merge of #83482 - hyd-dev:uwtable, r=nagisa

Allow using `-C force-unwind-tables=no` when `panic=unwind`

It seems LLVM still generates proper unwind tables even there is no `uwtable` attribute, unless I looked at the wrong place :thinking::
https://github.com/llvm/llvm-project/blob/c21016715f0ee4a36affdf7150ac135ca98b0eae/llvm/include/llvm/IR/Function.h#L666

Therefore, I *assume* it's safe to omit `uwtable` even when `panic=unwind`, and this PR removes the restriction that disallows using `-C force-unwind-tables=no` when `panic=unwind`.

3 years agotidy: Re-enable the "ignoring file length unnecessarily" check
Simon Jakobi [Sun, 11 Apr 2021 14:38:13 +0000 (16:38 +0200)]
tidy: Re-enable the "ignoring file length unnecessarily" check

Closes #77548.

3 years agoAllow using `-C force-unwind-tables=no` when `panic=unwind`
hyd-dev [Thu, 25 Mar 2021 10:49:35 +0000 (18:49 +0800)]
Allow using `-C force-unwind-tables=no` when `panic=unwind`

3 years agoAdd test to allow bad_asm_style
Amanieu d'Antras [Sun, 11 Apr 2021 14:11:02 +0000 (15:11 +0100)]
Add test to allow bad_asm_style

3 years agobootstrap: check local_rebuild before adding --cfg=bootstrap, closes #84057
Ximin Luo [Sun, 11 Apr 2021 13:02:28 +0000 (14:02 +0100)]
bootstrap: check local_rebuild before adding --cfg=bootstrap, closes #84057

3 years agoAuto merge of #81469 - tweksteen:android_set_message, r=m-ou-se
bors [Sun, 11 Apr 2021 12:29:36 +0000 (12:29 +0000)]
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

3 years agoStabilize feature `duration_saturating_ops`
marmeladema [Sun, 11 Apr 2021 10:11:17 +0000 (11:11 +0100)]
Stabilize feature `duration_saturating_ops`

Closes #76416

3 years agoAuto merge of #84063 - LingMan:patch-1, r=nagisa
bors [Sun, 11 Apr 2021 10:04:46 +0000 (10:04 +0000)]
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.

3 years agoStabilize atomic_fetch_update methods on AtomicBool and AtomicPtr.
Mara Bos [Sun, 11 Apr 2021 09:45:46 +0000 (11:45 +0200)]
Stabilize atomic_fetch_update methods on AtomicBool and AtomicPtr.

3 years agoAuto merge of #82608 - Aaron1011:feature/final-preexp-tts, r=petrochenkov
bors [Sun, 11 Apr 2021 07:36:33 +0000 (07:36 +0000)]
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.

3 years agoImplement token-based handling of attributes during expansion
Aaron Hill [Sat, 28 Nov 2020 23:33:17 +0000 (18:33 -0500)]
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.

3 years agoAuto merge of #83806 - JohnTitor:issue-51446, r=estebank
bors [Sun, 11 Apr 2021 05:23:11 +0000 (05:23 +0000)]
Auto merge of #83806 - JohnTitor:issue-51446, r=estebank

Add a regression test for issue-51446

Closes #51446
r? `@estebank`

3 years agoAuto merge of #84071 - nagisa:nixos-patching-fix, r=Mark-Simulacrum
bors [Sun, 11 Apr 2021 02:59:30 +0000 (02:59 +0000)]
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.

3 years agoPreprocess intra-doc links consistently
Joshua Nelson [Sat, 10 Apr 2021 17:48:54 +0000 (13:48 -0400)]
Preprocess intra-doc links consistently

Previously, rustdoc would panic on links to external crates if they were
surrounded by backticks.

3 years agoRun rustfix for `bare-urls` test
Camelid [Sun, 11 Apr 2021 01:39:05 +0000 (18:39 -0700)]
Run rustfix for `bare-urls` test

This will help us ensure that it emits valid suggestions.

3 years agoRename `url-improvements` test to `bare-urls`
Camelid [Thu, 8 Apr 2021 23:06:10 +0000 (16:06 -0700)]
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.

3 years agoAuto merge of #84053 - RalfJung:liballoc-miri, r=Manishearth
bors [Sun, 11 Apr 2021 00:27:23 +0000 (00:27 +0000)]
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`

3 years agoRemove FixedSizeArray
Tomasz Miąsko [Sun, 11 Apr 2021 00:00:00 +0000 (00:00 +0000)]
Remove FixedSizeArray

3 years agoAuto merge of #84023 - Aaron1011:derive-invoc-order, r=petrochenkov
bors [Sat, 10 Apr 2021 22:04:37 +0000 (22:04 +0000)]
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.

3 years agoExpand derive invocations in left-to-right order
Aaron Hill [Fri, 9 Apr 2021 01:35:24 +0000 (21:35 -0400)]
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.

3 years agoFix NixOS patching
Simonas Kazlauskas [Sat, 10 Apr 2021 20:05:28 +0000 (23:05 +0300)]
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.

3 years agoAuto merge of #84016 - Aaron1011:new-preexp-tests, r=petrochenkov
bors [Sat, 10 Apr 2021 19:20:16 +0000 (19:20 +0000)]
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`

3 years agoAdd some proc-macro attribute token handling tests
Aaron Hill [Thu, 8 Apr 2021 21:01:15 +0000 (17:01 -0400)]
Add some proc-macro attribute token handling tests

3 years agoAdd `bad_asm_style` to HardwiredLints
Amanieu d'Antras [Sat, 10 Apr 2021 18:24:24 +0000 (19:24 +0100)]
Add `bad_asm_style` to  HardwiredLints

3 years agoclean up example on read_to_string
Steve Klabnik [Sat, 10 Apr 2021 17:50:04 +0000 (12:50 -0500)]
clean up example on read_to_string

This is the same thing, but simpler.

3 years agoAdd note about reverting a workaround in the future
LingMan [Sat, 10 Apr 2021 16:47:48 +0000 (18:47 +0200)]
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.

3 years agoAuto merge of #84052 - RalfJung:libcore-miri, r=Mark-Simulacrum
bors [Sat, 10 Apr 2021 16:23:35 +0000 (16:23 +0000)]
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.

3 years agoBump libc dependency of std to 0.2.93
Oleksandr Povar [Sat, 10 Apr 2021 14:12:46 +0000 (16:12 +0200)]
Bump libc dependency of std to 0.2.93

3 years agoAuto merge of #84055 - kornelski:z-edition, r=petrochenkov
bors [Sat, 10 Apr 2021 14:00:22 +0000 (14:00 +0000)]
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.

3 years agoDon't tell users to use a nightly flag on the stable channel
Kornel [Sat, 10 Apr 2021 10:46:36 +0000 (11:46 +0100)]
Don't tell users to use a nightly flag on the stable channel

Hint upgrading to a newer Rust version instead

3 years agoAuto merge of #84051 - Amanieu:update_llvm, r=nikic
bors [Sat, 10 Apr 2021 11:17:00 +0000 (11:17 +0000)]
Auto merge of #84051 - Amanieu:update_llvm, r=nikic

Update LLVM submodule

Fixes #84028

3 years agofix incorrect from_raw_in doctest
Ralf Jung [Sat, 10 Apr 2021 10:24:08 +0000 (12:24 +0200)]
fix incorrect from_raw_in doctest

3 years agofix Miri errors in libcore doctests
Ralf Jung [Sat, 10 Apr 2021 09:58:48 +0000 (11:58 +0200)]
fix Miri errors in libcore doctests

3 years agoUpdate LLVM submodule
Amanieu d'Antras [Sat, 10 Apr 2021 09:51:54 +0000 (10:51 +0100)]
Update LLVM submodule

3 years agoAuto merge of #84050 - RalfJung:miri, r=RalfJung
bors [Sat, 10 Apr 2021 09:05:36 +0000 (09:05 +0000)]
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`

3 years agoupdate Miri
Ralf Jung [Sat, 10 Apr 2021 09:03:34 +0000 (11:03 +0200)]
update Miri

3 years agoAuto merge of #84024 - estebank:unclosed-brace-use, r=jackh726
bors [Sat, 10 Apr 2021 03:02:46 +0000 (03:02 +0000)]
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.

3 years agoAuto merge of #84015 - tdelabro:issue-76704-fix, r=Amanieu
bors [Sat, 10 Apr 2021 00:35:38 +0000 (00:35 +0000)]
Auto merge of #84015 - tdelabro:issue-76704-fix, r=Amanieu

doc asm feature - Added new 'Label' section with example and explanations

Fixes #76704

3 years agoAuto merge of #84004 - mattico:print-target-features-improvements, r=petrochenkov
bors [Fri, 9 Apr 2021 21:14:50 +0000 (21:14 +0000)]
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](https://github.com/rust-lang/rust/blob/69e1d22ddbc67b25141a735a22a8895a678b32ca/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

3 years agoAuto merge of #84034 - jyn514:regex-in-loop, r=Mark-Simulacrum
bors [Fri, 9 Apr 2021 18:47:52 +0000 (18:47 +0000)]
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).

3 years agoAvoid `;` -> `,` recovery and unclosed `}` recovery from being too verbose
Esteban Küber [Fri, 9 Apr 2021 02:12:00 +0000 (19:12 -0700)]
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.

3 years agoAuto merge of #81942 - the8472:reduce-ui-test-threads, r=Mark-Simulacrum
bors [Fri, 9 Apr 2021 16:22:23 +0000 (16:22 +0000)]
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

3 years agoCategorize and explain target features support
Matt Ickstadt [Thu, 8 Apr 2021 05:00:47 +0000 (00:00 -0500)]
Categorize and explain target features support

3 years agoFix perf regression in non-autolinks
Joshua Nelson [Fri, 9 Apr 2021 13:58:40 +0000 (09:58 -0400)]
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`.

3 years agoAuto merge of #84030 - jyn514:no-blanket-impls, r=GuillaumeGomez
bors [Fri, 9 Apr 2021 13:52:56 +0000 (13:52 +0000)]
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`

3 years agoset allow_fail back on each example
Timothée Delabrouille [Fri, 9 Apr 2021 13:41:26 +0000 (15:41 +0200)]
set allow_fail back on each example

3 years agoandroid: set abort message
Thiébaud Weksteen [Mon, 15 Mar 2021 10:21:39 +0000 (11:21 +0100)]
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

3 years agoAdd back missing trait test
Joshua Nelson [Fri, 9 Apr 2021 13:10:11 +0000 (09:10 -0400)]
Add back missing trait test

Rustdoc has been able to deal with `impl trait` for almost a year now.

3 years agorustdoc: Don't generate blanket impls when running --show-coverage
Joshua Nelson [Fri, 9 Apr 2021 13:00:12 +0000 (09:00 -0400)]
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.

3 years agofix misspelling of register xmm23 which made xmm13 being clobbered twice
Timothée Delabrouille [Fri, 9 Apr 2021 12:08:49 +0000 (14:08 +0200)]
fix misspelling of register xmm23 which made xmm13 being clobbered twice

3 years agoconjugation
Timothée Delabrouille [Fri, 9 Apr 2021 10:39:35 +0000 (12:39 +0200)]
conjugation

3 years agoremove allow_fail and uncomment the [feature(asm)] on every example
Timothée Delabrouille [Fri, 9 Apr 2021 10:34:30 +0000 (12:34 +0200)]
remove allow_fail and uncomment the [feature(asm)] on every example

3 years agoMerge branch 'issue-76704-fix' of https://github.com/tdelabro/rust into issue-76704-fix
Timothée Delabrouille [Fri, 9 Apr 2021 10:18:18 +0000 (12:18 +0200)]
Merge branch 'issue-76704-fix' of https://github.com/tdelabro/rust into issue-76704-fix
merging

3 years agoprecisions on the authorized labels + typo
Timothée Delabrouille [Fri, 9 Apr 2021 10:18:12 +0000 (12:18 +0200)]
precisions on the authorized labels + typo

3 years agoAuto merge of #84010 - rodrimati1992:patch-3, r=Mark-Simulacrum
bors [Fri, 9 Apr 2021 07:00:31 +0000 (07:00 +0000)]
Auto merge of #84010 - rodrimati1992:patch-3, r=Mark-Simulacrum

Mention missing 1.38.0 change in RELEASES.md

Mention that doc comments on `pub use` statements are prepended to the documentation of the reexported item

Fixes #84007

3 years agoAuto merge of #83956 - estebank:issue-83892, r=varkor
bors [Fri, 9 Apr 2021 04:19:25 +0000 (04:19 +0000)]
Auto merge of #83956 - estebank:issue-83892, r=varkor

Use a more appropriate span for `;` suggestion

Fix #83892.

3 years agoreduce threads spawned by ui-tests
The8472 [Fri, 26 Mar 2021 18:01:55 +0000 (19:01 +0100)]
reduce threads spawned by ui-tests

the test harness already spawns enough tests for all cores, individual
tests should keep their own threading to a minimum to avoid context switch
overhead

some tests fail with 1 CGU, so explicit compile flags have been added
to keep their old behavior

3 years agoAdd unclosed brace in use tree test
Esteban Küber [Fri, 9 Apr 2021 01:35:04 +0000 (18:35 -0700)]
Add unclosed brace in use tree test

3 years agoAuto merge of #83870 - jackh726:binder-refactor-fix, r=nikomatsakis
bors [Fri, 9 Apr 2021 01:50:01 +0000 (01:50 +0000)]
Auto merge of #83870 - jackh726:binder-refactor-fix, r=nikomatsakis

Don't concatenate binders across types

Partially addresses #83737

There's actually two issues that I uncovered in #83737. The first is that we are concatenating bound vars across types, i.e. in
```
F: Fn(&()) -> &mut (dyn Future<Output = ()> + Unpin)
```
the bound vars on `Future` get set as `for<anon>` since those are the binders on `Fn(&()`. This is obviously wrong, since we should only concatenate directly nested trait refs. This is solved here by introducing a new `TraitRefBoundary` scope, that we put around the "syntactical" trait refs and basically don't allow concatenation across.

Now, this alone *shouldn't* be a super terrible problem. At least not until you consider the other issue, which is a much more elusive and harder to design a "perfect" fix. A repro can be seen in:
```
use core::future::Future;

async fn handle<F>(slf: &F)
where
    F: Fn(&()) -> &mut (dyn for<'a> Future<Output = ()> + Unpin),
{
    (slf)(&()).await;
}
```
Notice the `for<'a>` around `Future`. Here, `'a` is unused, so the `for<'a>` Binder gets changed to a `for<>` Binder in the generator witness, but the "local decl" still has it. This has heavy intersections with region anonymization and erasing. Luckily, it's not *super* common to find this unique set of circumstances. It only became apparently because of the first issue mentioned here. However, this *is* still a problem, so I'm leaving #83737 open.

r? `@nikomatsakis`

3 years agoAuto merge of #83941 - wesleywiser:win_dbginfo_closures, r=nagisa
bors [Thu, 8 Apr 2021 23:09:06 +0000 (23:09 +0000)]
Auto merge of #83941 - wesleywiser:win_dbginfo_closures, r=nagisa

Improve debuginfo for closures and async functions on Windows MSVC

The issue was that the resulting debuginfo was too complex for LLVM to
translate into CodeView records correctly. As a result, it simply
ignored the debuginfo which meant Windows debuggers could not display
any closed over variables when stepping inside a closure or async fn.

This fixes that by creating additional allocas on the stack so that
the resulting debuginfo is simple (just `*my_variable.dbg.spill`) and
LLVM can generate the correct CV records.

I also updated some of our existing tests to run in CDB to cover this case.

Before (closure):

![image](https://user-images.githubusercontent.com/831192/113756857-e6dc4200-96df-11eb-8d6d-b7ed7a84aad5.png)

After (closure):

![image](https://user-images.githubusercontent.com/831192/113757067-2e62ce00-96e0-11eb-89f7-7dc8ab89b1b8.png)

Before (async):

![image](https://user-images.githubusercontent.com/831192/114077916-4e2bfa80-9876-11eb-9f15-e302d1faa652.png)

After (async):

![image](https://user-images.githubusercontent.com/831192/114077677-0d33e600-9876-11eb-8ce3-cac20a9ea94a.png)

Fixes #83709

3 years agoProvide verbose suggestion for new output type
Esteban Küber [Thu, 8 Apr 2021 22:54:26 +0000 (15:54 -0700)]
Provide verbose suggestion for new output type

3 years agoSuggest return type
Esteban Küber [Thu, 8 Apr 2021 22:27:43 +0000 (15:27 -0700)]
Suggest return type

3 years agoadd 'allow_fail' to example
Timothée [Thu, 8 Apr 2021 22:09:14 +0000 (00:09 +0200)]
add 'allow_fail' to example

3 years agoNew 'Label' section with example and explainations
Timothée Delabrouille [Thu, 8 Apr 2021 21:06:21 +0000 (23:06 +0200)]
New 'Label' section with example and explainations

3 years agoSuggest changing impl parameter types to match trait
Esteban Küber [Thu, 8 Apr 2021 20:50:47 +0000 (13:50 -0700)]
Suggest changing impl parameter types to match trait

This is particularly useful for cases where arbitrary self types are
used, like in custom `Future`s.

3 years agoAuto merge of #84008 - Dylan-DPC:rollup-invxvg8, r=Dylan-DPC
bors [Thu, 8 Apr 2021 19:38:54 +0000 (19:38 +0000)]
Auto merge of #84008 - Dylan-DPC:rollup-invxvg8, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #80733 (Improve links in inline code in `core::pin`.)
 - #81764 (Stabilize `rustdoc::bare_urls` lint)
 - #81938 (Stabilize `peekable_peek_mut`)
 - #83980 (Fix outdated crate names in compiler docs)
 - #83992 (Merge idents when generating source content)
 - #84001 (Update Clippy)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoMention missing 1.38.0 change in RELEASES.md
rodrimati1992 [Thu, 8 Apr 2021 19:29:05 +0000 (16:29 -0300)]
Mention missing 1.38.0 change in RELEASES.md

Mention that doc comments on `pub use` statements are prepended to the documentation of the reexported item

3 years agoRollup merge of #84001 - flip1995:clippyup, r=Manishearth
Dylan DPC [Thu, 8 Apr 2021 18:30:01 +0000 (20:30 +0200)]
Rollup merge of #84001 - flip1995:clippyup, r=Manishearth

Update Clippy

Biweekly Clippy update

r? ``@Manishearth``

3 years agoRollup merge of #83992 - GuillaumeGomez:merge-idents, r=notriddle
Dylan DPC [Thu, 8 Apr 2021 18:29:59 +0000 (20:29 +0200)]
Rollup merge of #83992 - GuillaumeGomez:merge-idents, r=notriddle

Merge idents when generating source content

The idea here is to not have a span for each part of a path. Currently, for `a::b::c` we generate `<span>a</span>::<span>b</span>::<span>c</span>`, with this change, we will generate `<span>a::b::c</span>`.

A nice "side-effect" is that it reduces the size of the output HTML too. :)

cc `@notriddle`

3 years agoRollup merge of #83980 - pierwill:fix-compiler-librustc-names, r=davidtwco
Dylan DPC [Thu, 8 Apr 2021 18:29:58 +0000 (20:29 +0200)]
Rollup merge of #83980 - pierwill:fix-compiler-librustc-names, r=davidtwco

Fix outdated crate names in compiler docs

Changes `librustc_X` to `rustc_X`, only in documentation comments.
Plain code comments are left unchanged.

3 years agoRollup merge of #81938 - lukaslueg:stab_peek_mut, r=Amanieu
Dylan DPC [Thu, 8 Apr 2021 18:29:57 +0000 (20:29 +0200)]
Rollup merge of #81938 - lukaslueg:stab_peek_mut, r=Amanieu

Stabilize `peekable_peek_mut`

Resolves #78302. Also adds some documentation on `std::iter::Iterator::peekable()` regarding the new method.

The feature was added in #77491 in Nov' 20, which is recently, but the feature seems reasonably small. Never did a stabilization-pr, excuse my ignorance if there is a protocol I'm not aware of.

3 years agoRollup merge of #81764 - jyn514:lint-links, r=GuillaumeGomez
Dylan DPC [Thu, 8 Apr 2021 18:29:56 +0000 (20:29 +0200)]
Rollup merge of #81764 - jyn514:lint-links, r=GuillaumeGomez

Stabilize `rustdoc::bare_urls` lint

Closes https://github.com/rust-lang/rust/issues/77501. Closes https://github.com/rust-lang/rust/issues/83598.

3 years agoRollup merge of #80733 - steffahn:prettify_pin_links, r=jyn514
Dylan DPC [Thu, 8 Apr 2021 18:29:54 +0000 (20:29 +0200)]
Rollup merge of #80733 - steffahn:prettify_pin_links, r=jyn514

Improve links in inline code in `core::pin`.

## Context

So I recently opened #80720. That PR uses HTML-based `<code>foo</code>` syntax in place of `` `foo` `` for some inline code. It looks like usage of `<code>` tags in doc comments is without precedent in the standard library, but the HTML-based syntax has an important advantage:

You can write something like
```
<code>[Box]<[Option]\<T>></code>
```
which becomes: <code>[Box]<[Option]\<T>></code>, whereas with ordinary backtick syntax, you cannot create links for a substring of an inline code block.

## Problem
I recalled (from my own experience) that a way to partially work around this limitation is to do something like
```
[`Box`]`<`[`Option`]`<T>>`
```
which looks like this: [`Box`]`<`[`Option`]`<T>>` _(admitted, it looks even worse on GitHub than in `rustdoc`’s CSS)_.

[Box]: https://doc.rust-lang.org/std/boxed/struct.Box.html "Box"
[`Box`]: https://doc.rust-lang.org/std/boxed/struct.Box.html "Box"
[Option]: https://doc.rust-lang.org/std/option/enum.Option.html "Option"
[`Option`]: https://doc.rust-lang.org/std/option/enum.Option.html "Option"
[Pin]: https://doc.rust-lang.org/std/pin/struct.Pin.html "Pin"
[&mut]: https://doc.rust-lang.org/std/primitive.reference.html "mutable reference"

So I searched the standard library and found that e.g. the [std::pin](https://doc.rust-lang.org/std/pin/index.html) module documentation uses this hack/workaround quite a bit, with types like <code>[Pin]<[Box]\<T>></code> or <code>[Pin]<[&mut] T>></code>. Although the way they look like in this sentence is what I would like them to look like, not what they currently look.

### Status Quo

Here’s a screenshot of what it currently looks like:
![Screenshot_20210105_202751](https://user-images.githubusercontent.com/3986214/103692608-4a978780-4f98-11eb-9451-e13622b2e3c0.png)

With a few HTML-style code blocks, we can fix all the spacing issues in the above screenshot that are due usage of this hack/workaround of putting multiple code blocks right next to each other being used.

### after d3915c555ee016b11ce288e107e46dbab9f78c4f:
![Screenshot_20210105_202932](https://user-images.githubusercontent.com/3986214/103692688-6f8bfa80-4f98-11eb-9be5-9b370eaef644.png)

There’s still a problem of inconsistency. Especially in a sentence such as
> A [`Pin<P>`][Pin] where `P: Deref` should be considered as a "`P`-style pointer" to _[...]_

looks weird with the variable `P` having different colors (and `Deref` has a different color from before where it was a link, too). Or compare the difference of <code>[Pin]<[Box]\<T>></code> vs [`Box<T>`][Box] where one time the variable is part of the link and the other time it isn’t.

_Note: Color differences show even **more strongly** when the ayu theme is used, while they are a bit less prominent in the light theme than they are in the dark theme, which is the one used for these screenshots._

This is why I’ve added the next commit
### after ceaeb249a3813a78bd81fa3890e27e8843a58262
![Screenshot_20210105_203113](https://user-images.githubusercontent.com/3986214/103693496-ab738f80-4f99-11eb-942d-29dace459734.png)
pulling all the type parameters out of their links, and also the last commit with clearly visible changes
### after 87ac118ba3d0c8268e043fadbd63b51e06904795
![Screenshot_20210105_203252](https://user-images.githubusercontent.com/3986214/103693625-e5dd2c80-4f99-11eb-91b7-470c37934e7e.png)
where more links are added, removing e.g. the inconsistency with `Deref`’s color in e.g. `P: Deref` that I already mentioned above.

## Discussion

I am aware that this PR may very well be overkill. If for now only the first commit (plus the fix for the `Drop` link in e65385fbfa72995b27ec64aa54f330cf503dfc03, the link titles 684edf7a70d2e90466ae74e7a321670259bf3fd9 as far as they apply, and a few of the line-break changes) are wanted, I can reduce this PR to just those changes. I personally find the rendered result with all these changes very nice though. On the other hand, all these `<code>` tags are not very nice in the source code, I’ll admit.

Perhaps alternative solutions could be preferred, such as `rustdoc` support for merging subsequent inline code blocks so that all the cases that currently use workarounds rendered as [`Box`]`<`[`Option`]`<T>>` automatically become <code>[Box]<[Option]\<T>></code> without any need for further changes. Even in this case, having a properly formatted, better looking example in the standard library docs could help motivate such a change to `rustdoc` by prodiving an example of the expected results and also the already existing alternative (i.e. using `<code>`). On the other hand, `` [`Box`]`<`[`Option`]`<T>>` `` isn’t particularly nice-looking source code either. I’m not even sure if I wouldn’t actually find the version `<code>[Box]<[Option]\<T>></code>` cleaner to read.

`@rustbot` modify labels: T-doc, T-rustdoc

3 years agoFix closed over variables not available in debuginfo for Windows MSVC
Wesley Wiser [Tue, 6 Apr 2021 17:34:17 +0000 (13:34 -0400)]
Fix closed over variables not available in debuginfo for Windows MSVC

The issue was that the resulting debuginfo was too complex for LLVM to
translate into CodeView records correctly. As a result, it simply
ignored the debuginfo which meant Windows debuggers could not display
any closed over variables when stepping inside a closure.

This fixes that by spilling additional variables to the stack so that
the resulting debuginfo is simple (just `*my_variable.dbg.spill`) and
LLVM can generate the correct CV records.

3 years agoUse more accurate spans for trait/impl method arg divergence
Esteban Küber [Thu, 8 Apr 2021 17:16:15 +0000 (10:16 -0700)]
Use more accurate spans for trait/impl method arg divergence

3 years agoAuto merge of #83763 - alexcrichton:wasm-multivalue-abi, r=nagisa
bors [Thu, 8 Apr 2021 17:11:42 +0000 (17:11 +0000)]
Auto merge of #83763 - alexcrichton:wasm-multivalue-abi, r=nagisa

rustc: Add a new `wasm` ABI

This commit implements the idea of a new ABI for the WebAssembly target,
one called `"wasm"`. This ABI is entirely of my own invention
and has no current precedent, but I think that the addition of this ABI
might help solve a number of issues with the WebAssembly targets.

When `wasm32-unknown-unknown` was first added to Rust I naively
"implemented an abi" for the target. I then went to write `wasm-bindgen`
which accidentally relied on details of this ABI. Turns out the ABI
definition didn't match C, which is causing issues for C/Rust interop.
Currently the compiler has a "wasm32 bindgen compat" ABI which is the
original implementation I added, and it's purely there for, well,
`wasm-bindgen`.

Another issue with the WebAssembly target is that it's not clear to me
when and if the default C ABI will change to account for WebAssembly's
multi-value feature (a feature that allows functions to return multiple
values). Even if this does happen, though, it seems like the C ABI will
be guided based on the performance of WebAssembly code and will likely
not match even what the current wasm-bindgen-compat ABI is today. This
leaves a hole in Rust's expressivity in binding WebAssembly where given
a particular import type, Rust may not be able to import that signature
with an updated C ABI for multi-value.

To fix these issues I had the idea of a new ABI for WebAssembly, one
called `wasm`. The definition of this ABI is "what you write
maps straight to wasm". The goal here is that whatever you write down in
the parameter list or in the return values goes straight into the
function's signature in the WebAssembly file. This special ABI is for
intentionally matching the ABI of an imported function from the
environment or exporting a function with the right signature.

With the addition of a new ABI, this enables rustc to:

* Eventually remove the "wasm-bindgen compat hack". Once this multivalue
  ABI is stable wasm-bindgen can switch to using it everywhere.
  Afterwards the wasm32-unknown-unknown target can have its default ABI
  updated to match C.

* Expose the ability to precisely match an ABI signature for a
  WebAssembly function, regardless of what the C ABI that clang chooses
  turns out to be.

* Continue to evolve the definition of the default C ABI to match what
  clang does on all targets, since the purpose of that ABI will be
  explicitly matching C rather than generating particular function
  imports/exports.

Naturally this is implemented as an unstable feature initially, but it
would be nice for this to get stabilized (if it works) in the near-ish
future to remove the wasm32-unknown-unknown incompatibility with the C
ABI. Doing this, however, requires the feature to be on stable because
wasm-bindgen works with stable Rust.

3 years agoFix outdated crate names in compiler docs
pierwill [Wed, 7 Apr 2021 19:47:01 +0000 (14:47 -0500)]
Fix outdated crate names in compiler docs

Changes `librustc_X` to `rustc_X`, only in documentation comments.
Plain code comments are left unchanged.

Also fix incorrect file paths.

3 years agoMerge commit 'b40ea209e7f14c8193ddfc98143967b6a2f4f5c9' into clippyup
flip1995 [Thu, 8 Apr 2021 15:50:13 +0000 (17:50 +0200)]
Merge commit 'b40ea209e7f14c8193ddfc98143967b6a2f4f5c9' into clippyup

3 years agoAuto merge of #7051 - flip1995:rustup, r=flip1995
bors [Thu, 8 Apr 2021 15:46:38 +0000 (15:46 +0000)]
Auto merge of #7051 - flip1995:rustup, r=flip1995

Rustup

changelog: none

r? `@ghost`

3 years agoBump nightly version -> 2021-04-08
flip1995 [Thu, 8 Apr 2021 15:37:06 +0000 (17:37 +0200)]
Bump nightly version -> 2021-04-08

3 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Thu, 8 Apr 2021 15:18:19 +0000 (17:18 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

3 years agorustc: Add a new `wasm` ABI
Alex Crichton [Thu, 1 Apr 2021 23:08:29 +0000 (16:08 -0700)]
rustc: Add a new `wasm` ABI

This commit implements the idea of a new ABI for the WebAssembly target,
one called `"wasm"`. This ABI is entirely of my own invention
and has no current precedent, but I think that the addition of this ABI
might help solve a number of issues with the WebAssembly targets.

When `wasm32-unknown-unknown` was first added to Rust I naively
"implemented an abi" for the target. I then went to write `wasm-bindgen`
which accidentally relied on details of this ABI. Turns out the ABI
definition didn't match C, which is causing issues for C/Rust interop.
Currently the compiler has a "wasm32 bindgen compat" ABI which is the
original implementation I added, and it's purely there for, well,
`wasm-bindgen`.

Another issue with the WebAssembly target is that it's not clear to me
when and if the default C ABI will change to account for WebAssembly's
multi-value feature (a feature that allows functions to return multiple
values). Even if this does happen, though, it seems like the C ABI will
be guided based on the performance of WebAssembly code and will likely
not match even what the current wasm-bindgen-compat ABI is today. This
leaves a hole in Rust's expressivity in binding WebAssembly where given
a particular import type, Rust may not be able to import that signature
with an updated C ABI for multi-value.

To fix these issues I had the idea of a new ABI for WebAssembly, one
called `wasm`. The definition of this ABI is "what you write
maps straight to wasm". The goal here is that whatever you write down in
the parameter list or in the return values goes straight into the
function's signature in the WebAssembly file. This special ABI is for
intentionally matching the ABI of an imported function from the
environment or exporting a function with the right signature.

With the addition of a new ABI, this enables rustc to:

* Eventually remove the "wasm-bindgen compat hack". Once this
  ABI is stable wasm-bindgen can switch to using it everywhere.
  Afterwards the wasm32-unknown-unknown target can have its default ABI
  updated to match C.

* Expose the ability to precisely match an ABI signature for a
  WebAssembly function, regardless of what the C ABI that clang chooses
  turns out to be.

* Continue to evolve the definition of the default C ABI to match what
  clang does on all targets, since the purpose of that ABI will be
  explicitly matching C rather than generating particular function
  imports/exports.

Naturally this is implemented as an unstable feature initially, but it
would be nice for this to get stabilized (if it works) in the near-ish
future to remove the wasm32-unknown-unknown incompatibility with the C
ABI. Doing this, however, requires the feature to be on stable because
wasm-bindgen works with stable Rust.

3 years agoadd comments
Niko Matsakis [Thu, 8 Apr 2021 14:56:03 +0000 (10:56 -0400)]
add comments

3 years agoAuto merge of #83500 - camelid:split-debuginfo-docs-cleanup, r=steveklabnik
bors [Thu, 8 Apr 2021 14:38:31 +0000 (14:38 +0000)]
Auto merge of #83500 - camelid:split-debuginfo-docs-cleanup, r=steveklabnik

Fix some typos in docs for `-C split-debuginfo`