]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRollup merge of #83438 - CDirkx:releases, r=Mark-Simulacrum
Dylan DPC [Tue, 13 Apr 2021 09:10:38 +0000 (11:10 +0200)]
Rollup merge of #83438 - CDirkx:releases, r=Mark-Simulacrum

Update RELEASES.md

A couple of things that were missing in the release notes:

- `Div` and `Rem` by their `NonZero` variant is now implemented for all unsigned integers (#79134)
- Stabilization of `VecDeque::range` and `VecDeque::range_mut` (#79022, stabilization version corrected to 1.51.0 #80448)
- Deprecation of `spin_loop_hint` (#80966)

3 years agoAuto merge of #84086 - m-ou-se:stabilze-is-subnormal, r=dtolnay
bors [Tue, 13 Apr 2021 05:59:10 +0000 (05:59 +0000)]
Auto merge of #84086 - m-ou-se:stabilze-is-subnormal, r=dtolnay

Stabilize is_subnormal.

FCP completed here: https://github.com/rust-lang/rust/issues/79288#issuecomment-817201311

3 years agoAuto merge of #84082 - andjo403:stabilize_nonzero_leading_trailing_zeros, r=m-ou-se
bors [Tue, 13 Apr 2021 03:18:10 +0000 (03:18 +0000)]
Auto merge of #84082 - andjo403:stabilize_nonzero_leading_trailing_zeros, r=m-ou-se

Stabilize nonzero_leading_trailing_zeros

Stabilizing nonzero_leading_trailing_zeros and due to this also stabilizing the intrinsic cttz_nonzero

FCP finished here: https://github.com/rust-lang/rust/issues/79143#issuecomment-817216153
`@rustbot` modify labels: +T-libs

Closes #79143

3 years agoAuto merge of #82992 - philippeitis:stabilize_bufreader_seek_relative, r=workingjubilee
bors [Tue, 13 Apr 2021 00:52:00 +0000 (00:52 +0000)]
Auto merge of #82992 - philippeitis:stabilize_bufreader_seek_relative, r=workingjubilee

Stabilize `bufreader_seek_relative`

This PR marks `BufReader::seek_relative` as stable - the associated issue, #31100, has passed the final comment period without any issues, and from what I understand, the only thing left to stabilize this is to submit a PR marking the method as stable.

Closes #31100.

3 years agoAuto merge of #82918 - Manishearth:edition-2015-warn, r=oli-obk
bors [Mon, 12 Apr 2021 22:26:15 +0000 (22:26 +0000)]
Auto merge of #82918 - Manishearth:edition-2015-warn, r=oli-obk

Turn old edition lint (anonymous-parameters) into warn-by-default on 2015

This makes `anonymous_parameters` <s>and `keyword_idents` </s>warn-by-default on the 2015 edition. I would also like to do this for `absolute_paths_not_starting_with_crate`, but I feel that case is slightly less clear-cut.

Note that this only affects code on the 2015 edition, such code is illegal in future editions anyway.

This was spurred by https://github.com/dtolnay/syn/issues/972: old edition syntax breaks tooling (like syn), and while the tooling should be free to find its balance on how much to support prior editions, it does seem like we should be nudging such code towards the newer edition, and we can do that by turning this Allow lint into a Warn.

In general, I feel like migration lints from an old edition should be made Warn after a year or so, and idiom lints for the new edition should be made Warn after a couple months.

cc `@m-ou-se,` this is for stuff from the 2015-2018 migration but you might be interested.

3 years agoAuto merge of #83776 - jyn514:update-stdarch-docs, r=Amanieu
bors [Mon, 12 Apr 2021 18:29:25 +0000 (18:29 +0000)]
Auto merge of #83776 - jyn514:update-stdarch-docs, r=Amanieu

Update stdarch submodule (to before it switched to const generics)

https://github.com/rust-lang/rust/pull/83278#issuecomment-812389823: This unblocks #82539.

Major changes:
- More AVX-512 intrinsics.
- More ARM & AArch64 NEON intrinsics.
- Updated unstable WASM intrinsics to latest draft standards.
- std_detect is now a separate crate instead of a submodule of std.

I double-checked and the first use of const generics looks like https://github.com/rust-lang/stdarch/commit/8d5017861ed594a2baf169e632379862d516e013, which isn't included in this PR.

r? `@Amanieu`

3 years agoTurn old edition lints (anonymous-parameters, keyword-idents) into warn-by-default...
Manish Goregaokar [Mon, 8 Mar 2021 23:43:18 +0000 (15:43 -0800)]
Turn old edition lints (anonymous-parameters, keyword-idents) into warn-by-default on 2015

3 years agoAuto merge of #84103 - calebcartwright:bump-rls-rustfmt, r=Xanewok
bors [Mon, 12 Apr 2021 15:59:35 +0000 (15:59 +0000)]
Auto merge of #84103 - calebcartwright:bump-rls-rustfmt, r=Xanewok

update RLS and rustfmt

Fixes #83460 and fixes #83459

cc `@Xanewok`

3 years agoupdate RLS and rustfmt
Caleb Cartwright [Sun, 11 Apr 2021 16:42:01 +0000 (11:42 -0500)]
update RLS and rustfmt

3 years agoUpdate stdarch submodule (to before it switched to const generics)
Joshua Nelson [Fri, 2 Apr 2021 08:11:46 +0000 (04:11 -0400)]
Update stdarch submodule (to before it switched to const generics)

This also includes a cherry-pick of
https://github.com/rust-lang/stdarch/commit/ec1461905b421cf0c56adeebb49bbf55bb33fd17
and https://github.com/rust-lang/stdarch/pull/1108 to fix a build
failure.

It also adds a re-export of various macros to the crate root of libstd -
previously they would show up automatically because std_detect was defined
in the same crate.

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 agoStabilize nonzero_leading_trailing_zeros
Andreas Jonson [Sun, 11 Apr 2021 17:15:55 +0000 (19:15 +0200)]
Stabilize nonzero_leading_trailing_zeros

3 years agostabilize const_cttz
Andreas Jonson [Sun, 11 Apr 2021 16:38:05 +0000 (18:38 +0200)]
stabilize const_cttz

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 is_subnormal.
Mara Bos [Sun, 11 Apr 2021 09:48:26 +0000 (11:48 +0200)]
Stabilize is_subnormal.

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.