]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoEnable 2021 compatibility lints for all in-tree code
Mark Rousskov [Sat, 18 Sep 2021 21:37:24 +0000 (17:37 -0400)]
Enable 2021 compatibility lints for all in-tree code

This just applies the suggested fixes from the compatibility warnings,
leaving any that are in practice spurious in. This is primarily intended to
provide a starting point to identify possible fixes to the migrations (e.g., by
avoiding spurious warnings).

A secondary commit cleans these up where they are false positives (as is true in
many of the cases).

2 years agoUpdate permissions path for clippy lint
Guillaume Gomez [Mon, 13 Sep 2021 19:27:53 +0000 (21:27 +0200)]
Update permissions path for clippy lint

2 years agoAuto merge of #88517 - smoelius:without-patch-versions, r=flip1995
bors [Mon, 13 Sep 2021 02:45:18 +0000 (02:45 +0000)]
Auto merge of #88517 - smoelius:without-patch-versions, r=flip1995

Update Clippy dependencies without patch versions

Trial run for https://github.com/rust-lang/rust-clippy/pull/7606

2 years agoAuto merge of #88839 - nbdd0121:alignof, r=nagisa
bors [Sun, 12 Sep 2021 23:49:24 +0000 (23:49 +0000)]
Auto merge of #88839 - nbdd0121:alignof, r=nagisa

Introduce NullOp::AlignOf

This PR introduces `Rvalue::NullaryOp(NullOp::AlignOf, ty)`, which will be lowered from `align_of`, similar to `size_of` lowering to `Rvalue::NullaryOp(NullOp::SizeOf, ty)`.

The changes are originally part of #88700 but since it's not dependent on other changes and could have performance impact on its own, it's separated into its own PR.

2 years agoIntroduce NullOp::AlignOf
Gary Guo [Tue, 7 Sep 2021 15:06:07 +0000 (16:06 +0100)]
Introduce NullOp::AlignOf

2 years agoRollup merge of #88677 - petrochenkov:exportid, r=davidtwco
Manish Goregaokar [Sun, 12 Sep 2021 10:44:53 +0000 (03:44 -0700)]
Rollup merge of #88677 - petrochenkov:exportid, r=davidtwco

rustc: Remove local variable IDs from `Export`s

Local variables can never be exported.

2 years agoAuto merge of #84373 - cjgillot:resolve-span, r=michaelwoerister,petrochenkov
bors [Sat, 11 Sep 2021 23:35:28 +0000 (23:35 +0000)]
Auto merge of #84373 - cjgillot:resolve-span, r=michaelwoerister,petrochenkov

Encode spans relative to the enclosing item

The aim of this PR is to avoid recomputing queries when code is moved without modification.

MCP at https://github.com/rust-lang/compiler-team/issues/443

This is achieved by :
1. storing the HIR owner LocalDefId information inside the span;
2. encoding and decoding spans relative to the enclosing item in the incremental on-disk cache;
3. marking a dependency to the `source_span(LocalDefId)` query when we translate a span from the short (`Span`) representation to its explicit (`SpanData`) representation.

Since all client code uses `Span`, step 3 ensures that all manipulations
of span byte positions actually create the dependency edge between
the caller and the `source_span(LocalDefId)`.
This query return the actual absolute span of the parent item.
As a consequence, any source code motion that changes the absolute byte position of a node will either:
- modify the distance to the parent's beginning, so change the relative span's hash;
- dirty `source_span`, and trigger the incremental recomputation of all code that
  depends on the span's absolute byte position.

With this scheme, I believe the dependency tracking to be accurate.

For the moment, the spans are marked during lowering.
I'd rather do this during def-collection,
but the AST MutVisitor is not practical enough just yet.
The only difference is that we attach macro-expanded spans
to their expansion point instead of the macro itself.

2 years agoRebase fallout.
Camille GILLOT [Fri, 10 Sep 2021 17:57:06 +0000 (19:57 +0200)]
Rebase fallout.

2 years agoAuto merge of #88214 - notriddle:notriddle/for-loop-span-drop-temps-mut, r=nagisa
bors [Sat, 11 Sep 2021 07:11:01 +0000 (07:11 +0000)]
Auto merge of #88214 - notriddle:notriddle/for-loop-span-drop-temps-mut, r=nagisa

rustc: use more correct span data in for loop desugaring

Fixes #82462

Before:

      help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped
         |
      LL |     for x in DroppingSlice(&*v).iter(); {
         |                                       +

After:

      help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped
         |
      LL |     };
         |      +

This seems like a reasonable fix: since the desugared "expr_drop_temps_mut" contains the entire desugared loop construct, its span should contain the entire loop construct as well.

2 years agorustc: Remove local variable IDs from `Export`s
Vadim Petrochenkov [Sun, 5 Sep 2021 20:37:15 +0000 (23:37 +0300)]
rustc: Remove local variable IDs from `Export`s

Local variables can never be exported.

2 years agoKeep a parent LocalDefId in SpanData.
Camille GILLOT [Sun, 18 Apr 2021 12:27:04 +0000 (14:27 +0200)]
Keep a parent LocalDefId in SpanData.

2 years agoIgnore automatically derived impls of `Clone` and `Debug` in dead code analysis
Fabian Wolff [Fri, 21 May 2021 17:35:49 +0000 (19:35 +0200)]
Ignore automatically derived impls of `Clone` and `Debug` in dead code analysis

2 years agoUpdate dependencies
Samuel E. Moelius III [Thu, 9 Sep 2021 09:19:03 +0000 (05:19 -0400)]
Update dependencies

2 years agoPrep for upgrade to cargo_metadata 0.14.0
Samuel E. Moelius III [Wed, 1 Sep 2021 22:31:42 +0000 (18:31 -0400)]
Prep for upgrade to cargo_metadata 0.14.0

2 years agoAuto merge of #88615 - flip1995:clippyup, r=Manishearth
bors [Wed, 8 Sep 2021 23:52:31 +0000 (23:52 +0000)]
Auto merge of #88615 - flip1995:clippyup, r=Manishearth

Update Clippy

r? `@Manishearth`

2 years agoMerge commit '27afd6ade4bb1123a8bf82001629b69d23d62aff' into clippyup
flip1995 [Wed, 8 Sep 2021 14:31:47 +0000 (16:31 +0200)]
Merge commit '27afd6ade4bb1123a8bf82001629b69d23d62aff' into clippyup

2 years agoRename rustc_mir to rustc_const_eval.
Camille GILLOT [Tue, 5 Jan 2021 19:08:11 +0000 (20:08 +0100)]
Rename rustc_mir to rustc_const_eval.

2 years agoMove the dataflow framework to its own crate.
Camille GILLOT [Tue, 5 Jan 2021 18:53:07 +0000 (19:53 +0100)]
Move the dataflow framework to its own crate.

2 years agofix(clippy): update loop lints to use arg.span
Michael Howell [Tue, 7 Sep 2021 06:30:04 +0000 (23:30 -0700)]
fix(clippy): update loop lints to use arg.span

Adapts clippy for fe1a7f71fbf3cf845a09a9b333a6adcf7e839607

2 years agoAuto merge of #88493 - chenyukang:fix-duplicated-diagnostic, r=estebank
bors [Mon, 6 Sep 2021 00:14:41 +0000 (00:14 +0000)]
Auto merge of #88493 - chenyukang:fix-duplicated-diagnostic, r=estebank

Fix #88256 remove duplicated diagnostics

Fix #88256

2 years agoAuto merge of #88499 - eddyb:layout-off, r=nagisa
bors [Sun, 5 Sep 2021 16:14:41 +0000 (16:14 +0000)]
Auto merge of #88499 - eddyb:layout-off, r=nagisa

Provide `layout_of` automatically (given tcx + param_env + error handling).

After #88337, there's no longer any uses of `LayoutOf` within `rustc_target` itself, so I realized I could move the trait to `rustc_middle::ty::layout` and redesign it a bit.

This is similar to #88338 (and supersedes it), but at no ergonomic loss, since there's no funky `C: LayoutOf<Ty = Ty>` -> `Ty: TyAbiInterface<C>` generic `impl` chain, and each `LayoutOf` still corresponds to one `impl` (of `LayoutOfHelpers`) for the specific context.

After this PR, this is what's needed to get `trait LayoutOf` (with the `layout_of` method) implemented on some context type:
* `TyCtxt`, via `HasTyCtxt`
* `ParamEnv`, via `HasParamEnv`
* a way to transform `LayoutError`s into the desired error type
  * an error type of `!` can be paired with having `cx.layout_of(...)` return `TyAndLayout` *without* `Result<...>` around it, such as used by codegen
  * this is done through a new `LayoutOfHelpers` trait (and so is specifying the type of `cx.layout_of(...)`)

When going through this path (and not bypassing it with a manual `impl` of `LayoutOf`), the end result is that only the error case can be customized, the query itself and the success paths are guaranteed to be uniform.

(**EDIT**: just noticed that because of the supertrait relationship, you cannot actually implement `LayoutOf` yourself, the blanket `impl` fully covers all possible context types that could ever implement it)

Part of the motivation for this shape of API is that I've been working on querifying `FnAbi::of_*`, and what I want/need to introduce for that looks a lot like the setup in this PR - in particular, it's harder to express the `FnAbi` methods in `rustc_target`, since they're much more tied to `rustc` concepts.

r? `@nagisa` cc `@oli-obk` `@bjorn3`

2 years agoFix #88256, remove duplicated diagnostic
yukang [Sat, 4 Sep 2021 11:26:25 +0000 (19:26 +0800)]
Fix #88256, remove duplicated diagnostic

2 years agoAuto merge of #88363 - michaelwoerister:remapped-diagnostics, r=estebank
bors [Fri, 3 Sep 2021 00:23:10 +0000 (00:23 +0000)]
Auto merge of #88363 - michaelwoerister:remapped-diagnostics, r=estebank

Path remapping: Make behavior of diagnostics output dependent on presence of --remap-path-prefix.

This PR fixes a regression (#87745) with `--remap-path-prefix` where the flag stopped causing diagnostic messages to be remapped as well. The regression was introduced in https://github.com/rust-lang/rust/pull/83813 where we erroneously assumed that remapping of diagnostic messages was not desired anymore (because #70642 partially undid that functionality with nobody objecting).

The issue is fixed by making `--remap-path-prefix` remap diagnostic messages again, including for paths that have been remapped in upstream crates (e.g. the standard library). This means that "sysroot-localization" (implemented in #70642) is also disabled if `rustc` is invoked with `--remap-path-prefix`. The assumption is that once someone starts explicitly remapping paths they also don't want paths to their local Rust installation in their build output.

In the future we might want to give more fine-grained control over this behavior via compiler flags (see https://github.com/rust-lang/rfcs/pull/3127 for a related RFC). For now this PR is intended as a regression fix.

This PR is an alternative to https://github.com/rust-lang/rust/pull/88191, which makes diagnostic messages be remapped unconditionally. That approach, however, would effectively revert #70642.

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

cc `@cbeuw`
r? `@ghost`

2 years agorustc_target: move `LayoutOf` to `ty::layout`.
Eduard-Mihai Burtescu [Mon, 30 Aug 2021 14:38:27 +0000 (17:38 +0300)]
rustc_target: move `LayoutOf` to `ty::layout`.

2 years agoFix clippy for let-else
Cameron Steffen [Sun, 25 Jul 2021 23:27:44 +0000 (18:27 -0500)]
Fix clippy for let-else

2 years ago`feature(const_generics)` -> `feature(const_param_types)`
lcnr [Fri, 27 Aug 2021 16:04:57 +0000 (18:04 +0200)]
`feature(const_generics)` -> `feature(const_param_types)`

2 years agorename const_evaluatable_checked to generic_const_exprs
Ellen [Wed, 25 Aug 2021 09:21:39 +0000 (10:21 +0100)]
rename const_evaluatable_checked to generic_const_exprs

:sparkles:

2 years agoTeach tools that macros are now HIR items
inquisitivecrystal [Thu, 5 Aug 2021 23:58:46 +0000 (16:58 -0700)]
Teach tools that macros are now HIR items

2 years agoTreat macros as HIR items
inquisitivecrystal [Sat, 31 Jul 2021 06:50:57 +0000 (23:50 -0700)]
Treat macros as HIR items

2 years agoPath remapping: Make behavior of diagnostics output dependent on presence of --remap...
Michael Woerister [Thu, 26 Aug 2021 10:46:01 +0000 (12:46 +0200)]
Path remapping: Make behavior of diagnostics output dependent on presence of --remap-path-prefix.

2 years agoupdate `TypeFlags` to deal with missing ct substs
lcnr [Sat, 17 Jul 2021 16:48:07 +0000 (18:48 +0200)]
update `TypeFlags` to deal with missing ct substs

2 years agoadd `tcx` to `fn walk`
lcnr [Sat, 17 Jul 2021 14:43:23 +0000 (16:43 +0200)]
add `tcx` to `fn walk`

2 years agomake unevaluated const substs optional
lcnr [Mon, 15 Mar 2021 23:05:45 +0000 (00:05 +0100)]
make unevaluated const substs optional

2 years agorequire a `tcx` for `TypeVisitor`
lcnr [Sat, 13 Mar 2021 15:05:15 +0000 (16:05 +0100)]
require a `tcx` for `TypeVisitor`

2 years agoAuto merge of #83302 - camsteffen:write-piece-unchecked, r=dtolnay
bors [Mon, 23 Aug 2021 22:55:19 +0000 (22:55 +0000)]
Auto merge of #83302 - camsteffen:write-piece-unchecked, r=dtolnay

Get piece unchecked in `write`

We already use specialized `zip`, but it seems like we can do a little better by not checking `pieces` length at all.

`Arguments` constructors are now unsafe. So the `format_args!` expansion now includes an `unsafe` block.

<details>
<summary>Local Bench Diff</summary>

```text
 name                        before ns/iter  after ns/iter  diff ns/iter   diff %  speedup
 fmt::write_str_macro1       22,967          19,718               -3,249  -14.15%   x 1.16
 fmt::write_str_macro2       35,527          32,654               -2,873   -8.09%   x 1.09
 fmt::write_str_macro_debug  571,953         575,973               4,020    0.70%   x 0.99
 fmt::write_str_ref          9,579           9,459                  -120   -1.25%   x 1.01
 fmt::write_str_value        9,573           9,572                    -1   -0.01%   x 1.00
 fmt::write_u128_max         176             173                      -3   -1.70%   x 1.02
 fmt::write_u128_min         138             134                      -4   -2.90%   x 1.03
 fmt::write_u64_max          139             136                      -3   -2.16%   x 1.02
 fmt::write_u64_min          129             135                       6    4.65%   x 0.96
 fmt::write_vec_macro1       24,401          22,273               -2,128   -8.72%   x 1.10
 fmt::write_vec_macro2       37,096          35,602               -1,494   -4.03%   x 1.04
 fmt::write_vec_macro_debug  588,291         589,575               1,284    0.22%   x 1.00
 fmt::write_vec_ref          9,568           9,732                   164    1.71%   x 0.98
 fmt::write_vec_value        9,516           9,625                   109    1.15%   x 0.99
```
</details>

2 years agoRollup merge of #88230 - steffahn:a_an, r=oli-obk
Mara Bos [Mon, 23 Aug 2021 18:45:49 +0000 (20:45 +0200)]
Rollup merge of #88230 - steffahn:a_an, r=oli-obk

Fix typos “a”→“an”

Fix typos in comments; found using a regex to find some easy instance of incorrect usage of a vs. an.

While automation was used to find these, every change was checked manually.

Changes in submodules get separate PRs:
* https://github.com/rust-lang/stdarch/pull/1201
* https://github.com/rust-lang/cargo/pull/9821
* https://github.com/rust-lang/miri/pull/1874
* https://github.com/rust-lang/rls/pull/1746
* https://github.com/rust-analyzer/rust-analyzer/pull/9984
  _folks @ rust-analyzer are fast at merging…_
  * https://github.com/rust-analyzer/rust-analyzer/pull/9985
  * https://github.com/rust-analyzer/rust-analyzer/pull/9987
  * https://github.com/rust-analyzer/rust-analyzer/pull/9989

_For `clippy`, I don’t know if the changes should better better be moved to a PR to the original repo._

<hr>

This has some overlap with #88226, but neither is a strict superset of the other.

If you want multiple commits, I can split it up; in that case, make sure to suggest a criterion for splitting.

2 years agoRollup merge of #88211 - petrochenkov:withhilo, r=jyn514
Guillaume Gomez [Sun, 22 Aug 2021 18:52:54 +0000 (20:52 +0200)]
Rollup merge of #88211 - petrochenkov:withhilo, r=jyn514

cleanup: `Span::new` -> `Span::with_lo`

Extracted from https://github.com/rust-lang/rust/pull/84373 as suggested in https://github.com/rust-lang/rust/pull/84373#issuecomment-857773867.
It turned out less useful then I expected, but anyway.
r? `@cjgillot`
`@bors` rollup

2 years agoFix typos “an”→“a” and a few different ones that appeared in the same search
Frank Steffahn [Sun, 22 Aug 2021 16:15:49 +0000 (18:15 +0200)]
Fix typos “an”→“a” and a few different ones that appeared in the same search

2 years agoFix more “a”/“an” typos
Frank Steffahn [Sun, 22 Aug 2021 15:27:18 +0000 (17:27 +0200)]
Fix more “a”/“an” typos

2 years agoFix typos “a”→“an”
Frank Steffahn [Sun, 22 Aug 2021 12:46:15 +0000 (14:46 +0200)]
Fix typos “a”→“an”

2 years agoAuto merge of #88163 - camsteffen:collapsible-match-fix, r=Manishearth
bors [Sun, 22 Aug 2021 13:26:32 +0000 (13:26 +0000)]
Auto merge of #88163 - camsteffen:collapsible-match-fix, r=Manishearth

Fix clippy::collapsible_match with let expressions

This fixes rust-lang/rust-clippy#7575 which is a regression from #80357. I am fixing the bug here instead of in the clippy repo (if that's okay) because a) the regression has not been synced yet and b) I would like to land the fix on nightly asap.

The fix is basically to re-generalize `match` and `if let` for the lint implementation (they were split because `if let` no longer desugars to `match` in the HIR).

Also fixes rust-lang/rust-clippy#7586 and fixes rust-lang/rust-clippy#7591
cc `@rust-lang/clippy`
`@xFrednet` do you want to review this?

2 years agocleanup: `Span::new` -> `Span::with_lo`
Vadim Petrochenkov [Sat, 21 Aug 2021 15:07:21 +0000 (18:07 +0300)]
cleanup: `Span::new` -> `Span::with_lo`

2 years agointroduce a Coerce predicate
Niko Matsakis [Sat, 21 Nov 2020 12:06:16 +0000 (07:06 -0500)]
introduce a Coerce predicate

2 years agoFix clippy let expressions fallout
Cameron Steffen [Thu, 19 Aug 2021 18:31:25 +0000 (13:31 -0500)]
Fix clippy let expressions fallout

2 years agoremove box_syntax uses from cranelift and tools
Marcel Hellwig [Fri, 6 Aug 2021 15:14:27 +0000 (17:14 +0200)]
remove box_syntax uses from cranelift and tools

2 years agoclippy: Fix format_args expansion parsing
Cameron Steffen [Fri, 16 Jul 2021 13:54:08 +0000 (08:54 -0500)]
clippy: Fix format_args expansion parsing

2 years agoAuto merge of #84039 - jyn514:uplift-atomic-ordering, r=wesleywiser
bors [Mon, 16 Aug 2021 06:36:13 +0000 (06:36 +0000)]
Auto merge of #84039 - jyn514:uplift-atomic-ordering, r=wesleywiser

Uplift the invalid_atomic_ordering lint from clippy to rustc

This is mostly just a rebase of https://github.com/rust-lang/rust/pull/79654; I've copy/pasted the text from that PR below.

r? `@lcnr` since you reviewed the last one, but feel free to reassign.

---

This is an implementation of https://github.com/rust-lang/compiler-team/issues/390.

As mentioned, in general this turns an unconditional runtime panic into a (compile time) lint failure. It has no false positives, and the only false negatives I'm aware of are if `Ordering` isn't specified directly and is comes from an argument/constant/whatever.

As a result of it having no false positives, and the alternative always being strictly wrong, it's on as deny by default. This seems right.

In the [zulip stream](https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Uplift.20the.20.60invalid_atomic_ordering.60.20lint.20from.20clippy/near/218483957) `@joshtriplett` suggested that lang team should FCP this before landing it. Perhaps libs team cares too?

---

Some notes on the code for reviewers / others below

## Changes from clippy

The code is changed from [the implementation in clippy](https://github.com/rust-lang/rust-clippy/blob/68cf94f6a66e47234e3adefc6dfbe806cd6ad164/clippy_lints/src/atomic_ordering.rs) in the following ways:

1. Uses `Symbols` and `rustc_diagnostic_item`s instead of string literals.
    - It's possible I should have just invoked Symbol::intern for some of these instead? Seems better to use symbol, but it did require adding several.
2. The functions are moved to static methods inside the lint struct, as a way to namespace them.
    - There's a lot of other code in that file — which I picked as the location for this lint because `@jyn514` told me that seemed reasonable.
3. Supports unstable AtomicU128/AtomicI128.
    - I did this because it was almost easier to support them than not — not supporting them would have (ideally) required finding a way not to give them a `rustc_diagnostic_item`, which would have complicated an already big macro.
    - These don't have tests since I wasn't sure if/how I should make tests conditional on whether or not the target has the atomic... This is to a certain extent an issue of 64bit atomics too, but 128-bit atomics are much less common. Regardless, the existing tests should be *more* than thorough enough here.
4. Minor changes like:
    - grammar tweaks ("loads cannot have `Release` **and** `AcqRel` ordering" => "loads cannot have `Release` **or** `AcqRel` ordering")
    - function renames (`match_ordering_def_path` => `matches_ordering_def_path`),
    - avoiding clippy-specific helper methods that don't exist in rustc_lint and didn't seem worth adding for this case (for example `cx.struct_span_lint` vs clippy's `span_lint_and_help` helper).

## Potential issues

(This is just about the code in this PR, not conceptual issues with the lint or anything)

1. I'm not sure if I should have used a diagnostic item for `Ordering` and its variants (I couldn't figure out how really, so if I should do this some pointers would be appreciated).
    - It seems possible that failing to do this might possibly mean there are more cases this lint would miss, but I don't really know how `match_def_path` works and if it has any pitfalls like that, so maybe not.

2. I *think* I deprecated the lint in clippy (CC `@flip1995` who asked to be notified about clippy changes in the future in [this comment](https://github.com/rust-lang/rust/pull/75671#issuecomment-718731659)) but I'm not sure if I need to do anything else there.
    - I'm kind of hoping CI will catch if I missed anything, since `x.py test src/tools/clippy` fails with a lot of errors with and without my changes (and is probably a nonsense command regardless). Running `cargo test` from src/tools/clippy also fails with unrelated errors that seem like refactorings that didnt update clippy? So, honestly no clue.

3. I wasn't sure if the description/example I gave good. Hopefully it is. The example is less thorough than the one from clippy here: https://rust-lang.github.io/rust-clippy/master/index.html#invalid_atomic_ordering. Let me know if/how I should change it if it needs changing.

4. It pulls in the `if_chain` crate. This crate was already used in clippy, and seems like it's used elsewhere in rustc, but I'm willing to rewrite it to not use this if needed (I'd prefer not to, all things being equal).

2 years agoUplift the `invalid_atomic_ordering` lint from clippy to rustc
Thom Chiovoloni [Wed, 2 Dec 2020 23:16:12 +0000 (15:16 -0800)]
Uplift the `invalid_atomic_ordering` lint from clippy to rustc

- Deprecate clippy::invalid_atomic_ordering
- Use rustc_diagnostic_item for the orderings in the invalid_atomic_ordering lint
- Reduce code duplication
- Give up on making enum variants diagnostic items and just look for
`Ordering` instead

  I ran into tons of trouble with this because apparently the change to
  store HIR attrs in a side table also gave the DefIds of the
  constructor instead of the variant itself. So I had to change
  `matches_ordering` to also check the grandparent of the defid as well.

- Rename `atomic_ordering_x` symbols to just the name of the variant
- Fix typos in checks - there were a few places that said "may not be
  Release" in the diagnostic but actually checked for SeqCst in the lint.
- Make constant items const
- Use fewer diagnostic items
- Only look at arguments after making sure the method matches

  This prevents an ICE when there aren't enough arguments.

- Ignore trait methods
- Only check Ctors instead of going through `qpath_res`

  The functions take values, so this couldn't ever be anything else.

- Add if_chain to allowed dependencies
- Fix grammar
- Remove unnecessary allow

2 years agoIntroduce hir::ExprKind::Let - Take 2
Caio [Sun, 8 Aug 2021 14:49:13 +0000 (11:49 -0300)]
Introduce hir::ExprKind::Let - Take 2

2 years agomove Constness into TraitPredicate
Deadbeef [Thu, 22 Jul 2021 13:56:07 +0000 (21:56 +0800)]
move Constness into TraitPredicate

2 years agoAuto merge of #87954 - flip1995:clippyup, r=Manishearth
bors [Fri, 13 Aug 2021 05:30:37 +0000 (05:30 +0000)]
Auto merge of #87954 - flip1995:clippyup, r=Manishearth

Update Clippy

r? `@Manishearth`

2 years agoRollup merge of #87885 - m-ou-se:edition-guide-links, r=rylev
Guillaume Gomez [Thu, 12 Aug 2021 11:25:07 +0000 (13:25 +0200)]
Rollup merge of #87885 - m-ou-se:edition-guide-links, r=rylev

Link to edition guide instead of issues for 2021 lints.

This changes the 2021 lints to not link to github issues, but to the edition guide instead.

Fixes  #86996

2 years agoMerge commit '7bfc26ec8e7a454786668e7e52ffe527fc649735' into clippyup
flip1995 [Thu, 12 Aug 2021 09:16:25 +0000 (11:16 +0200)]
Merge commit '7bfc26ec8e7a454786668e7e52ffe527fc649735' into clippyup

2 years agoBless clippy tests.
Mara Bos [Thu, 12 Aug 2021 08:48:16 +0000 (10:48 +0200)]
Bless clippy tests.

2 years agoupdate clippy
Esteban Kuber [Wed, 11 Aug 2021 14:21:33 +0000 (14:21 +0000)]
update clippy

2 years agoAuto merge of #87568 - petrochenkov:localevel, r=cjgillot
bors [Wed, 4 Aug 2021 02:04:04 +0000 (02:04 +0000)]
Auto merge of #87568 - petrochenkov:localevel, r=cjgillot

rustc: Replace `HirId`s with `LocalDefId`s in `AccessLevels` tables

and passes using those tables - primarily privacy checking, stability checking and dead code checking.

All these passes work with definitions rather than with arbitrary HIR nodes.
r? `@cjgillot`
cc `@lambinoo` (#87487)

2 years agoAuto merge of #87535 - lf-:authors, r=Mark-Simulacrum
bors [Mon, 2 Aug 2021 05:49:17 +0000 (05:49 +0000)]
Auto merge of #87535 - lf-:authors, r=Mark-Simulacrum

rfc3052 followup: Remove authors field from Cargo manifests

Since RFC 3052 soft deprecated the authors field, hiding it from
crates.io, docs.rs, and making Cargo not add it by default, and it is
not generally up to date/useful information for contributors, we may as well
remove it from crates in this repo.

2 years agobump bootstrap compiler to 1.55
Pietro Albini [Fri, 30 Jul 2021 12:46:56 +0000 (14:46 +0200)]
bump bootstrap compiler to 1.55

2 years agoFix clippy
Vadim Petrochenkov [Wed, 28 Jul 2021 22:07:32 +0000 (01:07 +0300)]
Fix clippy

2 years agoAuto merge of #86754 - estebank:use-multispans-more, r=varkor
bors [Fri, 30 Jul 2021 23:18:12 +0000 (23:18 +0000)]
Auto merge of #86754 - estebank:use-multispans-more, r=varkor

Use `multipart_suggestions` more

Built on top of #86532

2 years agoRollup merge of #87385 - Aaron1011:final-enable-semi, r=petrochenkov
Yuki Okushi [Fri, 30 Jul 2021 19:09:20 +0000 (04:09 +0900)]
Rollup merge of #87385 - Aaron1011:final-enable-semi, r=petrochenkov

Make `SEMICOLON_IN_EXPRESSIONS_FROM_MACROS` warn by default

This PR makes the `SEMICOLON_IN_EXPRESSIONS_FROM_MACROS` lint warn by default.

To avoid showing a large number of un-actionable warnings to users, we only enable the lint for macros defined in the same crate. This ensures that users will be able to fix the warning by simply removing a semicolon.

In the future, I'd like to enable this lint unconditionally, and eventually make it into a hard error in a future edition. This PR is a step towards that goal.

2 years agoUse multispan suggestions more often
Esteban Küber [Mon, 28 Jun 2021 18:22:47 +0000 (11:22 -0700)]
Use multispan suggestions more often

* Use more accurate span for `async move` suggestion
* Use more accurate span for deref suggestion
* Use `multipart_suggestion` more often

2 years agorfc3052: Remove authors field from Cargo manifests
Jade [Tue, 27 Jul 2021 23:38:13 +0000 (16:38 -0700)]
rfc3052: Remove authors field from Cargo manifests

Since RFC 3052 soft deprecated the authors field anyway, hiding it from
crates.io, docs.rs, and making Cargo not add it by default, and it is
not generally up to date/useful information, we should remove it from
crates in this repo.

2 years agoRemove unnecessary trailing semicolons from clippy tests
Aaron Hill [Thu, 29 Jul 2021 14:52:35 +0000 (09:52 -0500)]
Remove unnecessary trailing semicolons from clippy tests

2 years agoMerge commit '0cce3f643bfcbb92d5a1bb71858c9cbaff749d6b' into clippyup
flip1995 [Thu, 29 Jul 2021 10:16:06 +0000 (12:16 +0200)]
Merge commit '0cce3f643bfcbb92d5a1bb71858c9cbaff749d6b' into clippyup

2 years agoUpdate tests
Jacob Pratt [Thu, 3 Jun 2021 07:31:27 +0000 (03:31 -0400)]
Update tests

2 years agoAuto merge of #83484 - JulianKnodt:infer, r=oli-obk,lcnr
bors [Tue, 27 Jul 2021 16:24:45 +0000 (16:24 +0000)]
Auto merge of #83484 - JulianKnodt:infer, r=oli-obk,lcnr

Add hir::GenericArg::Infer

In order to extend inference to consts, make an Infer type on hir::GenericArg.

2 years agoActually infer args in visitors
kadmin [Thu, 6 May 2021 15:33:44 +0000 (15:33 +0000)]
Actually infer args in visitors

2 years agoAuto merge of #83723 - cjgillot:ownernode, r=petrochenkov
bors [Sun, 25 Jul 2021 11:11:02 +0000 (11:11 +0000)]
Auto merge of #83723 - cjgillot:ownernode, r=petrochenkov

Store all HIR owners in the same container

This replaces the previous storage in a BTreeMap for each of Item/ImplItem/TraitItem/ForeignItem.
This should allow for a more compact storage.

Based on https://github.com/rust-lang/rust/pull/83114

2 years agoIntroduce OwnerNode::Crate.
Camille GILLOT [Sun, 25 Jul 2021 10:03:24 +0000 (12:03 +0200)]
Introduce OwnerNode::Crate.

2 years agoAdd inferred args to typeck
kadmin [Mon, 26 Apr 2021 18:19:23 +0000 (18:19 +0000)]
Add inferred args to typeck

2 years agoAdd generic arg infer
kadmin [Sat, 24 Apr 2021 21:41:57 +0000 (21:41 +0000)]
Add generic arg infer

2 years agoupdate clippy ui test 'future_not_send.stderr' to match
chaz-kiker [Fri, 23 Jul 2021 17:30:52 +0000 (12:30 -0500)]
update clippy ui test 'future_not_send.stderr' to match
the new diagnostic messages

2 years agoMerge commit '4c41a222ca5d1325fb4b6709395bd06e766cc042' into clippyup
flip1995 [Mon, 19 Jul 2021 09:52:05 +0000 (11:52 +0200)]
Merge commit '4c41a222ca5d1325fb4b6709395bd06e766cc042' into clippyup

2 years agofix(clippy): add missing allow(dyn_drop)
Michael Howell [Sun, 18 Jul 2021 14:57:03 +0000 (07:57 -0700)]
fix(clippy): add missing allow(dyn_drop)

2 years agoAuto merge of #87140 - camsteffen:pat-slice-refs, r=oli-obk
bors [Fri, 16 Jul 2021 13:35:48 +0000 (13:35 +0000)]
Auto merge of #87140 - camsteffen:pat-slice-refs, r=oli-obk

Remove refs from Pat slices

Changes `PatKind::Or(&'hir [&'hir Pat<'hir>])` to `PatKind::Or(&'hir [Pat<'hir>])` and others. This is more consistent with `ExprKind`, saves a little memory, and is a little easier to use.

2 years agoRollup merge of #87069 - sexxi-goose:copy_ref_always, r=nikomatsakis
Guillaume Gomez [Fri, 16 Jul 2021 08:08:05 +0000 (10:08 +0200)]
Rollup merge of #87069 - sexxi-goose:copy_ref_always, r=nikomatsakis

ExprUseVisitor: Treat ByValue use of Copy types as ImmBorrow

r? ```@nikomatsakis```

2 years agoRemove refs from pat slices
Cameron Steffen [Wed, 14 Jul 2021 21:17:04 +0000 (16:17 -0500)]
Remove refs from pat slices

2 years agoMerge commit '54a20a02ecd0e1352a871aa0990bcc8b8b03173e' into clippyup
flip1995 [Thu, 15 Jul 2021 08:44:10 +0000 (10:44 +0200)]
Merge commit '54a20a02ecd0e1352a871aa0990bcc8b8b03173e' into clippyup

2 years agoExprUseVisitor::Delegate consume only when moving
Aman Arora [Wed, 14 Jul 2021 06:21:08 +0000 (02:21 -0400)]
ExprUseVisitor::Delegate consume only when moving

2 years agoAuto merge of #86827 - camsteffen:hash-lint-resolved, r=oli-obk
bors [Tue, 13 Jul 2021 15:06:10 +0000 (15:06 +0000)]
Auto merge of #86827 - camsteffen:hash-lint-resolved, r=oli-obk

Fix internal `default_hash_types` lint to use resolved path

I run into false positives now and then (mostly in Clippy) when I want to name some util after HashMap.

2 years agorustc_span: Revert addition of `proc_macro` field to `ExpnKind::Macro`
Vadim Petrochenkov [Sat, 10 Jul 2021 19:14:52 +0000 (22:14 +0300)]
rustc_span: Revert addition of `proc_macro` field to `ExpnKind::Macro`

The flag has a vague meaning and is used for a single diagnostic change that is low benefit and appears only under `-Z macro_backtrace`.

2 years agoclippy: allow default_hash_types on bootstrap
Cameron Steffen [Thu, 8 Jul 2021 17:59:16 +0000 (12:59 -0500)]
clippy: allow default_hash_types on bootstrap

2 years agoRework SESSION_GLOBALS API to prevent overwriting it
Guillaume Gomez [Wed, 5 May 2021 19:31:25 +0000 (21:31 +0200)]
Rework SESSION_GLOBALS API to prevent overwriting it

2 years agoAuto merge of #86920 - JohnTitor:rollup-buvzpkr, r=JohnTitor
bors [Wed, 7 Jul 2021 03:31:23 +0000 (03:31 +0000)]
Auto merge of #86920 - JohnTitor:rollup-buvzpkr, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #80918 (Add Integer::log variants)
 - #86717 (Rename some Rust 2021 lints to better names )
 - #86819 (Clean up rustdoc IDs)
 - #86880 (Test ManuallyDrop::clone_from.)
 - #86906 (Replace deprecated compare_and_swap and fix typo in core::sync::atomic::{fence, compiler_fence} docs)
 - #86907 (Migrate `cpu-usage-over-time.py` to Python 3)
 - #86916 (rewrote documentation for thread::yield_now())
 - #86919 (Update books)

Failed merges:

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

2 years agoMake type_implements_trait not a query
Aman Arora [Tue, 6 Jul 2021 09:38:15 +0000 (05:38 -0400)]
Make type_implements_trait not a query

2 years agoAdd s to non_fmt_panic
Ryan Levick [Tue, 29 Jun 2021 18:33:31 +0000 (20:33 +0200)]
Add s to non_fmt_panic

2 years agorevert broken formatting
Niko Matsakis [Sun, 4 Jul 2021 16:50:41 +0000 (12:50 -0400)]
revert broken formatting

2 years agoallow inference vars in type_implements_trait
Niko Matsakis [Sun, 4 Jul 2021 15:26:32 +0000 (11:26 -0400)]
allow inference vars in  type_implements_trait

2 years agoAuto merge of #86782 - flip1995:clippyup, r=Manishearth
bors [Fri, 2 Jul 2021 02:56:45 +0000 (02:56 +0000)]
Auto merge of #86782 - flip1995:clippyup, r=Manishearth

Update Clippy

Biweekly Clippy Update

r? `@Manishearth`

2 years agoMerge commit '61eb38aeda6cb54b93b872bf503d70084c4d621c' into clippyup
flip1995 [Thu, 1 Jul 2021 16:17:38 +0000 (18:17 +0200)]
Merge commit '61eb38aeda6cb54b93b872bf503d70084c4d621c' into clippyup

2 years agoRename all_crate_nums query to crates and remove useless wrapper
bjorn3 [Mon, 7 Jun 2021 09:03:17 +0000 (11:03 +0200)]
Rename all_crate_nums query to crates and remove useless wrapper

3 years agoFix clippy test
Ryan Levick [Fri, 25 Jun 2021 13:29:14 +0000 (15:29 +0200)]
Fix clippy test

3 years agoRollup merge of #86274 - alexander-melentyev:spaces, r=bjorn3
Yuki Okushi [Mon, 21 Jun 2021 15:00:38 +0000 (00:00 +0900)]
Rollup merge of #86274 - alexander-melentyev:spaces, r=bjorn3

Spaces

3 years agoDelete spaces
Alexander Melentyev [Mon, 21 Jun 2021 09:11:37 +0000 (12:11 +0300)]
Delete spaces

3 years agoAuto merge of #85538 - r00ster91:iterrepeat, r=Mark-Simulacrum
bors [Sun, 20 Jun 2021 20:07:13 +0000 (20:07 +0000)]
Auto merge of #85538 - r00ster91:iterrepeat, r=Mark-Simulacrum

Replace some `std::iter::repeat` with `str::repeat`

I noticed that there were some instances where `std::iter::repeat` would be used to repeat a string or a char to take a specific count of it and then collect it into a `String` when `str::repeat` is actually much faster and better for that.

See also: https://github.com/rust-lang/rust-clippy/issues/7260.

3 years agoAuto merge of #86426 - hi-rustin:rustin-patch-lint-warn, r=Aaron1011
bors [Sat, 19 Jun 2021 08:41:58 +0000 (08:41 +0000)]
Auto merge of #86426 - hi-rustin:rustin-patch-lint-warn, r=Aaron1011

Lint for unused borrows as part of UNUSED_MUST_USE

close https://github.com/rust-lang/rust/issues/76264

base on https://github.com/rust-lang/rust/pull/76894

r? `@RalfJung`

3 years agoAuto merge of #85421 - Smittyvb:rm_pushpop_unsafe, r=matthewjasper
bors [Fri, 18 Jun 2021 14:17:53 +0000 (14:17 +0000)]
Auto merge of #85421 - Smittyvb:rm_pushpop_unsafe, r=matthewjasper

Remove some last remants of {push,pop}_unsafe!

These macros have already been removed, but there was still some code handling these macros. That code is now removed.

3 years agoAddress comment
hi-rustin [Fri, 18 Jun 2021 08:20:30 +0000 (16:20 +0800)]
Address comment

3 years agoMake clippy tests happy
hi-rustin [Fri, 18 Jun 2021 08:11:32 +0000 (16:11 +0800)]
Make clippy tests happy