]> git.lizzy.rs Git - rust.git/log
rust.git
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 #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 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 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 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 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 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 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 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

2 years agoAdd suggestion to missing backticks error
Serial [Sun, 31 Oct 2021 00:11:06 +0000 (20:11 -0400)]
Add suggestion to missing backticks error

2 years agoAuto merge of #7916 - samueltardieu:double-colon-prefix, r=xFrednet
bors [Tue, 2 Nov 2021 17:02:06 +0000 (17:02 +0000)]
Auto merge of #7916 - samueltardieu:double-colon-prefix, r=xFrednet

Advise to put a :: prefix inside the ticks

Fixes #7914.

changelog: Keep an initial `::` when [`doc_markdown`] suggests to use ticks

2 years agoAdvise to put a :: prefix inside the ticks
Samuel Tardieu [Tue, 2 Nov 2021 13:44:21 +0000 (14:44 +0100)]
Advise to put a :: prefix inside the ticks

2 years agoadd a suggestion about undeclared `alloc` module
Takayuki Maeda [Tue, 2 Nov 2021 16:44:01 +0000 (01:44 +0900)]
add a suggestion about undeclared `alloc` module

2 years agoAuto merge of #7918 - samueltardieu:use-config-toml, r=flip1995
bors [Tue, 2 Nov 2021 16:16:20 +0000 (16:16 +0000)]
Auto merge of #7918 - samueltardieu:use-config-toml, r=flip1995

Use .cargo/config.toml instead of .cargo/config

`.cargo/config.toml` is the preferred form for the local configuration file. This is emphasized in _The Cargo Book_ with the following note:

> Note: Cargo also reads config files without the `.toml` extension, such as `.cargo/config`. Support for the `.toml` extension was added in version 1.39 and is the preferred form.

Moreover, this helps with toml-aware text editors as they will recognize the file extension.

changelog: none

2 years agoAlso check for feature gates in "src/test/rustdoc"
Guillaume Gomez [Tue, 2 Nov 2021 16:15:11 +0000 (17:15 +0100)]
Also check for feature gates in "src/test/rustdoc"

2 years agoUse .cargo/config.toml instead of .cargo/config
Samuel Tardieu [Tue, 2 Nov 2021 16:04:39 +0000 (17:04 +0100)]
Use .cargo/config.toml instead of .cargo/config

`.cargo/config.toml` is the preferred form for the local configuration
file. This is emphasized in _The Cargo Book_ with the following note:

> Note: Cargo also reads config files without the `.toml` extension, such
> as `.cargo/config`. Support for the `.toml` extension was added in version
> 1.39 and is the preferred form.

Moreover, this helps with toml-aware text editors as they will recognize
the file extension.

2 years agoSplit doc_cfg and doc_auto_cfg features
Guillaume Gomez [Tue, 2 Nov 2021 13:36:54 +0000 (14:36 +0100)]
Split doc_cfg and doc_auto_cfg features

2 years agoAuto merge of #90495 - lnicola:freebsd-kvm, r=Mark-Simulacrum
bors [Tue, 2 Nov 2021 15:19:15 +0000 (15:19 +0000)]
Auto merge of #90495 - lnicola:freebsd-kvm, r=Mark-Simulacrum

Pull in `libkvm` on FreeBSD

This is needed when updating `libc` after https://github.com/rust-lang/libc/pull/2451.

Spotted in #90464 where it caused `rust-analyzer` to fail to link.

Similar to #88676.

2 years agoAdd link to documentation about feature gates
Josh Triplett [Tue, 2 Nov 2021 14:30:28 +0000 (15:30 +0100)]
Add link to documentation about feature gates

2 years agoAuto merge of #7906 - smoelius:master, r=camsteffen
bors [Tue, 2 Nov 2021 14:06:36 +0000 (14:06 +0000)]
Auto merge of #7906 - smoelius:master, r=camsteffen

Fix #7903

Fixes #7903 (cc: `@Arnavion)`

changelog: none (bug is in same release)

r? `@camsteffen`

2 years agoUpdate clippy dependencies
xFrednet [Tue, 2 Nov 2021 13:19:31 +0000 (14:19 +0100)]
Update clippy dependencies

* semver = "0.11" -> "1.0"
* cargo_metadata = "0.12" -> "0.14"

2 years agoUpdate clippy dependencies
xFrednet [Tue, 2 Nov 2021 13:19:31 +0000 (14:19 +0100)]
Update clippy dependencies

* semver = "0.11" -> "1.0"
* cargo_metadata = "0.12" -> "0.14"

2 years agoAuto merge of #90442 - ChrisDenton:win-tls-dtor, r=alexcrichton
bors [Tue, 2 Nov 2021 12:15:08 +0000 (12:15 +0000)]
Auto merge of #90442 - ChrisDenton:win-tls-dtor, r=alexcrichton

Windows thread-local keyless drop

`#[thread_local]` allows us to maintain a per-thread list of destructors. This also avoids the need to synchronize global data (which is particularly tricky within the TLS callback function).

r? `@alexcrichton`

2 years agoAuto merge of #7907 - Alexendoo:non-ascii-restriction, r=flip1995
bors [Tue, 2 Nov 2021 10:36:26 +0000 (10:36 +0000)]
Auto merge of #7907 - Alexendoo:non-ascii-restriction, r=flip1995

Move non_ascii_literal to restriction

It feels like the more apt category, since cases where you'd want it enabled would be pretty specific

changelog: Move [`non_ascii_literal`] to `restriction`

2 years agoAuto merge of #7901 - samueltardieu:fix-7893, r=xFrednet,flip1995
bors [Tue, 2 Nov 2021 10:23:15 +0000 (10:23 +0000)]
Auto merge of #7901 - samueltardieu:fix-7893, r=xFrednet,flip1995

Prevent clippy::needless_lifetimes false positive in async function definition

Scan `OpaqueDef` bounds for lifetimes as well. Those `OpaqueDef` instances are generated while desugaring an `async` function definition.

This fixes #7893

changelog: Prevent [`clippy::needless_lifetimes`] false positive in `async` function definition

2 years agoAuto merge of #7851 - nbdd0121:master, r=flip1995
bors [Tue, 2 Nov 2021 10:09:47 +0000 (10:09 +0000)]
Auto merge of #7851 - nbdd0121:master, r=flip1995

Fix manual_assert and match_wild_err_arm for `#![no_std]` and Rust 2021

Rust 2015 `std::panic!` has a wrapping block while `core::panic!` and Rust 2021 `std::panic!` does not. See rust-lang/rust#88919 for details.

Note that the test won't pass until clippy changes in rust-lang/rust#88860 is synced.

---

changelog: Fix [`manual_assert`] and [`match_wild_err_arm`] for `#![no_std]` and Rust 2021.

Fixes #7723

2 years agoAdd test case for `clippy::needless_lifetimes` in async context
Samuel Tardieu [Sat, 30 Oct 2021 10:11:45 +0000 (12:11 +0200)]
Add test case for `clippy::needless_lifetimes` in async context

Edition needs to be set to 2018 due to the use of `async`.

2 years agoAuto merge of #7726 - dswij:unseparated-literal-suffix, r=flip1995
bors [Tue, 2 Nov 2021 09:57:12 +0000 (09:57 +0000)]
Auto merge of #7726 - dswij:unseparated-literal-suffix, r=flip1995

Unseparated literal suffix

Closes #7658

Since `literal_suffix` style is opinionated, we should disable by default and only enforce if it's stated as so.

changelog: [`unseparated_literal_suffix`] is renamed to `literal_suffix`, adds a new configuration `literal-suffix-style` to enforce a certain style writing literal_suffix. Possible values for `literal-suffix-style`: `"separated"`, `"unseparated"`

2 years agoExamine lifetimes in `OpaqueDef` bounds as well
Samuel Tardieu [Sat, 30 Oct 2021 10:02:20 +0000 (12:02 +0200)]
Examine lifetimes in `OpaqueDef` bounds as well

Fix #7893.

2 years agoAuto merge of #7819 - rust-lang:avoid-linting-impossible-truncation, r=flip1995
bors [Tue, 2 Nov 2021 09:44:27 +0000 (09:44 +0000)]
Auto merge of #7819 - rust-lang:avoid-linting-impossible-truncation, r=flip1995

avoid linting `possible_truncation` on bit-reducing operations

---

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: avoid linting `possible_truncation` on bit-reducing operations

2 years agoPull in libkvm on FreeBSD
Laurențiu Nicola [Tue, 2 Nov 2021 08:44:14 +0000 (10:44 +0200)]
Pull in libkvm on FreeBSD

2 years agoAuto merge of #90439 - m-ou-se:thread-is-running, r=Mark-Simulacrum
bors [Tue, 2 Nov 2021 08:11:57 +0000 (08:11 +0000)]
Auto merge of #90439 - m-ou-se:thread-is-running, r=Mark-Simulacrum

Add JoinHandle::is_running.

This adds:
```rust
impl<T> JoinHandle<T> {
    /// Checks if the the associated thread is still running its main function.
    ///
    /// This might return `false` for a brief moment after the thread's main
    /// function has returned, but before the thread itself has stopped running.
    pub fn is_running(&self) -> bool;
}
```
The usual way to check if a background thread is still running is to set some atomic flag at the end of its main function. We already do that, in the form of dropping an Arc which will reduce the reference counter. So we might as well expose that information.

This is useful in applications with a main loop (e.g. a game, gui, control system, ..) where you spawn some background task, and check every frame/iteration whether the background task is finished to .join() it in that frame/iteration while keeping the program responsive.

2 years agoAuto merge of #90490 - ehuss:update-cargo, r=ehuss
bors [Tue, 2 Nov 2021 03:18:41 +0000 (03:18 +0000)]
Auto merge of #90490 - ehuss:update-cargo, r=ehuss

Update cargo

3 commits in 6c1bc24b8b49d4bc965f67d7037906dc199c72b7..94ca096afbf25f670e76e07dca754fcfe27134be
2021-10-24 17:51:41 +0000 to 2021-10-29 14:45:06 +0000
- Chore: prefer `HashMap::from` rather than collecting `Vec` of tuples (rust-lang/cargo#10018)
- Change --scrape-examples flag to -Z rustdoc-scrape-examples (rust-lang/cargo#10017)
- Scrape code examples from examples/ directory for Rustdoc (rust-lang/cargo#9525)

2 years agoAuto merge of #7911 - giraffate:small_fixes_for_missing_backticks, r=Manishearth
bors [Tue, 2 Nov 2021 00:19:57 +0000 (00:19 +0000)]
Auto merge of #7911 - giraffate:small_fixes_for_missing_backticks, r=Manishearth

Small fixes for missing backticks in doc

changelog: none

2 years agoSmall fixes for missing backticks in doc
Takayuki Nakata [Tue, 2 Nov 2021 00:09:22 +0000 (09:09 +0900)]
Small fixes for missing backticks in doc

2 years agoFix #7903
Samuel E. Moelius III [Mon, 1 Nov 2021 23:16:37 +0000 (19:16 -0400)]
Fix #7903

2 years agoList all cases explicitly in `Doc{Folder,Visitor}`
Noah Lev [Mon, 1 Nov 2021 22:46:08 +0000 (15:46 -0700)]
List all cases explicitly in `Doc{Folder,Visitor}`

2 years agoUpdate cargo
Eric Huss [Mon, 1 Nov 2021 23:08:25 +0000 (16:08 -0700)]
Update cargo

2 years agoAuto merge of #90457 - rusticstuff:use-curl-ca-bundle, r=Mark-Simulacrum
bors [Mon, 1 Nov 2021 21:21:53 +0000 (21:21 +0000)]
Auto merge of #90457 - rusticstuff:use-curl-ca-bundle, r=Mark-Simulacrum

CI: Use ubuntu image to download openssl, curl sources, cacert.pem for x86 dist builds

The dist-x86_64 and dist-i686 docker builds are failing again (see [try build](https://github.com/rust-lang-ci/rust/runs/4060836540?check_suite_focus=true)) because python.org renewed its certificate with a CA cert that is too new for debian:6.

In order to solve this once and for all this PR moves the curl and openssl downloads to a new  ubuntu:20.04 "stage-0" docker build and copies the downloaded tarballs over to build them in the "stage-1" debian:6 context. It also downloads the cacert.pem file from the curl website and uses it by pointing the `CURL_CA_BUNDLE` environment variable to it.

2 years agoIgnore files copied from previous stage when generating hash.
Hans Kratz [Mon, 1 Nov 2021 17:32:24 +0000 (18:32 +0100)]
Ignore files copied from previous stage when generating hash.

2 years agoAuto merge of #90406 - nbdd0121:panic, r=cjgillot
bors [Mon, 1 Nov 2021 17:18:57 +0000 (17:18 +0000)]
Auto merge of #90406 - nbdd0121:panic, r=cjgillot

Collect `panic/panic_bounds_check` during monomorphization

This would prevent link time errors if these functions are `#[inline]` (e.g. when `panic_immediate_abort` is used).

Fix #90405
Fix rust-lang/cargo#10019

`@rustbot` label: T-compiler A-codegen

2 years agoUse apple-a14 as target CPU for aarch64-apple-darwin.
Hans Kratz [Mon, 1 Nov 2021 16:03:07 +0000 (17:03 +0100)]
Use apple-a14 as target CPU for aarch64-apple-darwin.

After updating the minimum required LLVM version to 12 we can use
apple-a14 as that is closer in features to the Apple M1 than the A12.
Once the minimum required LLVM version is updated to 13 we can use
apple-m1.

2 years agoAccount for revisions in missing-test-files
Gary Guo [Sun, 24 Oct 2021 21:19:59 +0000 (22:19 +0100)]
Account for revisions in missing-test-files

2 years agoFix manual_assert for `#![no_std]` and Rust 2021
Gary Guo [Wed, 20 Oct 2021 23:08:18 +0000 (00:08 +0100)]
Fix manual_assert for `#![no_std]` and Rust 2021

2 years agoRun destructors from existing tls callback
Chris Denton [Mon, 1 Nov 2021 15:05:57 +0000 (15:05 +0000)]
Run destructors from existing tls callback

2 years agoAuto merge of #7866 - rust-lang:edition-2021-tests, r=Manishearth
bors [Mon, 1 Nov 2021 15:18:57 +0000 (15:18 +0000)]
Auto merge of #7866 - rust-lang:edition-2021-tests, r=Manishearth

update most tests to 2021 edition

Some tests would no longer work at all, so I added `edition:2015` or `edition:2018` to them.

Notably 2021 panics are not yet detected correctly. Once ready, this closes #7842.

---

changelog: none

2 years agoClarify what to do with accepted feature gates
Josh Triplett [Mon, 1 Nov 2021 14:34:19 +0000 (15:34 +0100)]
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 agoUpdate CHANGELOG to include `separated_literal_suffix`
dswij [Mon, 4 Oct 2021 03:54:27 +0000 (11:54 +0800)]
Update CHANGELOG to include `separated_literal_suffix`

2 years agoAdd `separated_literal_suffix` as an alternative for
Dharma Saputra Wijaya [Wed, 22 Sep 2021 14:13:54 +0000 (22:13 +0800)]
Add `separated_literal_suffix` as an alternative for
`unseparated_literal_suffix`

This commit adds a configuration `literal-suffix-style` to enforce a
specific style for unseparated_literal_suffix. The configuration accepts
two values:
- "separated"
    enforce all literals to be written separately (e.g. `123_i32`)
- "unseparated"
    enforce all literals to be written as unseparated (e.g. `123i32`)

Not specifying a value means that there is no preference on style and
any style should not be warned.

2 years agoAdd tracking issue for thread_is_running.
Mara Bos [Mon, 1 Nov 2021 14:04:24 +0000 (15:04 +0100)]
Add tracking issue for thread_is_running.

2 years agoAuto merge of #90463 - matthiaskrgr:rollup-eljk9vo, r=matthiaskrgr
bors [Mon, 1 Nov 2021 14:00:08 +0000 (14:00 +0000)]
Auto merge of #90463 - matthiaskrgr:rollup-eljk9vo, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #89826 (Feature gate + make must_not_suspend allow-by-default)
 - #89929 (Handling submodule update failures more gracefully from x.py)
 - #90333 (rustdoc: remove flicker during page load)
 - #90349 (Fix rare ICE during typeck in rustdoc scrape_examples)
 - #90398 (Document `doc(keyword)` unstable attribute)
 - #90441 (Test that promotion follows references when looking for drop)
 - #90450 (Remove `rustc_hir::hir_id::HirIdVec`)
 - #90452 (Remove unnecessary `Option` from `promote_candidate` return type)

Failed merges:

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

2 years agoAuto merge of #90462 - pietroalbini:bidi-master, r=nikomatsakis,pietroalbini
bors [Mon, 1 Nov 2021 10:53:49 +0000 (10:53 +0000)]
Auto merge of #90462 - pietroalbini:bidi-master, r=nikomatsakis,pietroalbini

[master] Fix CVE-2021-42574

This PR implements new lints to mitigate the impact of [CVE-2021-42574], caused by the presence of bidirectional-override Unicode codepoints in the compiled source code. [See the advisory][advisory] for more information about the vulnerability.

The changes in this PR will be released in tomorrow's nightly release.

[CVE-2021-42574]: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-42574
[advisory]: https://blog.rust-lang.org/2021/11/01/cve-2021-42574.html

2 years agofix formatting
Pietro Albini [Mon, 1 Nov 2021 09:39:43 +0000 (10:39 +0100)]
fix formatting

2 years ago:arrow_up: rust-analyzer
Laurențiu Nicola [Mon, 1 Nov 2021 07:01:20 +0000 (09:01 +0200)]
:arrow_up: rust-analyzer

2 years agoFix `RefCell` `BorrowMut` error in `DocVisitor`
Noah Lev [Mon, 1 Nov 2021 04:53:31 +0000 (21:53 -0700)]
Fix `RefCell` `BorrowMut` error in `DocVisitor`

Until `external_traits` is cleaned up (i.e., no longer behind a
`RefCell`), `DocVisitor` will have to `take` `external_traits` -- just
like `DocFolder` -- to prevent `RefCell` runtime errors.

2 years agoConvert more impls of `DocFolder` to `DocVisitor`
Noah Lev [Mon, 1 Nov 2021 04:33:50 +0000 (21:33 -0700)]
Convert more impls of `DocFolder` to `DocVisitor`

I think these are the last of the impls that can be easily converted to visitors.

2 years agoConvert many impls of `DocFolder` to `DocVisitor`
Noah Lev [Mon, 1 Nov 2021 04:24:11 +0000 (21:24 -0700)]
Convert many impls of `DocFolder` to `DocVisitor`

Many of `DocFolder`'s impls didn't actually transform the syntax tree,
so they can be visitors instead.

2 years agorustdoc: Small micro-optimizations and cleanups
Noah Lev [Mon, 1 Nov 2021 04:07:32 +0000 (21:07 -0700)]
rustdoc: Small micro-optimizations and cleanups

* Flip conjuncts of `&&` in rustdoc

  The `CrateNum` comparison should be very cheap, while
  `span.filename()` fetches and clones a `FileName`.

* Use `into_local_path()` instead of `local_path().clone()`

2 years agoFix FIXMEs in `rustdoc::html::sources`
Noah Lev [Mon, 1 Nov 2021 04:05:09 +0000 (21:05 -0700)]
Fix FIXMEs in `rustdoc::html::sources`

One of the FIXMEs is irrelevant since that code is only run if
`include_sources` is set. I fixed the other FIXME.

2 years agoClean up now that visitors only need `&clean::Crate`
Noah Lev [Mon, 1 Nov 2021 03:59:22 +0000 (20:59 -0700)]
Clean up now that visitors only need `&clean::Crate`

2 years agorustdoc: Use `DocVisitor` for sources collection
Noah Lev [Mon, 1 Nov 2021 03:54:37 +0000 (20:54 -0700)]
rustdoc: Use `DocVisitor` for sources collection

2 years agorustdoc: Add `DocVisitor`
Noah Lev [Mon, 1 Nov 2021 03:18:52 +0000 (20:18 -0700)]
rustdoc: Add `DocVisitor`

`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.

2 years agorustdoc: Replace wildcard with explicit pattern
Noah Lev [Mon, 1 Nov 2021 03:00:48 +0000 (20:00 -0700)]
rustdoc: Replace wildcard with explicit pattern

This simplifies the code and future-proofs it against changes to
`Variant`.

2 years agorustdoc: Remove unnecessary clone in `DocFolder`
Noah Lev [Mon, 1 Nov 2021 02:58:28 +0000 (19:58 -0700)]
rustdoc: Remove unnecessary clone in `DocFolder`

Also, contrary to the comment, the clone is not that small, since
`Variant` contains `Item`s, which are quite large when you factor in
both stack- and heap-allocated memory.

2 years agoRollup merge of #90452 - tmiasko:promote-candidate, r=cjgillot
Matthias Krüger [Mon, 1 Nov 2021 02:33:11 +0000 (03:33 +0100)]
Rollup merge of #90452 - tmiasko:promote-candidate, r=cjgillot

Remove unnecessary `Option` from `promote_candidate` return type

2 years agoRollup merge of #90450 - pierwill:rm-hiridvec, r=cjgillot
Matthias Krüger [Mon, 1 Nov 2021 02:33:10 +0000 (03:33 +0100)]
Rollup merge of #90450 - pierwill:rm-hiridvec, r=cjgillot

Remove `rustc_hir::hir_id::HirIdVec`

See https://github.com/rust-lang/rust/pull/90408#discussion_r739627519:

> IIRC, `HirIdVec` is never used, you can delete it. PR #72015 has been abandoned.

r? `@cjgillot`

2 years agoRollup merge of #90441 - tmiasko:test-promotion-needs-drop, r=Mark-Simulacrum
Matthias Krüger [Mon, 1 Nov 2021 02:33:09 +0000 (03:33 +0100)]
Rollup merge of #90441 - tmiasko:test-promotion-needs-drop, r=Mark-Simulacrum

Test that promotion follows references when looking for drop

Noticed that this wasn't covered by any of existing tests.

The const checking and const qualification, which currently shares the
implementation with promotion, will likely need a different behaviour
here (see issue #90193).

2 years agoRollup merge of #90398 - GuillaumeGomez:doc-keyword-doc, r=camelid
Matthias Krüger [Mon, 1 Nov 2021 02:33:08 +0000 (03:33 +0100)]
Rollup merge of #90398 - GuillaumeGomez:doc-keyword-doc, r=camelid

Document `doc(keyword)` unstable attribute

r? `@camelid`