]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoAuto merge of #90617 - tmiasko:time-trace-threads, r=wesleywiser
bors [Sat, 6 Nov 2021 09:55:50 +0000 (09:55 +0000)]
Auto merge of #90617 - tmiasko:time-trace-threads, r=wesleywiser

Initialize LLVM time trace profiler on each code generation thread

In https://reviews.llvm.org/D71059 LLVM 11, the time trace profiler was
extended to support multiple threads.

`timeTraceProfilerInitialize` creates a thread local profiler instance.
When a thread finishes `timeTraceProfilerFinishThread` moves a thread
local instance into a global collection of instances. Finally when all
codegen work is complete `timeTraceProfilerWrite` writes data from the
current thread local instance and the instances in global collection
of instances.

Previously, the profiler was intialized on a single thread only. Since
this thread performs no code generation on its own, the resulting
profile was empty.

Update LLVM codegen to initialize & finish time trace profiler on each
code generation thread.

cc `@tmandry`
r? `@wesleywiser`

2 years agoAuto merge of #90297 - dtolnay:dotzero, r=petrochenkov
bors [Sat, 6 Nov 2021 07:15:05 +0000 (07:15 +0000)]
Auto merge of #90297 - dtolnay:dotzero, r=petrochenkov

Append .0 to unsuffixed float if it would otherwise become int token

Previously the unsuffixed f32/f64 constructors of `proc_macro::Literal` would create literal tokens that are definitely not a float:

```rust
Literal::f32_unsuffixed(10.0)  // 10
Literal::f32_suffixed(10.0)    // 10f32
Literal::f64_unsuffixed(10.0)  // 10
Literal::f64_suffixed(10.0)    // 10f64
```

Notice that the `10` are actually integer tokens if you were to reparse them, not float tokens.

This diff updates `Literal::f32_unsuffixed` and `Literal::f64_unsuffixed` to produce tokens that unambiguously parse as a float. This matches longstanding behavior of the proc-macro2 crate's implementation of these APIs dating back at least 3.5 years, so it's likely an unobjectionable behavior.

```rust
Literal::f32_unsuffixed(10.0)  // 10.0
Literal::f32_suffixed(10.0)    // 10f32
Literal::f64_unsuffixed(10.0)  // 10.0
Literal::f64_suffixed(10.0)    // 10f64
```

Fixes https://github.com/dtolnay/syn/issues/1085.

2 years agoAuto merge of #89970 - jackh726:gats_diagnostics, r=nikomatsakis
bors [Sat, 6 Nov 2021 04:15:22 +0000 (04:15 +0000)]
Auto merge of #89970 - jackh726:gats_diagnostics, r=nikomatsakis

Implementation of GATs outlives lint

See #87479 for background. Closes #87479

The basic premise of this lint/error is to require the user to write where clauses on a GAT when those bounds can be implied or proven from any function on the trait returning that GAT.

## Intuitive Explanation (Attempt) ##
Let's take this trait definition as an example:
```rust
trait Iterable {
    type Item<'x>;
    fn iter<'a>(&'a self) -> Self::Item<'a>;
}
```
Let's focus on the `iter` function. The first thing to realize is that we know that `Self: 'a` because of `&'a self`. If an impl wants `Self::Item` to contain any data with references, then those references must be derived from `&'a self`. Thus, they must live only as long as `'a`. Furthermore, because of the `Self: 'a` implied bound, they must live only as long as `Self`. Since it's `'a` is used in place of `'x`, it is reasonable to assume that any value of `Self::Item<'x>`, and thus `'x`, will only be able to live as long as `Self`. Therefore, we require this bound on `Item` in the trait.

As another example:
```rust
trait Deserializer<T> {
    type Out<'x>;
    fn deserialize<'a>(&self, input: &'a T) -> Self::Out<'a>;
}
```
The intuition is similar here, except rather than a `Self: 'a` implied bound, we have a `T: 'a` implied bound. Thus, the data on `Self::Out<'a>` is derived from `&'a T`, and thus it is reasonable to expect that the lifetime `'x` will always be less than `T`.

## Implementation Algorithm ##
* Given a GAT `<P0 as Trait<P1..Pi>>::G<Pi...Pn>` declared as `trait T<A1..Ai> for A0 { type G<Ai...An>; }` used in return type of one associated function `F`
* Given env `E` (including implied bounds) for `F`
* For each lifetime parameter `'a` in `P0...Pn`:
    * For each other type parameter `Pi != 'a` in `P0...Pn`: // FIXME: this include of lifetime parameters too
        * If `E => (P: 'a)`:
            * Require where clause `Ai: 'a`

## Follow-up questions ##
* What should we do when we don't pass params exactly?
For this example:
```rust
trait Des {
    type Out<'x, D>;
    fn des<'z, T>(&self, data: &'z Wrap<T>) -> Self::Out<'z, Wrap<T>>;
}
```
Should we be requiring a `D: 'x` clause? We pass `Wrap<T>` as `D` and `'z` as `'x`, and should be able to prove that `Wrap<T>: 'z`.

r? `@nikomatsakis`

2 years agoReview comments
jackh726 [Sat, 6 Nov 2021 01:33:14 +0000 (21:33 -0400)]
Review comments

2 years agoAuto merge of #88441 - jackh726:closure_norm, r=nikomatsakis
bors [Sat, 6 Nov 2021 01:12:39 +0000 (01:12 +0000)]
Auto merge of #88441 - jackh726:closure_norm, r=nikomatsakis

Normalize obligations for closure confirmation

Based on #90017

Fixes #74261
Fixes #71955
Fixes #88459

r? `@nikomatsakis`

2 years agoAuto merge of #90631 - matthiaskrgr:rollup-a5tzjh3, r=matthiaskrgr
bors [Fri, 5 Nov 2021 22:12:31 +0000 (22:12 +0000)]
Auto merge of #90631 - matthiaskrgr:rollup-a5tzjh3, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #89942 (Reorder `widening_impl`s to make the doc clearer)
 - #90569 (Fix tests using `only-i686` to use the correct `only-x86` directive)
 - #90597 (Warn for variables that are no longer captured)
 - #90623 (Remove more checks for LLVM < 12)
 - #90626 (Properly register text_direction_codepoint_in_comment lint.)

Failed merges:

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

2 years agoRollup merge of #90626 - rusticstuff:be-more-accepting, r=jyn514
Matthias Krüger [Fri, 5 Nov 2021 20:12:31 +0000 (21:12 +0100)]
Rollup merge of #90626 - rusticstuff:be-more-accepting, r=jyn514

Properly register text_direction_codepoint_in_comment lint.

This makes it known to the compiler so it can be configured like with `#![allow(text_direction_codepoint_in_comment)]`.

Fixes #90614.

2 years agoRollup merge of #90623 - cuviper:llvm-12, r=nikic
Matthias Krüger [Fri, 5 Nov 2021 20:12:30 +0000 (21:12 +0100)]
Rollup merge of #90623 - cuviper:llvm-12, r=nikic

Remove more checks for LLVM < 12

We already updated the minimum to 12 in #90175, but we missed a few `get_version()` checks.

2 years agoRollup merge of #90597 - nikomatsakis:issue-90465, r=wesleywiser
Matthias Krüger [Fri, 5 Nov 2021 20:12:29 +0000 (21:12 +0100)]
Rollup merge of #90597 - nikomatsakis:issue-90465, r=wesleywiser

Warn for variables that are no longer captured

r? `@wesleywiser`

cc `@rust-lang/wg-rfc-2229`

Fixes #90465

2 years agoRollup merge of #90569 - wesleywiser:fix_only_i686_tests, r=Mark-Simulacrum
Matthias Krüger [Fri, 5 Nov 2021 20:12:28 +0000 (21:12 +0100)]
Rollup merge of #90569 - wesleywiser:fix_only_i686_tests, r=Mark-Simulacrum

Fix tests using `only-i686` to use the correct `only-x86` directive

We translate `i686` to `x86` which means tests marked as `only-i686`
never ran. Update those tests to use `only-x86`.

We parse the `only-` architecture directive here

https://github.com/rust-lang/rust/blob/27143a9094b55a00d5f440b05b0cb4233b300d33/src/tools/compiletest/src/util.rs#L160-L168

and we translate `i686` to `x86` here

https://github.com/rust-lang/rust/blob/27143a9094b55a00d5f440b05b0cb4233b300d33/src/tools/compiletest/src/util.rs#L56

2 years agoRollup merge of #89942 - JohnTitor:reorder-widening_impl, r=dtolnay
Matthias Krüger [Fri, 5 Nov 2021 20:12:28 +0000 (21:12 +0100)]
Rollup merge of #89942 - JohnTitor:reorder-widening_impl, r=dtolnay

Reorder `widening_impl`s to make the doc clearer

Fixes #88736
This moves `{widening,carrying}_mul`s to the bottom to place consts on the top.

2 years agoUpdate LLVM comments around NoAliasMutRef
Josh Stone [Fri, 5 Nov 2021 19:22:51 +0000 (12:22 -0700)]
Update LLVM comments around NoAliasMutRef

2 years agoProperly register text_direction_codepoint_in_comment lint.
Hans Kratz [Fri, 5 Nov 2021 18:59:06 +0000 (19:59 +0100)]
Properly register text_direction_codepoint_in_comment lint.

2 years agoAdd test to confirm fnn_unsuffixed does not emit exponent notation
David Tolnay [Fri, 5 Nov 2021 18:48:28 +0000 (11:48 -0700)]
Add test to confirm fnn_unsuffixed does not emit exponent notation

2 years agoAuto merge of #90583 - willcrichton:example-analyzer, r=jyn514
bors [Fri, 5 Nov 2021 19:05:36 +0000 (19:05 +0000)]
Auto merge of #90583 - willcrichton:example-analyzer, r=jyn514

Fix ICE when rustdoc is scraping examples inside of a proc macro

This PR provides a clearer semantics for how --scrape-examples interacts with macros. If an expression's span AND it's enclosing item's span both are not `from_expansion`, then the example will be scraped. The added test case `rustdoc-scrape-examples-macros` shows a variety of situations.

* A macro-rules macro that takes a function call as input: good
* A macro-rules macro that generates a function call as output: bad
* A proc-macro that generates a function call as output: bad
* An attribute macro that generates a function call as output: bad
* An attribute macro that takes a function call as input: good, if the proc macro is designed to propagate the input spans

I ran this updated rustdoc on pyo3 and confirmed that it successfully scrapes examples from inside a proc macro, eg

<img width="1013" alt="Screen Shot 2021-11-04 at 1 11 28 PM" src="https://user-images.githubusercontent.com/663326/140412691-81a3bb6b-a448-4a1b-a293-f7a795553634.png">

(cc `@mejrs)`

Additionally, this PR fixes an ordering bug in the highlighting logic.

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

r? `@jyn514`

2 years agoUpdate the documented default of -Zmutable-noalias
Josh Stone [Fri, 5 Nov 2021 19:01:59 +0000 (12:01 -0700)]
Update the documented default of -Zmutable-noalias

2 years agoReorder `widening_impl`s to make the doc clearer
Yuki Okushi [Sat, 16 Oct 2021 08:00:03 +0000 (17:00 +0900)]
Reorder `widening_impl`s to make the doc clearer

2 years agoMove outline-atomics to aarch64-linux target definitions
Josh Stone [Fri, 5 Nov 2021 17:28:12 +0000 (10:28 -0700)]
Move outline-atomics to aarch64-linux target definitions

2 years agoRemove some minor checks for LLVM < 12
Josh Stone [Fri, 5 Nov 2021 17:26:16 +0000 (10:26 -0700)]
Remove some minor checks for LLVM < 12

2 years agoInitialize LLVM time trace profiler on each code generation thread
Tomasz Miąsko [Fri, 5 Nov 2021 00:00:00 +0000 (00:00 +0000)]
Initialize LLVM time trace profiler on each code generation thread

In https://reviews.llvm.org/D71059 LLVM 11, the time trace profiler was
extended to support multiple threads.

`timeTraceProfilerInitialize` creates a thread local profiler instance.
When a thread finishes `timeTraceProfilerFinishThread` moves a thread
local instance into a global collection of instances. Finally when all
codegen work is complete `timeTraceProfilerWrite` writes data from the
current thread local instance and the instances in global collection
of instances.

Previously, the profiler was intialized on a single thread only. Since
this thread performs no code generation on its own, the resulting
profile was empty.

Update LLVM codegen to initialize & finish time trace profiler on each
code generation thread.

2 years agoapply suggestions from code review
Niko Matsakis [Fri, 5 Nov 2021 16:43:42 +0000 (12:43 -0400)]
apply suggestions from code review

2 years agoFix rustdoc-scrape-examples-macros test not being cross-platform
Will Crichton [Fri, 5 Nov 2021 16:32:04 +0000 (09:32 -0700)]
Fix rustdoc-scrape-examples-macros test not being cross-platform

2 years agoAuto merge of #90616 - mathstuf:error_codes-comment-uniformity, r=GuillaumeGomez
bors [Fri, 5 Nov 2021 16:00:23 +0000 (16:00 +0000)]
Auto merge of #90616 - mathstuf:error_codes-comment-uniformity, r=GuillaumeGomez

error_codes: uniformly comment error codes

2 years agoerror_codes: uniformly comment error codes
Ben Boeckel [Fri, 5 Nov 2021 15:57:17 +0000 (11:57 -0400)]
error_codes: uniformly comment error codes

2 years agoAuto merge of #90604 - mbartlett21:iterator-reexports, r=kennytm
bors [Fri, 5 Nov 2021 12:22:13 +0000 (12:22 +0000)]
Auto merge of #90604 - mbartlett21:iterator-reexports, r=kennytm

Re-export some iterators from `core` in `std`

These iterators seem to have been forgotten to be re-exported from `std` (through `alloc`)

These are stable:

`core::slice::{SplitInclusive, SplitInclusiveMut}`

This one is still unstable:

`core::slice::EscapeAscii` (cc #77174)

2 years agoAuto merge of #90577 - matthiaskrgr:clippy_perf_nov, r=petrochenkov
bors [Fri, 5 Nov 2021 09:17:39 +0000 (09:17 +0000)]
Auto merge of #90577 - matthiaskrgr:clippy_perf_nov, r=petrochenkov

clippy::perf fixes

2 years agoFix `str::SplitInclusive` stabilisation date
mbartlett21 [Fri, 5 Nov 2021 07:46:58 +0000 (17:46 +1000)]
Fix `str::SplitInclusive` stabilisation date

2 years agoAdd feature to `alloc` so we can re-export.
mbartlett21 [Fri, 5 Nov 2021 07:35:07 +0000 (17:35 +1000)]
Add feature to `alloc` so we can re-export.

2 years agoRe-export `core::slice::EscapeAscii`
mbartlett21 [Fri, 5 Nov 2021 07:14:57 +0000 (17:14 +1000)]
Re-export `core::slice::EscapeAscii`

2 years agoRe-export `core::slice::SplitInclusive[Mut]`
mbartlett21 [Fri, 5 Nov 2021 05:44:43 +0000 (15:44 +1000)]
Re-export `core::slice::SplitInclusive[Mut]`

2 years agoAuto merge of #90598 - JohnTitor:rollup-kz1qioz, r=JohnTitor
bors [Fri, 5 Nov 2021 04:35:13 +0000 (04:35 +0000)]
Auto merge of #90598 - JohnTitor:rollup-kz1qioz, r=JohnTitor

Rollup of 9 pull requests

Successful merges:

 - #90507 (Suggest `extern crate alloc` when using undeclared module `alloc`)
 - #90530 (Simplify js tester a bit)
 - #90533 (Add note about x86 instruction prefixes in asm! to unstable book)
 - #90537 (Update aarch64 `target_feature` list for LLVM 12.)
 - #90544 (Demote metadata load warning to "info".)
 - #90554 (Clean up some `-Z unstable-options` in tests.)
 - #90556 (Add more text and examples to `carrying_{add|mul}`)
 - #90563 (rustbot allow labels)
 - #90571 (Fix missing bottom border for headings in sidebar)

Failed merges:

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

2 years agoMove rustdoc-scrape-examples-macros test to run-make-fulldeps
Will Crichton [Fri, 5 Nov 2021 01:52:59 +0000 (18:52 -0700)]
Move rustdoc-scrape-examples-macros test to run-make-fulldeps

2 years agoRollup merge of #90571 - GuillaumeGomez:missing-bottom-border-sidebar, r=jsha
Yuki Okushi [Fri, 5 Nov 2021 01:32:47 +0000 (10:32 +0900)]
Rollup merge of #90571 - GuillaumeGomez:missing-bottom-border-sidebar, r=jsha

Fix missing bottom border for headings in sidebar

Fixes #90568.

r? ```@jsha```

2 years agoRollup merge of #90563 - joshtriplett:rustbot-allow-labels, r=Mark-Simulacrum
Yuki Okushi [Fri, 5 Nov 2021 01:32:47 +0000 (10:32 +0900)]
Rollup merge of #90563 - joshtriplett:rustbot-allow-labels, r=Mark-Simulacrum

rustbot allow labels

`relnotes` was inspired by https://github.com/rust-lang/rust/pull/90521 , and by the various `must_use` PRs; in all of those cases, the submitter of the PR could know that `relnotes` applied, but couldn't apply it themselves.

For `needs-fcp`, I think people should be able to help triage by observing that a change needs an FCP before we can apply it.

2 years agoRollup merge of #90556 - scottmcm:carrying_comments, r=joshtriplett
Yuki Okushi [Fri, 5 Nov 2021 01:32:46 +0000 (10:32 +0900)]
Rollup merge of #90556 - scottmcm:carrying_comments, r=joshtriplett

Add more text and examples to `carrying_{add|mul}`

`feature(bigint_helper_methods)` tracking issue https://github.com/rust-lang/rust/issues/85532

cc `````@clarfonthey`````

2 years agoRollup merge of #90554 - ehuss:unstable-options-cleanup, r=joshtriplett
Yuki Okushi [Fri, 5 Nov 2021 01:32:45 +0000 (10:32 +0900)]
Rollup merge of #90554 - ehuss:unstable-options-cleanup, r=joshtriplett

Clean up some `-Z unstable-options` in tests.

Several of these tests were for features that have been stabilized, or otherwise don't need `-Z unstable-options`.

2 years agoRollup merge of #90544 - ehuss:demote-locator-warn, r=petrochenkov
Yuki Okushi [Fri, 5 Nov 2021 01:32:44 +0000 (10:32 +0900)]
Rollup merge of #90544 - ehuss:demote-locator-warn, r=petrochenkov

Demote metadata load warning to "info".

There is a warn log message for whenever the crate loader fails to load metadata from a candidate file. I think this warning is too aggressive, as there are several situations where metadata information might not be found in a candidate file, which is normal. Also, this warning is somewhat confusing, and non-actionable in most cases for a user (most users will not know what it means).

If the crate loader ultimately does not find a valid crate, then an error will be reported (and hopefully #88368 will improve that error message).

If a rustc developer wants to debug a loader problem, they can still use `RUSTC_LOG=rustc_metadata=debug` and get the details.

There is more discussion of this particular warning at https://github.com/rust-lang/rust/issues/89795#issuecomment-940798190.

Fixes #90525

2 years agoRollup merge of #90537 - adamgemmell:dev/aarch64-target-feature, r=Amanieu
Yuki Okushi [Fri, 5 Nov 2021 01:32:42 +0000 (10:32 +0900)]
Rollup merge of #90537 - adamgemmell:dev/aarch64-target-feature, r=Amanieu

Update aarch64 `target_feature` list for LLVM 12.

Many of these feature are now available on all valid LLVM versions.

I've also added a few new ones to the list.

r? `@Amanieu`

2 years agoRollup merge of #90533 - Smittyvb:patch-1, r=joshtriplett
Yuki Okushi [Fri, 5 Nov 2021 01:32:41 +0000 (10:32 +0900)]
Rollup merge of #90533 - Smittyvb:patch-1, r=joshtriplett

Add note about x86 instruction prefixes in asm! to unstable book

Since rustc doesn't do the assembly parsing itself, it is unable to detect when inline assembly ends with an instruction prefix, which doesn't make sense since it would apply to instructions from the compiler. This fixes #82314 by mentioning that x86 instruction prefixes must not be used in inline assembly. AFAICT x86 is the only instruction set with instruction prefixes.

2 years agoRollup merge of #90530 - GuillaumeGomez:simplify-js-tester, r=notriddle
Yuki Okushi [Fri, 5 Nov 2021 01:32:40 +0000 (10:32 +0900)]
Rollup merge of #90530 - GuillaumeGomez:simplify-js-tester, r=notriddle

Simplify js tester a bit

r? `````@notriddle`````

2 years agoRollup merge of #90507 - TaKO8Ki:suggest-extern-crate-alloc, r=jackh726
Yuki Okushi [Fri, 5 Nov 2021 01:32:39 +0000 (10:32 +0900)]
Rollup merge of #90507 - TaKO8Ki:suggest-extern-crate-alloc, r=jackh726

Suggest `extern crate alloc` when using undeclared module `alloc`

closes #90136

2 years agoAuto merge of #90574 - notriddle:notriddle/doc-fold-stripped-conditional, r=camelid...
bors [Fri, 5 Nov 2021 01:29:41 +0000 (01:29 +0000)]
Auto merge of #90574 - notriddle:notriddle/doc-fold-stripped-conditional, r=camelid,GuillaumeGomez

rustdoc: Use conditional for _stripped fold

Followup: https://github.com/rust-lang/rust/pull/90475#discussion_r741405472

2 years agohandle case of a variable not captured
Niko Matsakis [Fri, 5 Nov 2021 01:26:47 +0000 (21:26 -0400)]
handle case of a variable not captured

2 years agorework diagnostic reporting to be more structured
Niko Matsakis [Thu, 4 Nov 2021 21:44:29 +0000 (17:44 -0400)]
rework diagnostic reporting to be more structured

2 years agoAuto merge of #90536 - crlf0710:fix_vtable_hrtb, r=jackh726
bors [Thu, 4 Nov 2021 21:52:21 +0000 (21:52 +0000)]
Auto merge of #90536 - crlf0710:fix_vtable_hrtb, r=jackh726

Erase regions within `vtable_trait_first_method_offset`

Fixes #90177 .

r? `@jackh726`

2 years agoFix ICE when rustdoc is scraping examples inside of a proc macro
Will Crichton [Thu, 4 Nov 2021 20:57:39 +0000 (13:57 -0700)]
Fix ICE when rustdoc is scraping examples inside of a proc macro

2 years agoSort scraped call locations before serializing
Will Crichton [Thu, 4 Nov 2021 20:57:09 +0000 (13:57 -0700)]
Sort scraped call locations before serializing

2 years agoclippy::perf fixes
Matthias Krüger [Thu, 4 Nov 2021 19:16:57 +0000 (20:16 +0100)]
clippy::perf fixes

2 years agoFix missing bottom border for headings in sidebar
Guillaume Gomez [Thu, 4 Nov 2021 15:27:02 +0000 (16:27 +0100)]
Fix missing bottom border for headings in sidebar

2 years agointroduce an enum for tracking the 2229 migration causes
Niko Matsakis [Thu, 4 Nov 2021 16:50:24 +0000 (12:50 -0400)]
introduce an enum for tracking the 2229 migration causes

2 years agorustdoc: Use conditional for _stripped fold
Michael Howell [Thu, 4 Nov 2021 16:43:13 +0000 (09:43 -0700)]
rustdoc: Use conditional for _stripped fold

Followup: https://github.com/rust-lang/rust/pull/90475#discussion_r741405472

2 years agoMention possible future rejections
Smittyvb [Thu, 4 Nov 2021 15:31:03 +0000 (11:31 -0400)]
Mention possible future rejections

Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2 years agoFix tests using `only-i686` to use the correct `only-x86` directive
Wesley Wiser [Thu, 4 Nov 2021 14:30:23 +0000 (10:30 -0400)]
Fix tests using `only-i686` to use the correct `only-x86` directive

We translate `i686` to `x86` which means tests marked as `only-i686`
never ran. Update those tests to use `only-x86`.

2 years agoAuto merge of #90564 - flip1995:clippyup, r=Manishearth
bors [Thu, 4 Nov 2021 14:21:59 +0000 (14:21 +0000)]
Auto merge of #90564 - flip1995:clippyup, r=Manishearth

Update Clippy

r? `@Manishearth`

2 years agoUpdate Cargo.lock
flip1995 [Thu, 4 Nov 2021 12:56:54 +0000 (12:56 +0000)]
Update Cargo.lock

2 years agoMerge commit 'e18101137866b79045fee0ef996e696e68c920b4' into clippyup
flip1995 [Thu, 4 Nov 2021 12:52:36 +0000 (12:52 +0000)]
Merge commit 'e18101137866b79045fee0ef996e696e68c920b4' into clippyup

2 years agorustbot: Allow applying needs-fcp label
Josh Triplett [Thu, 4 Nov 2021 12:35:10 +0000 (13:35 +0100)]
rustbot: Allow applying needs-fcp label

People should be able to help triage by observing that a change needs an
FCP before we can apply it.

2 years agorustbot: Allow applying relnotes label
Josh Triplett [Thu, 4 Nov 2021 12:34:10 +0000 (13:34 +0100)]
rustbot: Allow applying relnotes label

Inspired by https://github.com/rust-lang/rust/pull/90521 , and by the
various `must_use` PRs; in all of those cases, the submitter of the PR
could know that `relnotes` applied, but couldn't apply it themselves.

2 years agoAuto merge of #7929 - flip1995:rustup, r=flip1995
bors [Thu, 4 Nov 2021 12:07:07 +0000 (12:07 +0000)]
Auto merge of #7929 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

2 years agoBump nightly version -> 2021-11-04
flip1995 [Thu, 4 Nov 2021 12:03:53 +0000 (12:03 +0000)]
Bump nightly version -> 2021-11-04

2 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Thu, 4 Nov 2021 12:03:28 +0000 (12:03 +0000)]
Merge remote-tracking branch 'upstream/master' into rustup

2 years agoAuto merge of #90518 - calebcartwright:rustc-ast-docs, r=wesleywiser
bors [Thu, 4 Nov 2021 09:40:25 +0000 (09:40 +0000)]
Auto merge of #90518 - calebcartwright:rustc-ast-docs, r=wesleywiser

update rustc_ast crate descriptions in documentation

I noticed this the other day and figured I'd suggest a refresh. It seems like a relic from the days of `libsyntax` that got missed as things were split out into separate crates, since the current documentation text references elements that were moved into their own respective crates (e.g. `rustc_parse`)

2 years agoAdd more text and examples to `carrying_{add|mul}"
Scott McMurray [Thu, 4 Nov 2021 07:51:45 +0000 (00:51 -0700)]
Add more text and examples to `carrying_{add|mul}"

2 years agoAuto merge of #87467 - inquisitivecrystal:ref-unwind, r=dtolnay
bors [Thu, 4 Nov 2021 06:54:21 +0000 (06:54 +0000)]
Auto merge of #87467 - inquisitivecrystal:ref-unwind, r=dtolnay

Implement `RefUnwindSafe` for `Rc<T>`

This PR implements `RefUnwindSafe` for `Rc<T>`, where `T: RefUnwindSafe`.

This impl was omitted by an apparent oversight. `Rc<T>` already implements `UnwindSafe`. `Arc<T>` implements both `UnwindSafe` and `RefUnwindSafe`. There is no reason why an `&Rc<T>` is any less unwind safe than a `Rc<T>` or an `&Arc<T>`, so this should be safe to add.

Resolves #45924.

2 years agoAuto merge of #7926 - lengyijun:patch-1, r=giraffate
bors [Thu, 4 Nov 2021 05:12:59 +0000 (05:12 +0000)]
Auto merge of #7926 - lengyijun:patch-1, r=giraffate

lower_case in  span_lint_and_help document

changelog: none

2 years agoUpdate diagnostics.rs
lyj [Thu, 4 Nov 2021 03:57:14 +0000 (11:57 +0800)]
Update diagnostics.rs

2 years agoAuto merge of #90392 - solid-rs:fix-solid-support, r=Mark-Simulacrum
bors [Thu, 4 Nov 2021 03:48:43 +0000 (03:48 +0000)]
Auto merge of #90392 - solid-rs:fix-solid-support, r=Mark-Simulacrum

kmc-solid: Fix SOLID target

This PR is a follow-up for #86191 and necessary to make the [`*-kmc-solid_*`](https://doc.rust-lang.org/nightly/rustc/platform-support/kmc-solid.html) Tier 3 targets actually usable.

 - Bumps `libc` to 0.2.106, which includes <https://github.com/rust-lang/libc/pull/2227>.
 - Applies the change made by #89324 to this target's target-specific code.

2 years agoClean up some `-Z unstable-options` in tests.
Eric Huss [Thu, 4 Nov 2021 03:00:00 +0000 (20:00 -0700)]
Clean up some `-Z unstable-options` in tests.

2 years agoAuto merge of #90179 - Nilstrieb:lifetime-elision-mismatch-hint, r=estebank
bors [Thu, 4 Nov 2021 00:39:21 +0000 (00:39 +0000)]
Auto merge of #90179 - Nilstrieb:lifetime-elision-mismatch-hint, r=estebank

Add beginner friendly lifetime elision hint to E0623

Address #90170

Suggest adding a new lifetime parameter when two elided lifetimes should match up but don't.

Example:

```
error[E0623]: lifetime mismatch
  --> $DIR/issue-90170-elision-mismatch.rs:2:35
   |
LL | fn foo(slice_a: &mut [u8], slice_b: &mut [u8]) {
   |                 ---------           --------- these two types are declared with different lifetimes...
LL |     core::mem::swap(&mut slice_a, &mut slice_b);
   |                                   ^^^^^^^^^^^^ ...but data from `slice_b` flows into `slice_a` here
   |
   = note: each elided lifetime in input position becomes a distinct lifetime
help: explicitly declare a lifetime and assign it to both
   |
LL | fn foo<'a>(slice_a: &'a mut [u8], slice_b: &'a mut [u8]) {
   |       ++++           ++                     ++

```

for

```rust
fn foo(slice_a: &mut [u8], slice_b: &mut [u8]) {
    core::mem::swap(&mut slice_a, &mut slice_b);
}
```

2 years agoAuto merge of #90475 - camelid:docvisitor, r=notriddle
bors [Wed, 3 Nov 2021 21:10:22 +0000 (21:10 +0000)]
Auto merge of #90475 - camelid:docvisitor, r=notriddle

rustdoc: Add `DocVisitor` and use it where possible

`DocFolder` allows transforming the docs, accomplished by making its methods take and return types by-value. However, several of the rustdoc `DocFolder` impls only *visit* the docs; they don't change anything. Passing around types by-value is thus unnecessary, confusing, and potentially inefficient for those impls.

`DocVisitor` is very similar to `DocFolder`, except that its methods take shared references and return nothing (i.e., the unit type). This should both be more efficient and make the code clearer.

There is an additional reason to add `DocVisitor`, too. As part of my cleanup of `external_traits`, I'm planning to add a `fn cache(&mut self) -> &mut Cache` method to `DocFolder` so that `external_traits` can be retrieved explicitly from the `Cache`, rather than implicitly via `Crate.external_traits` (which is an `Rc<RefCell<...>>`). However, some of the `DocFolder` impls that could be turned into `DocVisitor` impls only have a shared reference to the `Cache`, because they are used during rendering. (They have to access the `Cache` via `html::render::Context.shared.cache`, which involves an `Rc`.)

Since `DocVisitor` does not mutate any of the types it's visiting, its equivalent `cache()` method will only need a shared reference to the `Cache`, avoiding the problem described above.

r? `@GuillaumeGomez`
cc `@jyn514`

2 years agoDemote metadata load warning to "info".
Eric Huss [Wed, 3 Nov 2021 20:39:37 +0000 (13:39 -0700)]
Demote metadata load warning to "info".

2 years agoSimplify js tester a bit
Guillaume Gomez [Wed, 3 Nov 2021 14:44:04 +0000 (15:44 +0100)]
Simplify js tester a bit

2 years agoAdd beginner friendly lifetime elision hint to E0623
Nilstrieb [Tue, 2 Nov 2021 20:22:41 +0000 (21:22 +0100)]
Add beginner friendly lifetime elision hint to E0623

Suggest adding a new lifetime parameter when two elided lifetimes should match up but don't

Issue #90170

This also changes the tests introduced by the previous commits because of another rustc issue (#90258)

2 years agoAuto merge of #90413 - tmiasko:addr-of-mutable, r=RalfJung,oli-obk
bors [Wed, 3 Nov 2021 18:13:11 +0000 (18:13 +0000)]
Auto merge of #90413 - tmiasko:addr-of-mutable, r=RalfJung,oli-obk

`addr_of!` grants mutable access, maybe?

The exact set of permissions granted when forming a raw reference is
currently undecided https://github.com/rust-lang/rust/issues/56604.

To avoid presupposing any particular outcome, adjust the const
qualification to be compatible with decision where raw reference
constructed from `addr_of!` grants mutable access.

Additionally, to avoid keeping `MaybeMutBorrowedLocals` in sync with
const qualification, remove it. It's no longer used.

`@rust-lang/wg-const-eval`

2 years agoUpdate aarch64 `target_feature` list for LLVM 12.
Adam Gemmell [Mon, 1 Nov 2021 16:22:29 +0000 (16:22 +0000)]
Update aarch64 `target_feature` list for LLVM 12.

2 years agoErase regions within `vtable_trait_first_method_offset`.
Charles Lew [Wed, 3 Nov 2021 15:37:50 +0000 (23:37 +0800)]
Erase regions within `vtable_trait_first_method_offset`.

2 years ago`addr_of!` grants mutable access, maybe?
Tomasz Miąsko [Sat, 30 Oct 2021 00:00:00 +0000 (00:00 +0000)]
`addr_of!` grants mutable access, maybe?

The exact set of permissions granted when forming a raw reference is
currently undecided https://github.com/rust-lang/rust/issues/56604.

To avoid presupposing any particular outcome, adjust the const
qualification to be compatible with decision where raw reference
constructed from `addr_of!` grants mutable access.

2 years agoRemove `MaybeMutBorrowedLocals`
Tomasz Miąsko [Fri, 29 Oct 2021 00:00:00 +0000 (00:00 +0000)]
Remove `MaybeMutBorrowedLocals`

2 years agoAuto merge of #90527 - 12101111:libc_a, r=petrochenkov
bors [Wed, 3 Nov 2021 15:11:06 +0000 (15:11 +0000)]
Auto merge of #90527 - 12101111:libc_a, r=petrochenkov

Provide standalone libc.a in self-contained for musl and wasi

This is a prerequisites of https://github.com/rust-lang/libc/pull/2272, which in turn fix:

- https://github.com/rust-lang/wg-cargo-std-aware/issues/66
- https://github.com/rust-lang/rust/issues/89626

2 years agoAdd note about x86 instruction prefixes in asm!
Smittyvb [Wed, 3 Nov 2021 13:24:50 +0000 (09:24 -0400)]
Add note about x86 instruction prefixes in asm!

Since rustc doesn't do the assembly parsing itself, it is unable
to detect when inline assembly ends with an instruction prefix,
which doesn't make sense since it would apply to instructions from
the compiler. This fixes #82314 by mentioning that x86 instruction
prefixes must not be used in inline assembly.

2 years agoProvide standalone libc.a in self-contained for musl and wasi
12101111 [Wed, 3 Nov 2021 13:12:15 +0000 (21:12 +0800)]
Provide standalone libc.a in self-contained for musl and wasi

2 years agoAuto merge of #90517 - willcrichton:example-analyzer, r=jyn514
bors [Wed, 3 Nov 2021 11:48:52 +0000 (11:48 +0000)]
Auto merge of #90517 - willcrichton:example-analyzer, r=jyn514

Fix URL for scrape-examples.js in rustdoc page template

Also adds line numbers to URLs in the "additional examples" section of rustdoc.

r? `@jyn514`

2 years agoAuto merge of #90478 - rusticstuff:apple-a14, r=wesleywiser
bors [Wed, 3 Nov 2021 08:44:38 +0000 (08:44 +0000)]
Auto merge of #90478 - rusticstuff:apple-a14, r=wesleywiser

Use apple-a14 as target CPU for aarch64-apple-darwin

After updating the minimum required LLVM version to 12 (#90175) we can use `apple-a14` as target CPU, because that CPU is similar in features to the Apple M1 (see [LLVM 13 source](https://github.com/llvm/llvm-project/blob/b8016b626ec7095c7d57ebfffb2135dc5c3077b8/llvm/lib/Target/AArch64/AArch64.td#L1127)). Once the minimum required LLVM version is updated to 13 we can use `apple-m1` here.

2 years agoAuto merge of #90421 - thomcc:friendship-ended-with-ssize_t-now-ptrdiff_t-is-my-best...
bors [Wed, 3 Nov 2021 05:36:30 +0000 (05:36 +0000)]
Auto merge of #90421 - thomcc:friendship-ended-with-ssize_t-now-ptrdiff_t-is-my-best-friend, r=joshtriplett

Replace `std::os::raw::c_ssize_t` with `std::os::raw::c_ptrdiff_t`

The discussions in #88345 brought up that `ssize_t` is not actually the signed index type defined in stddef.h, but instead it's `ptrdiff_t`. It seems pretty clear that the use of `ssize_t` here was a mistake on my part, and that if we're going to bother having a isize-alike for FFI in `std::os::raw`, it should be `ptrdiff_t` and not `ssize_t`.

Anyway, both this and `c_size_t` are dubious in the face of the discussion in https://internals.rust-lang.org/t/pre-rfc-usize-is-not-size-t/15369, and any RFC/project-group/etc that handles those issues there should contend with these types in some manner, but that doesn't mean we shouldn't fix something wrong like this, even if it is unstable.

All that said, `size_t` is *vastly* more common in function signatures than either `ssize_t` or `ptrdiff_t`, so I'm going to update the tracking issue's list of unresolved questions to note that perhaps we only want `c_size_t` — I mostly added the signed version for symmetry, rather than to meet a need. (Given this, I'm also fine with modifying this patch to instead remove `c_ssize_t` without a replacement)

CC `@magicant` (who brought the issue up)
CC `@chorman0773` (who has a significantly firmer grasp on the minutae of the C standard than I do)

r? `@joshtriplett` (original reviewer, active in the discussions around this)

2 years agofix message
Takayuki Maeda [Wed, 3 Nov 2021 04:53:57 +0000 (13:53 +0900)]
fix message

2 years agoAdd line number to URLs in "additional examples" section of rustdoc
Will Crichton [Wed, 3 Nov 2021 02:38:55 +0000 (19:38 -0700)]
Add line number to URLs in "additional examples" section of rustdoc

2 years agodocs(rustc_ast): update crate descriptions
Caleb Cartwright [Wed, 3 Nov 2021 02:10:31 +0000 (21:10 -0500)]
docs(rustc_ast): update crate descriptions

2 years agoFix URL for scrape-examples.js in rustdoc page template
Will Crichton [Wed, 3 Nov 2021 01:48:07 +0000 (18:48 -0700)]
Fix URL for scrape-examples.js in rustdoc page template

2 years agoAuto merge of #90516 - matthiaskrgr:rollup-3dmfjkj, r=matthiaskrgr
bors [Wed, 3 Nov 2021 01:52:17 +0000 (01:52 +0000)]
Auto merge of #90516 - matthiaskrgr:rollup-3dmfjkj, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #90084 (Make printed message match the code comment)
 - #90354 (Document clippy on nightly-rustc)
 - #90417 (stabilize `relaxed_struct_unsize`)
 - #90472 (Clarify what to do with accepted feature gates)
 - #90500 (Update Clippy dependencies)
 - #90502 (Split doc_cfg and doc_auto_cfg features)

Failed merges:

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

2 years agoImplement `RefUnwindSafe` for `Rc<T>`
inquisitivecrystal [Sat, 24 Jul 2021 01:12:32 +0000 (18:12 -0700)]
Implement `RefUnwindSafe` for `Rc<T>`

2 years agoRollup merge of #90502 - GuillaumeGomez:split-doc-cfg-feature, r=jyn514
Matthias Krüger [Tue, 2 Nov 2021 22:48:50 +0000 (23:48 +0100)]
Rollup merge of #90502 - GuillaumeGomez:split-doc-cfg-feature, r=jyn514

Split doc_cfg and doc_auto_cfg features

Part of #90497.

With this feature, `doc_cfg` won't pick up items automatically anymore.

cc `@Mark-Simulacrum`
r? `@jyn514`

2 years agoRollup merge of #90500 - xFrednet:00000-update-clippy-deps, r=flip1995
Matthias Krüger [Tue, 2 Nov 2021 22:48:49 +0000 (23:48 +0100)]
Rollup merge of #90500 - xFrednet:00000-update-clippy-deps, r=flip1995

Update Clippy dependencies

Clippy has two outdated dependencies, where one indirect dependency has been flagged by rustsec for dropping a lifetime. See [RUSTSEC-2020-0146](https://rustsec.org/advisories/RUSTSEC-2020-0146). This PR updates these dependencies.

With previous dependency updates, it was tried to prevent duplicates in the `Cargo.lock` file of rust-lang/rust. I've tried to keep this in mind with this update.

* Dependency `semver`
    * Used in `src/tools/cargo/Cargo.toml` as version `1.0.3`
    * Used in `src/tools/rust-analyzer/crates/project_model/Cargo.toml` as version `1`
    * Updated in Clippy from `0.11` to `1.0` (Clippy usually defines the major and minor patch version). The `Cargo.lock` file lists `1.0.3` which is one patch version behind the most recent one but prevents a duplicate with cargo's pinned version.
* Dependency `cargo_metadata`
    * Used in several tools as `0.14`
    * Used in `src/tools/tidy` and `src/tools/rls` as `0.12`
    * Updated in Clippy from `0.12` to `0.14`

All updates to the `Cargo.lock` have been done automatically by `x.py`.

There are still some tools with these outdated dependencies. Clippy didn't require any changes, and it would be likely that the others could also be updated without any problem. Let me know if I should try to update them as well :upside_down_face:.

Keep up the good work, whoever is reading this :crab:

---

For Clippy:

changelog: none

2 years agoRollup merge of #90500 - xFrednet:00000-update-clippy-deps, r=flip1995
Matthias Krüger [Tue, 2 Nov 2021 22:48:49 +0000 (23:48 +0100)]
Rollup merge of #90500 - xFrednet:00000-update-clippy-deps, r=flip1995

Update Clippy dependencies

Clippy has two outdated dependencies, where one indirect dependency has been flagged by rustsec for dropping a lifetime. See [RUSTSEC-2020-0146](https://rustsec.org/advisories/RUSTSEC-2020-0146). This PR updates these dependencies.

With previous dependency updates, it was tried to prevent duplicates in the `Cargo.lock` file of rust-lang/rust. I've tried to keep this in mind with this update.

* Dependency `semver`
    * Used in `src/tools/cargo/Cargo.toml` as version `1.0.3`
    * Used in `src/tools/rust-analyzer/crates/project_model/Cargo.toml` as version `1`
    * Updated in Clippy from `0.11` to `1.0` (Clippy usually defines the major and minor patch version). The `Cargo.lock` file lists `1.0.3` which is one patch version behind the most recent one but prevents a duplicate with cargo's pinned version.
* Dependency `cargo_metadata`
    * Used in several tools as `0.14`
    * Used in `src/tools/tidy` and `src/tools/rls` as `0.12`
    * Updated in Clippy from `0.12` to `0.14`

All updates to the `Cargo.lock` have been done automatically by `x.py`.

There are still some tools with these outdated dependencies. Clippy didn't require any changes, and it would be likely that the others could also be updated without any problem. Let me know if I should try to update them as well :upside_down_face:.

Keep up the good work, whoever is reading this :crab:

---

For Clippy:

changelog: none

2 years agoRollup merge of #90472 - joshtriplett:clarify-feature-acceptance, r=jyn514
Matthias Krüger [Tue, 2 Nov 2021 22:48:48 +0000 (23:48 +0100)]
Rollup merge of #90472 - joshtriplett:clarify-feature-acceptance, r=jyn514

Clarify what to do with accepted feature gates

The documentation only referenced `removed.rs`, but feature gates for
accepted features move to `accepted.rs`.

2 years agoRollup merge of #90417 - lcnr:stabilize-relaxed-struct-unsizing, r=wesleywiser
Matthias Krüger [Tue, 2 Nov 2021 22:48:47 +0000 (23:48 +0100)]
Rollup merge of #90417 - lcnr:stabilize-relaxed-struct-unsizing, r=wesleywiser

stabilize `relaxed_struct_unsize`

closes #81793

the fcp is already complete.

2 years agoRollup merge of #90354 - xFrednet:00000-lets-deploy-clippy-docs, r=Mark-Simulacrum
Matthias Krüger [Tue, 2 Nov 2021 22:48:46 +0000 (23:48 +0100)]
Rollup merge of #90354 - xFrednet:00000-lets-deploy-clippy-docs, r=Mark-Simulacrum

Document clippy on nightly-rustc

Adding Clippy's docs to nightly-rustc, based on commit 01cf0bde. This PR only adds `clippy_utils` to the documentation. I've decided to only document one crate for now, as `clippy_lints` etc. contain very specific and undocumented functions which aren't really reusable. I'm guessing that they would mostly clutter up the search results with little benefit.

`./x.py --stage 1 doc src/tools/clippy` if working fine now after the help that ```````@jyn514``````` and ```````@ehuss``````` have provided. A big THANK YOU to them!

2 years agoRollup merge of #90084 - noncombatant:patch-2, r=steveklabnik
Matthias Krüger [Tue, 2 Nov 2021 22:48:46 +0000 (23:48 +0100)]
Rollup merge of #90084 - noncombatant:patch-2, r=steveklabnik

Make printed message match the code comment

I think this code is getting L0, not L1 cache size, if I'm reading the Intel manual right. (I might not be.) Either way, the code comment and the printed message should match, whichever way is right. :)

2 years agoAuto merge of #90464 - lnicola:rust-analyzer-2021-11-01, r=lnicola
bors [Tue, 2 Nov 2021 22:45:27 +0000 (22:45 +0000)]
Auto merge of #90464 - lnicola:rust-analyzer-2021-11-01, r=lnicola

:arrow_up: rust-analyzer

r? `@ghost`

2 years agoAuto merge of #7904 - Serial-ATA:improve-doc-suggestion, r=xFrednet
bors [Tue, 2 Nov 2021 21:07:21 +0000 (21:07 +0000)]
Auto merge of #7904 - Serial-ATA:improve-doc-suggestion, r=xFrednet

Add suggestion to missing backticks error

changelog: Add a machine applicable suggestion for the [`doc_markdown`] missing backticks lint

closes: #7737

2 years agoSpecify fixable doc tests
Serial [Tue, 2 Nov 2021 21:04:35 +0000 (17:04 -0400)]
Specify fixable doc tests