]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agofix aarch test error annotations
asquared31415 [Fri, 12 Nov 2021 15:30:20 +0000 (10:30 -0500)]
fix aarch test error annotations

2 years agoadd missing sym feature
asquared31415 [Wed, 10 Nov 2021 06:35:39 +0000 (01:35 -0500)]
add missing sym feature

2 years agoFix aarch tests
asquared31415 [Sun, 17 Oct 2021 07:30:24 +0000 (03:30 -0400)]
Fix aarch tests

2 years agoAdd support for specifying multiple clobber_abi in `asm!`
asquared31415 [Thu, 14 Oct 2021 07:23:09 +0000 (03:23 -0400)]
Add support for specifying multiple clobber_abi in `asm!`
Allow multiple clobber_abi in asm

Update docs
Fix aarch64 test
Combine abis
Emit duplicate ABI error, empty ABI list error
multiple clobber_abi

2 years agoAuto merge of #87337 - jyn514:lint-error, r=oli-obk,flip1995
bors [Tue, 9 Nov 2021 08:21:10 +0000 (08:21 +0000)]
Auto merge of #87337 - jyn514:lint-error, r=oli-obk,flip1995

Don't abort compilation after giving a lint error

The only reason to use `abort_if_errors` is when the program is so broken that either:
1. later passes get confused and ICE
2. any diagnostics from later passes would be noise

This is never the case for lints, because the compiler has to be able to deal with `allow`-ed lints.
So it can continue to lint and compile even if there are lint errors.

Closes https://github.com/rust-lang/rust/issues/82761. This is a WIP because I have a feeling it will exit with 0 even if there were lint errors; I don't have a computer that can build rustc locally at the moment.

2 years agoAuto merge of #90485 - camsteffen:fmt-args-less-bind, r=m-ou-se
bors [Tue, 9 Nov 2021 05:33:16 +0000 (05:33 +0000)]
Auto merge of #90485 - camsteffen:fmt-args-less-bind, r=m-ou-se

Don't destructure args tuple in format_args!

This allows Clippy to parse the HIR more simply since `arg0` is changed to `_args.0`. (cc rust-lang/rust-clippy#7843). From rustc's perspective, I think this is something between a lateral move and a tiny improvement since there are fewer bindings.

r? `@m-ou-se`

2 years agoAuto merge of #90695 - GuillaumeGomez:rollup-kxvvw4o, r=GuillaumeGomez
bors [Tue, 9 Nov 2021 01:30:23 +0000 (01:30 +0000)]
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 (:arrow_up: rust-analyzer)

Failed merges:

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

2 years agoAuto merge of #90443 - camelid:rustdoc-subst, r=GuillaumeGomez
bors [Mon, 8 Nov 2021 21:37:59 +0000 (21:37 +0000)]
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`

2 years agoRollup merge of #90689 - lnicola:rust-analyzer-2021-11-08, r=lnicola
Guillaume Gomez [Mon, 8 Nov 2021 14:15:25 +0000 (15:15 +0100)]
Rollup merge of #90689 - lnicola:rust-analyzer-2021-11-08, r=lnicola

:arrow_up: rust-analyzer

r? ``@ghost``

2 years agoRollup merge of #90657 - GuillaumeGomez:one-char-last-line-removed, r=jyn514
Guillaume Gomez [Mon, 8 Nov 2021 14:15:24 +0000 (15:15 +0100)]
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.

2 years agoRollup merge of #90652 - matthiaskrgr:unnnec_filter_map, r=jyn514
Guillaume Gomez [Mon, 8 Nov 2021 14:15:23 +0000 (15:15 +0100)]
Rollup merge of #90652 - matthiaskrgr:unnnec_filter_map, r=jyn514

use filter(|x| matches!(..)) instead of filter_map(|x| match x ... => Some(xy))

2 years agoRollup merge of #90494 - Meziu:armv6k-3ds-target, r=sanxiyn
Guillaume Gomez [Mon, 8 Nov 2021 14:15:22 +0000 (15:15 +0100)]
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.

2 years agoAuto merge of #90361 - Mark-Simulacrum:always-verify, r=michaelwoerister
bors [Mon, 8 Nov 2021 13:38:08 +0000 (13:38 +0000)]
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`

2 years ago:arrow_up: rust-analyzer
Laurențiu Nicola [Mon, 8 Nov 2021 10:07:03 +0000 (12:07 +0200)]
:arrow_up: rust-analyzer

2 years agoAuto merge of #90675 - camelid:cleanup-impl, r=jyn514
bors [Mon, 8 Nov 2021 08:21:51 +0000 (08:21 +0000)]
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`

2 years agoAuto merge of #90680 - calebcartwright:rustfmt-sync, r=calebcartwright
bors [Mon, 8 Nov 2021 05:13:41 +0000 (05:13 +0000)]
Auto merge of #90680 - calebcartwright:rustfmt-sync, r=calebcartwright

sync rustfmt subtree

2 years agoMerge commit 'ea199bacef07213dbe008841b89c450e3bf0c638' into rustfmt-sync
Caleb Cartwright [Mon, 8 Nov 2021 02:37:34 +0000 (20:37 -0600)]
Merge commit 'ea199bacef07213dbe008841b89c450e3bf0c638' into rustfmt-sync

2 years agorustdoc: Remove top-level wrappers for `ImplKind` methods
Noah Lev [Mon, 8 Nov 2021 02:26:37 +0000 (18:26 -0800)]
rustdoc: Remove top-level wrappers for `ImplKind` methods

The `ImplKind` methods can just be used directly instead.

2 years agoAuto merge of #89488 - c410-f3r:testsssssss, r=petrochenkov
bors [Mon, 8 Nov 2021 02:04:31 +0000 (02:04 +0000)]
Auto merge of #89488 - c410-f3r:testsssssss, r=petrochenkov

Move some tests to more reasonable directories - 8

cc #73494
r? `@petrochenkov`

2 years agoMerge pull request #5070 from calebcartwright/rustup-2021-11-s1
Caleb Cartwright [Mon, 8 Nov 2021 01:40:15 +0000 (19:40 -0600)]
Merge pull request #5070 from calebcartwright/rustup-2021-11-s1

subtree sync

2 years agoUse `has_errors_or_lint_errors` in rustdoc instead of `abort_if_errors()`
Joshua Nelson [Thu, 16 Sep 2021 05:35:23 +0000 (05:35 +0000)]
Use `has_errors_or_lint_errors` in rustdoc instead of `abort_if_errors()`

Rustdoc is special as usual and doesn't go through RunCompiler, so it
needs its own explicit checks. The rest of the tools go through
RunCompiler, so they should be fine.

2 years agoDon't proceed to codegen if there are lint errors
Joshua Nelson [Thu, 22 Jul 2021 23:47:46 +0000 (23:47 +0000)]
Don't proceed to codegen if there are lint errors

2 years agoDon't abort compilation after giving a lint error
Joshua Nelson [Wed, 21 Jul 2021 03:23:22 +0000 (23:23 -0400)]
Don't abort compilation after giving a lint error

The only reason to use `abort_if_errors` is when the program is so broken that either:
1. later passes get confused and ICE
2. any diagnostics from later passes would be noise

This is never the case for lints, because the compiler has to be able to deal with `allow`-ed lints.
So it can continue to lint and compile even if there are lint errors.

2 years agochore: bump toolchain
Caleb Cartwright [Mon, 8 Nov 2021 01:06:24 +0000 (19:06 -0600)]
chore: bump toolchain

2 years agoAuto merge of #88368 - jyn514:metadata-error, r=petrochenkov
bors [Sun, 7 Nov 2021 23:03:55 +0000 (23:03 +0000)]
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`

2 years agoMerge remote-tracking branch 'upstream/master' into rustup-2021-11-s1
Caleb Cartwright [Sun, 7 Nov 2021 20:44:33 +0000 (14:44 -0600)]
Merge remote-tracking branch 'upstream/master' into rustup-2021-11-s1

2 years agoAuto merge of #90668 - matthiaskrgr:clippy_nov7, r=jyn514
bors [Sun, 7 Nov 2021 20:04:54 +0000 (20:04 +0000)]
Auto merge of #90668 - matthiaskrgr:clippy_nov7, r=jyn514

more clippy fixes

2 years agoRemove Clean impl for `&T`
Noah Lev [Sun, 7 Nov 2021 17:23:33 +0000 (09:23 -0800)]
Remove Clean impl for `&T`

2 years agoRemove unused Clean impl for `Rc<T>`
Noah Lev [Sun, 7 Nov 2021 17:20:35 +0000 (09:20 -0800)]
Remove unused Clean impl for `Rc<T>`

2 years agoRemove Clean impl for `Vec<T>`
Noah Lev [Sun, 7 Nov 2021 17:19:25 +0000 (09:19 -0800)]
Remove Clean impl for `Vec<T>`

2 years agoRemove Clean impl for `IndexVec<T>`
Noah Lev [Sun, 7 Nov 2021 17:09:10 +0000 (09:09 -0800)]
Remove Clean impl for `IndexVec<T>`

2 years agoRemove Clean impl for `Option<T>`
Noah Lev [Sun, 7 Nov 2021 17:06:50 +0000 (09:06 -0800)]
Remove Clean impl for `Option<T>`

2 years agorustdoc: Use `ty::ImplPolarity` instead of custom enum
Noah Lev [Sun, 7 Nov 2021 16:57:33 +0000 (08:57 -0800)]
rustdoc: Use `ty::ImplPolarity` instead of custom enum

2 years agoUse an enum to record polarity in `clean::Impl`
Noah Lev [Sun, 7 Nov 2021 16:52:28 +0000 (08:52 -0800)]
Use an enum to record polarity in `clean::Impl`

2 years agorustdoc: Refactor `Impl.{synthetic,blanket_impl}` into enum
Noah Lev [Sun, 7 Nov 2021 06:10:01 +0000 (23:10 -0700)]
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.

2 years agomore clippy fixes
Matthias Krüger [Sun, 7 Nov 2021 09:33:27 +0000 (10:33 +0100)]
more clippy fixes

2 years agoAuto merge of #90671 - petrochenkov:astnaming, r=jackh726
bors [Sun, 7 Nov 2021 15:19:11 +0000 (15:19 +0000)]
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.

2 years agoImprove error when an .rlib can't be parsed
Joshua Nelson [Thu, 26 Aug 2021 18:37:44 +0000 (18:37 +0000)]
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
```

2 years agorefactor: dedupe associated item visitation
Caleb Cartwright [Sat, 6 Nov 2021 22:12:25 +0000 (17:12 -0500)]
refactor: dedupe associated item visitation

2 years agoast: Fix naming conventions in AST structures
Vadim Petrochenkov [Sun, 7 Nov 2021 08:43:49 +0000 (16:43 +0800)]
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.

2 years agoast: Fix naming conventions in AST structures
Vadim Petrochenkov [Sun, 7 Nov 2021 08:43:49 +0000 (16:43 +0800)]
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.

2 years agoAuto merge of #89310 - joshtriplett:available-concurrency-affinity, r=m-ou-se
bors [Sun, 7 Nov 2021 11:53:25 +0000 (11:53 +0000)]
Auto merge of #89310 - joshtriplett:available-concurrency-affinity, r=m-ou-se

Make `std::thread::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.

2 years agorustdoc: Remove redundant `Impl.span` field
Noah Lev [Sun, 31 Oct 2021 21:49:32 +0000 (14:49 -0700)]
rustdoc: Remove redundant `Impl.span` field

It can be computed on-demand in `Item::span()`.

2 years agoAuto merge of #90348 - Amanieu:asm_feature_gates, r=joshtriplett
bors [Sun, 7 Nov 2021 04:59:42 +0000 (04:59 +0000)]
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`

2 years agoRestrict tests that use needs-asm-support to non-experimental
Amanieu d'Antras [Wed, 3 Nov 2021 16:10:09 +0000 (16:10 +0000)]
Restrict tests that use needs-asm-support to non-experimental
architectures

2 years agoAuto merge of #90635 - matthiaskrgr:rustdoc_compl, r=GuillaumeGomez
bors [Sun, 7 Nov 2021 02:17:35 +0000 (02:17 +0000)]
Auto merge of #90635 - matthiaskrgr:rustdoc_compl, r=GuillaumeGomez

rustdoc: clippy::complexity fixes

2 years agoAdd features gates for experimental asm features
Amanieu d'Antras [Wed, 27 Oct 2021 17:37:18 +0000 (18:37 +0100)]
Add features gates for experimental asm features

2 years agoAuto merge of #90661 - matthiaskrgr:rollup-1umbdlx, r=matthiaskrgr
bors [Sat, 6 Nov 2021 22:55:37 +0000 (22:55 +0000)]
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

2 years agoRollup merge of #90649 - cjgillot:reveal-all-2, r=lcnr
Matthias Krüger [Sat, 6 Nov 2021 22:12:06 +0000 (23:12 +0100)]
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``

2 years agoRollup merge of #90646 - BoxyUwU:funky_ice, r=estebank
Matthias Krüger [Sat, 6 Nov 2021 22:12:06 +0000 (23:12 +0100)]
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`

2 years agoRollup merge of #90642 - matthiaskrgr:clippy_matches, r=cjgillot
Matthias Krüger [Sat, 6 Nov 2021 22:12:05 +0000 (23:12 +0100)]
Rollup merge of #90642 - matthiaskrgr:clippy_matches, r=cjgillot

use matches!() macro in more places

2 years agoRollup merge of #90627 - camelid:suggest-box-deref, r=davidtwco
Matthias Krüger [Sat, 6 Nov 2021 22:12:04 +0000 (23:12 +0100)]
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``

2 years agoRollup merge of #90508 - nbdd0121:issue-90483, r=davidtwco
Matthias Krüger [Sat, 6 Nov 2021 22:12:03 +0000 (23:12 +0100)]
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

2 years agoRollup merge of #90487 - NoraCodes:nora/how-to-read-rustdoc, r=jyn514
Matthias Krüger [Sat, 6 Nov 2021 22:12:02 +0000 (23:12 +0100)]
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

2 years agorefactor: dedupe & simplify ty alias formatting
Caleb Cartwright [Sat, 6 Nov 2021 17:59:06 +0000 (12:59 -0500)]
refactor: dedupe & simplify ty alias formatting

2 years agoFix Clippy with changed format_args!
Cameron Steffen [Sat, 6 Nov 2021 21:03:32 +0000 (16:03 -0500)]
Fix Clippy with changed format_args!

2 years agoAuto merge of #90655 - the8472:drain-dot-dot, r=jyn514
bors [Sat, 6 Nov 2021 20:14:37 +0000 (20:14 +0000)]
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

2 years agoFactor out some Vecs
Cameron Steffen [Mon, 1 Nov 2021 19:12:17 +0000 (14:12 -0500)]
Factor out some Vecs

2 years agoDon't destructure args tuple in format_args!
Cameron Steffen [Mon, 1 Nov 2021 16:56:38 +0000 (11:56 -0500)]
Don't destructure args tuple in format_args!

2 years agoAdd test for removed one character last line in rustdoc
Guillaume Gomez [Sat, 6 Nov 2021 18:42:43 +0000 (19:42 +0100)]
Add test for removed one character last line in rustdoc

2 years agoFix last doc code comment being removed if it only had one character
Guillaume Gomez [Sat, 6 Nov 2021 18:41:33 +0000 (19:41 +0100)]
Fix last doc code comment being removed if it only had one character

2 years agoMove some tests to more reasonable directories
Caio [Sat, 6 Nov 2021 18:35:20 +0000 (15:35 -0300)]
Move some tests to more reasonable directories

2 years agoSuggest dereference of `Box` when inner type is expected
Noah Lev [Fri, 5 Nov 2021 06:25:16 +0000 (23:25 -0700)]
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 `elem` with `Ty::List`,
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)),
      |                               ~~~~~~~~~~~~~~

2 years agoReplace some uses of vec.drain(..) with vec.into_iter()
The8472 [Sat, 6 Nov 2021 17:42:07 +0000 (18:42 +0100)]
Replace some uses of vec.drain(..) with vec.into_iter()

IntoIter should optimize better than Drain

2 years agouse filter(|x| matches!(..)) instead of filter_map(|x| match x ... => Some(xy))
Matthias Krüger [Sat, 6 Nov 2021 15:36:23 +0000 (16:36 +0100)]
use filter(|x| matches!(..)) instead of filter_map(|x| match x ... => Some(xy))

2 years agoAuto merge of #90559 - rusticstuff:optimize-bidi-detection, r=davidtwco
bors [Sat, 6 Nov 2021 16:25:00 +0000 (16:25 +0000)]
Auto merge of #90559 - rusticstuff:optimize-bidi-detection, r=davidtwco

Optimize bidi character detection.

Should fix most of the performance regression of the bidi character detection (#90514), to be confirmed with a perf run.

2 years agouse matches!() macro in more places
Matthias Krüger [Sat, 6 Nov 2021 00:31:32 +0000 (01:31 +0100)]
use matches!() macro in more places

2 years agoRun reveal_all on MIR more often.
Camille GILLOT [Sat, 6 Nov 2021 14:56:29 +0000 (15:56 +0100)]
Run reveal_all on MIR more often.

2 years agoAuto merge of #90641 - matthiaskrgr:mut, r=cjgillot
bors [Sat, 6 Nov 2021 13:19:22 +0000 (13:19 +0000)]
Auto merge of #90641 - matthiaskrgr:mut, r=cjgillot

pointee_info_at() does not need mutable access

2 years agotype error go brrrrrrrr
Ellen [Sat, 6 Nov 2021 10:32:11 +0000 (10:32 +0000)]
type error go brrrrrrrr

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 agoPut empty trait braces on same line if possible
mujpao [Tue, 2 Nov 2021 06:13:30 +0000 (23:13 -0700)]
Put empty trait braces on same line if possible

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 agoUpdate IntelliJ Integration (#4238)
Dmitry Murzin [Sat, 6 Jun 2020 14:19:50 +0000 (17:19 +0300)]
Update IntelliJ Integration (#4238)

2 years agopointee_info_at() does not need mutable access
Matthias Krüger [Sat, 6 Nov 2021 00:03:56 +0000 (01:03 +0100)]
pointee_info_at() does not need mutable access

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 agorustdoc: clippy::complexity fixes
Matthias Krüger [Fri, 5 Nov 2021 21:06:17 +0000 (22:06 +0100)]
rustdoc: clippy::complexity fixes

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 agoAdd a chapter on reading Rustdoc output
Leonora Tindall [Mon, 1 Nov 2021 21:45:01 +0000 (16:45 -0500)]
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.

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)