Commit Graph

157566 Commits

Author SHA1 Message Date
bors
c57704f3eb Auto merge of #90695 - GuillaumeGomez:rollup-kxvvw4o, r=GuillaumeGomez
Rollup of 4 pull requests

Successful merges:

 - #90494 (ARMv6K Horizon OS panic change)
 - #90652 (use filter(|x| matches!(..)) instead of filter_map(|x| match x ... => Some(xy)))
 - #90657 (Fix bug with `#[doc]` string single-character last lines)
 - #90689 (⬆️ rust-analyzer)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-11-09 01:30:23 +00:00
bors
515472757d Auto merge of #90443 - camelid:rustdoc-subst, r=GuillaumeGomez
Merge `DocContext.{ty,lt,ct}_substs` into one map

It should be impossible to have more than one entry with a particular
key across the three maps, so they should be one map. In addition to
making it impossible for multiple entries to exist, this should improve
memory usage since now only one map is allocated on the stack and heap.

r? `@GuillaumeGomez`
2021-11-08 21:37:59 +00:00
Guillaume Gomez
27095246fb
Rollup merge of #90689 - lnicola:rust-analyzer-2021-11-08, r=lnicola
⬆️ rust-analyzer

r? ``@ghost``
2021-11-08 15:15:25 +01:00
Guillaume Gomez
d9fc7d1041
Rollup merge of #90657 - GuillaumeGomez:one-char-last-line-removed, r=jyn514
Fix bug with `#[doc]` string single-character last lines

Fixes #90618.

This is because `.iter().all(|c| c == '*')` returns `true` if there is no character checked. And in case the last line has only one character, it simply returns `true`, making the last line behind removed.
2021-11-08 15:15:24 +01:00
Guillaume Gomez
931881070a
Rollup merge of #90652 - matthiaskrgr:unnnec_filter_map, r=jyn514
use filter(|x| matches!(..)) instead of filter_map(|x| match x ... => Some(xy))
2021-11-08 15:15:23 +01:00
Guillaume Gomez
f07f800364
Rollup merge of #90494 - Meziu:armv6k-3ds-target, r=sanxiyn
ARMv6K Horizon OS panic change

After a small change to `backtrace-rs` ([#448](https://github.com/rust-lang/backtrace-rs/pull/448)), `PanicStrategy::Unwind` is now fully supported.
2021-11-08 15:15:22 +01:00
bors
495322d776 Auto merge of #90361 - Mark-Simulacrum:always-verify, r=michaelwoerister
Enable verification for 1/32th of queries loaded from disk

This is a limited enabling of incremental verification for query results loaded from disk, which previously did not run without -Zincremental-verify-ich. If enabled for all queries, we see a probably unacceptable hit of ~50% in the worst case, so this pairs back the verification to a more limited set based on the hash key.

Per collected [perf results](https://github.com/rust-lang/rust/pull/84227#issuecomment-953350582), this is a regression of at most 7% on coercions opt incr-unchanged, and typically less than 0.5% on other benchmarks (largely limited to incr-unchanged). I believe this is acceptable performance to land, and we can either ratchet it up or down fairly easily.

We have no real sense of whether this will lead to a large amount of assertions in the wild, but since those assertions may lead to miscompilations today, it seems potentially warranted. We have a good bit of lead time until the next stable release, though the holiday season will also start soon; we may wish to discuss the timing of enabling this and weigh the desire to prevent (possible) miscompilations against assertions.

cc `@rust-lang/wg-incr-comp`
2021-11-08 13:38:08 +00:00
Laurențiu Nicola
1e56dd4aef ⬆️ rust-analyzer 2021-11-08 12:07:03 +02:00
bors
3e3890c9d4 Auto merge of #90675 - camelid:cleanup-impl, r=jyn514
rustdoc: Cleanup `clean::Impl` and other parts of `clean`

This PR cleans up and reduces the size of `clean::Impl`, makes some other small performance improvements, and removes some Clean impls that are either unnecessary or potentially confusing.

r? `@jyn514`
2021-11-08 08:21:51 +00:00
bors
b3074819f6 Auto merge of #90680 - calebcartwright:rustfmt-sync, r=calebcartwright
sync rustfmt subtree
2021-11-08 05:13:41 +00:00
Caleb Cartwright
30fb1246b4 Merge commit 'ea199bacef07213dbe008841b89c450e3bf0c638' into rustfmt-sync 2021-11-07 20:37:34 -06:00
Noah Lev
b5817fada2 rustdoc: Remove top-level wrappers for ImplKind methods
The `ImplKind` methods can just be used directly instead.
2021-11-07 18:26:37 -08:00
bors
43192ca3d7 Auto merge of #89488 - c410-f3r:testsssssss, r=petrochenkov
Move some tests to more reasonable directories - 8

cc #73494
r? `@petrochenkov`
2021-11-08 02:04:31 +00:00
Caleb Cartwright
ea199bacef
Merge pull request #5070 from calebcartwright/rustup-2021-11-s1
subtree sync
2021-11-07 19:40:15 -06:00
Caleb Cartwright
31bc54a9a8 chore: bump toolchain 2021-11-07 19:14:34 -06:00
bors
5fa94f3c57 Auto merge of #88368 - jyn514:metadata-error, r=petrochenkov
Improve error when an .rlib can't be parsed

This usually describes either an error in the compiler itself or some
sort of IO error. Either way, we should report it to the user rather
than just saying "crate not found".

This only gives an error if the crate couldn't be loaded at all - if the
compiler finds another .rlib or .rmeta file which was valid, it will
continue to compile the crate.

Example output:
```
error[E0785]: found invalid metadata files for crate `foo`
 --> bar.rs:3:24
  |
3 |         println!("{}", foo::FOO_11_49[0]);
  |                        ^^^
  |
  = warning: failed to parse rlib '/home/joshua/test-rustdoc/libfoo.rlib': Invalid archive extended name offset
```

cc `@ehuss`
2021-11-07 23:03:55 +00:00
Caleb Cartwright
4621915d25 Merge remote-tracking branch 'upstream/master' into rustup-2021-11-s1 2021-11-07 14:44:33 -06:00
bors
46b8e7488e Auto merge of #90668 - matthiaskrgr:clippy_nov7, r=jyn514
more clippy fixes
2021-11-07 20:04:54 +00:00
Noah Lev
7c7bf451eb Remove Clean impl for &T 2021-11-07 09:23:33 -08:00
Noah Lev
d07997702f Remove unused Clean impl for Rc<T> 2021-11-07 09:20:35 -08:00
Noah Lev
72b0a57244 Remove Clean impl for Vec<T> 2021-11-07 09:19:58 -08:00
Noah Lev
efe4d7ca7e Remove Clean impl for IndexVec<T> 2021-11-07 09:19:54 -08:00
Noah Lev
750568d49c Remove Clean impl for Option<T> 2021-11-07 09:06:50 -08:00
Noah Lev
120ef36307 rustdoc: Use ty::ImplPolarity instead of custom enum 2021-11-07 08:57:33 -08:00
Noah Lev
543aea6c03 Use an enum to record polarity in clean::Impl 2021-11-07 08:52:28 -08:00
Noah Lev
7b7023cb72 rustdoc: Refactor Impl.{synthetic,blanket_impl} into enum
This change has two advantages:

1. It makes the possible states clearer, and it makes it impossible to
   construct invalid states, such as a blanket impl that is also an auto
   trait impl.

2. It shrinks the size of `Impl` a bit, since now there is only one
   field, rather than two.
2021-11-07 08:41:18 -08:00
Matthias Krüger
5c454551da more clippy fixes 2021-11-07 16:59:05 +01:00
bors
68568dcb8f Auto merge of #90671 - petrochenkov:astnaming, r=jackh726
ast: Fix naming conventions in AST structures

TraitKind -> Trait
TyAliasKind -> TyAlias
ImplKind -> Impl
FnKind -> Fn

All `*Kind`s in AST are supposed to be enums.

Tuple structs are converted to braced structs for the types above, and fields are reordered in syntactic order.

Also, mutable AST visitor now correctly visit spans in defaultness, unsafety, impl polarity and constness.

Noticed when reviewing #90076.
2021-11-07 15:19:11 +00:00
Joshua Nelson
257ac1b498 Improve error when an .rlib can't be parsed
This usually describes either an error in the compiler itself or some
sort of IO error. Either way, we should report it to the user rather
than just saying "crate not found".

This only gives an error if the crate couldn't be loaded at all - if the
compiler finds another .rlib or .rmeta file which was valid, it will
continue to compile the crate.

Example output:
```
error[E0785]: found invalid metadata files for crate `foo`
 --> bar.rs:3:24
  |
3 |         println!("{}", foo::FOO_11_49[0]);
  |                        ^^^
  |
  = warning: failed to parse rlib '/home/joshua/test-rustdoc/libfoo.rlib': Invalid archive extended name offset
```
2021-11-07 15:03:40 +00:00
Caleb Cartwright
e4472d3b07 refactor: dedupe associated item visitation 2021-11-07 08:12:58 -06:00
Vadim Petrochenkov
bf3c52f355 ast: Fix naming conventions in AST structures
TraitKind -> Trait
TyAliasKind -> TyAlias
ImplKind -> Impl
FnKind -> Fn

All `*Kind`s in AST are supposed to be enums.

Tuple structs are converted to braced structs for the types above, and fields are reordered in syntactic order.

Also, mutable AST visitor now correctly visit spans in defaultness, unsafety, impl polarity and constness.
2021-11-07 21:38:17 +08:00
Vadim Petrochenkov
2834f57c45 ast: Fix naming conventions in AST structures
TraitKind -> Trait
TyAliasKind -> TyAlias
ImplKind -> Impl
FnKind -> Fn

All `*Kind`s in AST are supposed to be enums.

Tuple structs are converted to braced structs for the types above, and fields are reordered in syntactic order.

Also, mutable AST visitor now correctly visit spans in defaultness, unsafety, impl polarity and constness.
2021-11-07 21:38:17 +08:00
bors
fecfc0e6cc Auto merge of #89310 - joshtriplett:available-concurrency-affinity, r=m-ou-se
Make `std:🧵:available_concurrency` support process-limited number of CPUs

Use `libc::sched_getaffinity` and count the number of CPUs in the returned mask. This handles cases where the process doesn't have access to all CPUs, such as when limited via `taskset` or similar.

This also covers cgroup cpusets.
2021-11-07 11:53:25 +00:00
Noah Lev
c32ee54380 rustdoc: Remove redundant Impl.span field
It can be computed on-demand in `Item::span()`.
2021-11-06 22:48:29 -07:00
bors
90a273b785 Auto merge of #90348 - Amanieu:asm_feature_gates, r=joshtriplett
Add features gates for experimental asm features

This PR splits off parts of `asm!` into separate features because they are not ready for stabilization.

Specifically this adds:
- `asm_const` for `const` operands.
- `asm_sym` for `sym` operands.
- `asm_experimental_arch` for architectures other than x86, x86_64, arm, aarch64 and riscv.

r? `@nagisa`
2021-11-07 04:59:42 +00:00
Amanieu d'Antras
87d0d64b78 Restrict tests that use needs-asm-support to non-experimental
architectures
2021-11-07 03:44:42 +00:00
bors
88b4ea8fb6 Auto merge of #90635 - matthiaskrgr:rustdoc_compl, r=GuillaumeGomez
rustdoc: clippy::complexity fixes
2021-11-07 02:17:35 +00:00
Amanieu d'Antras
eb32c00216 Add features gates for experimental asm features 2021-11-07 01:23:53 +00:00
bors
089a016919 Auto merge of #90661 - matthiaskrgr:rollup-1umbdlx, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #90487 (Add a chapter on reading Rustdoc output)
 - #90508 (Apply adjustments for field expression even if inaccessible)
 - #90627 (Suggest dereference of `Box` when inner type is expected)
 - #90642 (use matches!() macro in more places)
 - #90646 (type error go brrrrrrrr)
 - #90649 (Run reveal_all on MIR when inlining is activated.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-11-06 22:55:37 +00:00
Matthias Krüger
ec471de865
Rollup merge of #90649 - cjgillot:reveal-all-2, r=lcnr
Run reveal_all on MIR when inlining is activated.

Fix logic error in https://github.com/rust-lang/rust/pull/85254 which prevented the pass from running when needed.
Fixes https://github.com/rust-lang/rust/issues/78442
r? ``@lcnr``
2021-11-06 23:12:06 +01:00
Matthias Krüger
43fee0e0a9
Rollup merge of #90646 - BoxyUwU:funky_ice, r=estebank
type error go brrrrrrrr

Fixes #90444

when we relate something like:
`fn(fn((), (), u32))` with `fn(fn((), (), ()))`
we relate the inner fn ptrs:
`fn((), (), u32)` with `fn((), (), ())`
yielding a `TypeError::ArgumentSorts(_, 2)` which we then use as the `TypeError` for the `fn(fn(..))` which later causes the ICE as the `2` does not correspond to any input or output types in `fn(_)`

r? `@estebank`
2021-11-06 23:12:06 +01:00
Matthias Krüger
5f0e6ca6a3
Rollup merge of #90642 - matthiaskrgr:clippy_matches, r=cjgillot
use matches!() macro in more places
2021-11-06 23:12:05 +01:00
Matthias Krüger
1d9fe9cd06
Rollup merge of #90627 - camelid:suggest-box-deref, r=davidtwco
Suggest dereference of `Box` when inner type is expected

For example:

    enum Ty {
        Unit,
        List(Box<Ty>),
    }

    fn foo(x: Ty) -> Ty {
        match x {
            Ty::Unit => Ty::Unit,
            Ty::List(elem) => foo(elem),
        }
    }

Before, the only suggestion was to rewrap `inner` with `Ty::Wrapper`,
which is unhelpful and confusing:

    error[E0308]: mismatched types
     --> src/test/ui/suggestions/boxed-variant-field.rs:9:31
      |
    9 |         Ty::List(elem) => foo(elem),
      |                               ^^^^
      |                               |
      |                               expected enum `Ty`, found struct `Box`
      |                               help: try using a variant of the expected enum: `Ty::List(elem)`
      |
      = note: expected enum `Ty`
               found struct `Box<Ty>`

Now, rustc will first suggest dereferencing the `Box`, which is most
likely what the user intended:

    error[E0308]: mismatched types
     --> src/test/ui/suggestions/boxed-variant-field.rs:9:31
      |
    9 |         Ty::List(elem) => foo(elem),
      |                               ^^^^ expected enum `Ty`, found struct `Box`
      |
      = note: expected enum `Ty`
               found struct `Box<Ty>`
    help: try dereferencing the `Box`
      |
    9 |         Ty::List(elem) => foo(*elem),
      |                               +
    help: try using a variant of the expected enum
      |
    9 |         Ty::List(elem) => foo(Ty::List(elem)),
      |                               ~~~~~~~~~~~~~~

r? ``@davidtwco``
2021-11-06 23:12:04 +01:00
Matthias Krüger
4c49db35fc
Rollup merge of #90508 - nbdd0121:issue-90483, r=davidtwco
Apply adjustments for field expression even if inaccessible

The adjustments are used later by ExprUseVisitor to build Place projections and without adjustments it can produce invalid result.

Fix #90483

``@rustbot`` label: T-compiler
2021-11-06 23:12:03 +01:00
Matthias Krüger
de332b52af
Rollup merge of #90487 - NoraCodes:nora/how-to-read-rustdoc, r=jyn514
Add a chapter on reading Rustdoc output

Includes documentation for:
 - general page structure
 - navigation
 - searching
 - themes
 - deep-linking

Doesn't include docs on the settings page.

Per https://github.com/rust-lang/rust/issues/90309
2021-11-06 23:12:02 +01:00
Caleb Cartwright
19c5c74951 refactor: dedupe & simplify ty alias formatting 2021-11-06 16:06:21 -05:00
bors
0727994435 Auto merge of #90655 - the8472:drain-dot-dot, r=jyn514
Replace some uses of vec.drain(..) with vec.into_iter()

IntoIter should optimize better than Drain
2021-11-06 20:14:37 +00:00
Guillaume Gomez
aa6f6f47cd Add test for removed one character last line in rustdoc 2021-11-06 20:21:29 +01:00
Guillaume Gomez
e8f1d57d80 Fix last doc code comment being removed if it only had one character 2021-11-06 20:21:29 +01:00
Caio
7fd15f0900 Move some tests to more reasonable directories 2021-11-06 15:35:20 -03:00