Commit Graph

157422 Commits

Author SHA1 Message Date
bors 489ec310d2 Auto merge of #90577 - matthiaskrgr:clippy_perf_nov, r=petrochenkov
clippy::perf fixes
2021-11-05 09:17:39 +00:00
bors b99bd8f8be 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
2021-11-05 04:35:13 +00:00
Yuki Okushi 3821ab231b
Rollup merge of #90571 - GuillaumeGomez:missing-bottom-border-sidebar, r=jsha
Fix missing bottom border for headings in sidebar

Fixes #90568.

r? ```@jsha```
2021-11-05 10:32:47 +09:00
Yuki Okushi 1aa8c01c29
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.
2021-11-05 10:32:47 +09:00
Yuki Okushi 5aa6eaf4c0
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`````
2021-11-05 10:32:46 +09:00
Yuki Okushi 7ee926a852
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`.
2021-11-05 10:32:45 +09:00
Yuki Okushi 6964ec2f72
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
2021-11-05 10:32:44 +09:00
Yuki Okushi a5802d0731
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`
2021-11-05 10:32:42 +09:00
Yuki Okushi dbaf2de0bb
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.
2021-11-05 10:32:41 +09:00
Yuki Okushi 282d696009
Rollup merge of #90530 - GuillaumeGomez:simplify-js-tester, r=notriddle
Simplify js tester a bit

r? `````@notriddle`````
2021-11-05 10:32:40 +09:00
Yuki Okushi 987797bfe1
Rollup merge of #90507 - TaKO8Ki:suggest-extern-crate-alloc, r=jackh726
Suggest `extern crate alloc` when using undeclared module `alloc`

closes #90136
2021-11-05 10:32:39 +09:00
bors a6162f6c0f 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
2021-11-05 01:29:41 +00:00
bors 2cff30b17a Auto merge of #90536 - crlf0710:fix_vtable_hrtb, r=jackh726
Erase regions within `vtable_trait_first_method_offset`

Fixes #90177 .

r? `@jackh726`
2021-11-04 21:52:21 +00:00
Matthias Krüger 28ef4169cc clippy::perf fixes 2021-11-04 21:07:56 +01:00
Guillaume Gomez aa17e1c47f Fix missing bottom border for headings in sidebar 2021-11-04 20:07:24 +01:00
Michael Howell 7f268838cd rustdoc: Use conditional for _stripped fold
Followup: https://github.com/rust-lang/rust/pull/90475#discussion_r741405472
2021-11-04 09:43:13 -07:00
Smittyvb 773cc4f52b
Mention possible future rejections
Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2021-11-04 11:31:03 -04:00
bors 4961b107f2 Auto merge of #90564 - flip1995:clippyup, r=Manishearth
Update Clippy

r? `@Manishearth`
2021-11-04 14:21:59 +00:00
flip1995 4e5319b622
Update Cargo.lock 2021-11-04 12:56:54 +00:00
flip1995 4d6c2cce0a
Merge commit 'e18101137866b79045fee0ef996e696e68c920b4' into clippyup 2021-11-04 12:52:36 +00:00
Josh Triplett 7e0293428f 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.
2021-11-04 13:36:00 +01:00
Josh Triplett 056af9dbc8 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.
2021-11-04 13:35:56 +01:00
bors e181011378 Auto merge of #7929 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2021-11-04 12:07:07 +00:00
flip1995 c7f54624b2
Bump nightly version -> 2021-11-04 2021-11-04 12:03:53 +00:00
flip1995 1cc21db8c6
Merge remote-tracking branch 'upstream/master' into rustup 2021-11-04 12:03:28 +00:00
bors 27143a9094 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`)
2021-11-04 09:40:25 +00:00
Scott McMurray dc2c2603c6 Add more text and examples to `carrying_{add|mul}" 2021-11-04 00:51:45 -07:00
bors 4061c04079 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.
2021-11-04 06:54:21 +00:00
bors 150a65982b Auto merge of #7926 - lengyijun:patch-1, r=giraffate
lower_case in  span_lint_and_help document

changelog: none
2021-11-04 05:12:59 +00:00
lyj df9f5e4b22
Update diagnostics.rs 2021-11-04 11:57:14 +08:00
bors 0b4ac62dda 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.
2021-11-04 03:48:43 +00:00
Eric Huss 754455e4f2 Clean up some `-Z unstable-options` in tests. 2021-11-03 20:00:00 -07:00
bors e60e19bc65 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);
}
```
2021-11-04 00:39:21 +00:00
bors 4ff90232a0 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`
2021-11-03 21:10:22 +00:00
Eric Huss 9057936a9a Demote metadata load warning to "info". 2021-11-03 13:39:37 -07:00
Guillaume Gomez 3f496b5f2e Simplify js tester a bit 2021-11-03 21:37:19 +01:00
Nilstrieb 4b9e4606cb 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)
2021-11-03 20:10:44 +01:00
bors baba6687df 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`
2021-11-03 18:13:11 +00:00
Adam Gemmell cdd98bbdfe Update aarch64 `target_feature` list for LLVM 12. 2021-11-03 18:04:09 +00:00
Charles Lew 8841204cc6 Erase regions within `vtable_trait_first_method_offset`. 2021-11-04 00:53:54 +08:00
Tomasz Miąsko bc4931ed7e `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.
2021-11-03 16:43:12 +01:00
Tomasz Miąsko b285e0c5d8 Remove `MaybeMutBorrowedLocals` 2021-11-03 16:43:12 +01:00
bors 7734cb8078 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
2021-11-03 15:11:06 +00:00
Smittyvb fdb6bdacfa
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.
2021-11-03 09:24:50 -04:00
12101111 b23c1c5670
Provide standalone libc.a in self-contained for musl and wasi 2021-11-03 21:12:15 +08:00
bors 473eaa42e9 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`
2021-11-03 11:48:52 +00:00
bors 3831aaa13c 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](b8016b626e/llvm/lib/Target/AArch64/AArch64.td (L1127))). Once the minimum required LLVM version is updated to 13 we can use `apple-m1` here.
2021-11-03 08:44:38 +00:00
bors 87ec5680c9 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)
2021-11-03 05:36:30 +00:00
Takayuki Maeda 6c1e194534 fix message 2021-11-03 13:53:57 +09:00
Will Crichton ce943d26f8 Add line number to URLs in "additional examples" section of rustdoc 2021-11-02 19:38:55 -07:00