]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAuto merge of #82122 - bstrie:dep4real, r=dtolnay
bors [Wed, 17 Mar 2021 19:39:03 +0000 (19:39 +0000)]
Auto merge of #82122 - bstrie:dep4real, r=dtolnay

Deprecate `intrinsics::drop_in_place` and `collections::Bound`, which accidentally weren't deprecated

Fixes #82080.

I've taken the liberty of updating the `since` values to 1.52, since an unobservable deprecation isn't much of a deprecation (even the detailed release notes never bothered to mention these deprecations).

As mentioned in the issue I'm *pretty* sure that using a type alias for `Bound` is semantically equivalent to the re-export; [the reference implies](https://doc.rust-lang.org/reference/items/type-aliases.html) that type aliases only observably differ from types when used on unit structs or tuple structs, whereas `Bound` is an enum.

3 years agoAuto merge of #83188 - petrochenkov:field, r=lcnr
bors [Wed, 17 Mar 2021 16:49:46 +0000 (16:49 +0000)]
Auto merge of #83188 - petrochenkov:field, r=lcnr

ast/hir: Rename field-related structures

I always forget what `ast::Field` and `ast::StructField` mean despite working with AST for long time, so this PR changes the naming to less confusing and more consistent.

- `StructField` -> `FieldDef` ("field definition")
- `Field` -> `ExprField` ("expression field", not "field expression")
- `FieldPat` -> `PatField` ("pattern field", not "field pattern")

Various visiting and other methods working with the fields are renamed correspondingly too.

The second commit reduces the size of `ExprKind` by boxing fields of `ExprKind::Struct` in preparation for https://github.com/rust-lang/rust/pull/80080.

3 years agoRollup merge of #83092 - petrochenkov:qspan, r=estebank
Yuki Okushi [Wed, 17 Mar 2021 06:20:54 +0000 (15:20 +0900)]
Rollup merge of #83092 - petrochenkov:qspan, r=estebank

More precise spans for HIR paths

`Ty::assoc_item` is lowered to `<Ty>::assoc_item` in HIR, but `Ty` got span from the whole path.
This PR fixes that, and adjusts some diagnostic code that relied on `Ty` having the whole path span.

This is a pre-requisite for https://github.com/rust-lang/rust/pull/82868 (we cannot report suggestions like `Tr::assoc` -> `<dyn Tr>::assoc` with the current imprecise spans).
r? ````@estebank````

3 years agoAuto merge of #82536 - sexxi-goose:handle-patterns-take-2, r=nikomatsakis
bors [Tue, 16 Mar 2021 19:19:06 +0000 (19:19 +0000)]
Auto merge of #82536 - sexxi-goose:handle-patterns-take-2, r=nikomatsakis

2229: Handle patterns within closures correctly when `capture_disjoint_fields` is enabled

This PR fixes several issues related to handling patterns within closures when `capture_disjoint_fields` is enabled.
1. Matching is always considered a use of the place, even with `_` patterns
2. Compiler ICE when capturing fields in closures through `let` assignments

To do so, we

- Introduced new Fake Reads
- Delayed use of `Place` in favor of `PlaceBuilder`
- Ensured that `PlaceBuilder` can be resolved before attempting to extract `Place` in any of the pattern matching code

Closes rust-lang/project-rfc-2229/issues/27
Closes rust-lang/project-rfc-2229/issues/24
r? `@nikomatsakis`

3 years agoast: Reduce size of `ExprKind` by boxing fields of `ExprKind::Struct`
Vadim Petrochenkov [Tue, 16 Mar 2021 00:15:53 +0000 (03:15 +0300)]
ast: Reduce size of `ExprKind` by boxing fields of `ExprKind::Struct`

3 years agoast/hir: Rename field-related structures
Vadim Petrochenkov [Mon, 15 Mar 2021 21:36:07 +0000 (00:36 +0300)]
ast/hir: Rename field-related structures

StructField -> FieldDef ("field definition")
Field -> ExprField ("expression field", not "field expression")
FieldPat -> PatField ("pattern field", not "field pattern")

Also rename visiting and other methods working on them.

3 years agoUpdate clippy tests
Vadim Petrochenkov [Mon, 15 Mar 2021 20:52:57 +0000 (23:52 +0300)]
Update clippy tests

3 years agoFix error after rebase
Roxane [Mon, 15 Mar 2021 03:53:43 +0000 (23:53 -0400)]
Fix error after rebase

3 years agoAdd comments with examples and tests
Roxane [Thu, 25 Feb 2021 23:03:41 +0000 (18:03 -0500)]
Add comments with examples and tests

3 years agoUse `rustc_interface::interface::Config::parse_sess_created` in Clippy
hyd-dev [Mon, 15 Mar 2021 10:24:28 +0000 (18:24 +0800)]
Use `rustc_interface::interface::Config::parse_sess_created` in Clippy

3 years agoAdd fake_read() to clippy
Roxane [Thu, 25 Feb 2021 20:33:18 +0000 (15:33 -0500)]
Add fake_read() to clippy

3 years agoClippy: HACK! Fix bootstrap error
flip1995 [Fri, 12 Mar 2021 14:32:04 +0000 (15:32 +0100)]
Clippy: HACK! Fix bootstrap error

This will be removed in the next sync, once beta is at 1.52. Until then
this hack avoids to put `cfg(bootstrap)` into Clippy.

3 years agoMerge commit '6ed6f1e6a1a8f414ba7e6d9b8222e7e5a1686e42' into clippyup
flip1995 [Fri, 12 Mar 2021 14:30:50 +0000 (15:30 +0100)]
Merge commit '6ed6f1e6a1a8f414ba7e6d9b8222e7e5a1686e42' into clippyup

3 years agoAuto merge of #79519 - cjgillot:noattr, r=wesleywiser
bors [Wed, 10 Mar 2021 08:40:51 +0000 (08:40 +0000)]
Auto merge of #79519 - cjgillot:noattr, r=wesleywiser

Store HIR attributes in a side table

Same idea as #72015 but for attributes.
The objective is to reduce incr-comp invalidations due to modified attributes.
Notably, those due to modified doc comments.

Implementation:
- collect attributes during AST->HIR lowering, in `LocalDefId -> ItemLocalId -> &[Attributes]` nested tables;
- access the attributes through a `hir_owner_attrs` query;
- local refactorings to use this access;
- remove `attrs` from HIR data structures one-by-one.

Change in behaviour:
- the HIR visitor traverses all attributes at once instead of parent-by-parent;
- attribute arrays are sometimes duplicated: for statements and variant constructors;
- as a consequence, attributes are marked as used after unused-attribute lint emission to avoid duplicate lints.

~~Current bug: the lint level is not correctly applied in `std::backtrace_rs`, triggering an unused attribute warning on `#![no_std]`. I welcome suggestions.~~

3 years agoDeprecate items that accidentally weren't deprecated
bstrie [Sun, 14 Feb 2021 21:42:38 +0000 (16:42 -0500)]
Deprecate items that accidentally weren't deprecated

Fixes #82080

3 years agoRemove hir::Expr::attrs.
Camille GILLOT [Fri, 27 Nov 2020 16:41:05 +0000 (17:41 +0100)]
Remove hir::Expr::attrs.

3 years agoRemove hir::Item::attrs.
Camille GILLOT [Sun, 24 Jan 2021 12:17:54 +0000 (13:17 +0100)]
Remove hir::Item::attrs.

3 years agoRemove hir::ImplItem::attrs.
Camille GILLOT [Fri, 27 Nov 2020 08:55:10 +0000 (09:55 +0100)]
Remove hir::ImplItem::attrs.

3 years agoRemove hir::TraitItem::attrs.
Camille GILLOT [Fri, 27 Nov 2020 08:41:53 +0000 (09:41 +0100)]
Remove hir::TraitItem::attrs.

3 years agoRemove hir::StructField::attrs.
Camille GILLOT [Thu, 26 Nov 2020 23:27:34 +0000 (00:27 +0100)]
Remove hir::StructField::attrs.

3 years agoRemove hir::Variant::attrs.
Camille GILLOT [Thu, 26 Nov 2020 23:07:36 +0000 (00:07 +0100)]
Remove hir::Variant::attrs.

3 years agoRemove hir::Arm::attrs.
Camille GILLOT [Thu, 26 Nov 2020 22:46:48 +0000 (23:46 +0100)]
Remove hir::Arm::attrs.

3 years agoRemove hir::Crate::attrs.
Camille GILLOT [Thu, 26 Nov 2020 22:38:53 +0000 (23:38 +0100)]
Remove hir::Crate::attrs.

3 years agoRemove hir::Local::attrs.
Camille GILLOT [Wed, 25 Nov 2020 21:45:24 +0000 (22:45 +0100)]
Remove hir::Local::attrs.

3 years agoRemove hir::StmtKind::attrs.
Camille GILLOT [Wed, 25 Nov 2020 21:07:09 +0000 (22:07 +0100)]
Remove hir::StmtKind::attrs.

3 years agoDo not store attrs in FnKind.
Camille GILLOT [Fri, 27 Nov 2020 08:24:42 +0000 (09:24 +0100)]
Do not store attrs in FnKind.

3 years agoSimplify clippy author.
Camille GILLOT [Sun, 6 Dec 2020 21:00:24 +0000 (22:00 +0100)]
Simplify clippy author.

3 years agoSwitch to changing cp_non_overlap in tform
kadmin [Sat, 23 Jan 2021 08:57:04 +0000 (08:57 +0000)]
Switch to changing cp_non_overlap in tform

It was suggested to lower this in MIR instead of ssa, so do that instead.

3 years agoUpdate cranelift
kadmin [Tue, 29 Dec 2020 02:00:04 +0000 (02:00 +0000)]
Update cranelift

3 years agoUpdate match branches
kadmin [Mon, 5 Oct 2020 22:53:00 +0000 (22:53 +0000)]
Update match branches

This updates all places where match branches check on StatementKind or UseContext.
This doesn't properly implement them, but adds TODOs where they are, and also adds some best
guesses to what they should be in some cases.

3 years agoRollup merge of #82048 - mark-i-m:or-pat-type-ascription, r=petrochenkov
Mara Bos [Tue, 9 Mar 2021 09:05:20 +0000 (09:05 +0000)]
Rollup merge of #82048 - mark-i-m:or-pat-type-ascription, r=petrochenkov

or-patterns: disallow in `let` bindings

~~Blocked on https://github.com/rust-lang/rust/pull/81869~~

Disallows top-level or-patterns before type ascription. We want to reserve this syntactic space for possible future generalized type ascription.

r? ``@petrochenkov``

3 years agoclippy: fix or-pattern in let binding
mark [Mon, 8 Mar 2021 18:41:28 +0000 (12:41 -0600)]
clippy: fix or-pattern in let binding

3 years agoAuto merge of #82727 - oli-obk:shrinkmem, r=pnkfelix
bors [Mon, 8 Mar 2021 08:39:24 +0000 (08:39 +0000)]
Auto merge of #82727 - oli-obk:shrinkmem, r=pnkfelix

Test the effect of shrinking the size of Rvalue by 16 bytes

r? `@ghost`

3 years agoRollup merge of #82736 - spastorino:mir-opt-level-perf-changes, r=oli-obk
Guillaume Gomez [Fri, 5 Mar 2021 20:44:40 +0000 (21:44 +0100)]
Rollup merge of #82736 - spastorino:mir-opt-level-perf-changes, r=oli-obk

Bump optimization from mir_opt_level 2 to 3 and 3 to 4 and make "release" be level 2 by default

r? `@oli-obk`

3 years agoMake clippy set mir_opt_level using Option
Santiago Pastorino [Thu, 4 Mar 2021 02:33:18 +0000 (23:33 -0300)]
Make clippy set mir_opt_level using Option

3 years agoShrink the size of Rvalue by 16 bytes
Oli Scherer [Fri, 5 Mar 2021 09:32:47 +0000 (09:32 +0000)]
Shrink the size of Rvalue by 16 bytes

3 years agoFix borrow and deref
Ryan Levick [Tue, 16 Feb 2021 21:39:05 +0000 (22:39 +0100)]
Fix borrow and deref

3 years agoAllow noop_method_call in clippy ui test
Ryan Levick [Mon, 18 Jan 2021 13:15:19 +0000 (14:15 +0100)]
Allow noop_method_call in clippy ui test

3 years agoUse diagnostic items in into_iter_collections
Cameron Steffen [Sat, 27 Feb 2021 03:17:29 +0000 (21:17 -0600)]
Use diagnostic items in into_iter_collections

3 years agoAdd missing diagnostic item Symbols
Cameron Steffen [Sat, 27 Feb 2021 04:04:02 +0000 (22:04 -0600)]
Add missing diagnostic item Symbols

3 years agoFix Clippy build and test
flip1995 [Thu, 25 Feb 2021 10:25:45 +0000 (11:25 +0100)]
Fix Clippy build and test

3 years agoMerge commit '928e72dd10749875cbd412f74bfbfd7765dbcd8a' into clippyup
flip1995 [Thu, 25 Feb 2021 10:25:22 +0000 (11:25 +0100)]
Merge commit '928e72dd10749875cbd412f74bfbfd7765dbcd8a' into clippyup

3 years agoMove try_print_query_stack to rustc_interface.
Camille GILLOT [Wed, 8 Apr 2020 18:47:36 +0000 (20:47 +0200)]
Move try_print_query_stack to rustc_interface.

3 years agoRollup merge of #82238 - petrochenkov:nocratemod, r=Aaron1011
Dylan DPC [Fri, 19 Feb 2021 01:49:08 +0000 (02:49 +0100)]
Rollup merge of #82238 - petrochenkov:nocratemod, r=Aaron1011

ast: Keep expansion status for out-of-line module items

I.e. whether a module `mod foo;` is already loaded from a file or not.
This is a pre-requisite to correctly treating inner attributes on such modules (https://github.com/rust-lang/rust/issues/81661).

With this change AST structures for `mod` items diverge even more for AST structure for the crate root, which previously used `ast::Mod`.
Therefore this PR removes `ast::Mod` from `ast::Crate` in the first commit, these two things are sufficiently different from each other, at least at syntactic level.
Customization points for visiting a "`mod` item or crate root" were also removed from AST visitors (`fn visit_mod`).
`ast::Mod` itself was refactored away in the second commit in favor of `ItemKind::Mod(Unsafe, ModKind)`.

3 years agoRollup merge of #82215 - TaKO8Ki:replace-if-let-while-let, r=varkor
Dylan DPC [Thu, 18 Feb 2021 15:57:37 +0000 (16:57 +0100)]
Rollup merge of #82215 - TaKO8Ki:replace-if-let-while-let, r=varkor

Replace if-let and while-let with `if let` and `while let`

This pull request replaces if-let and while-let with `if let` and `while let`.

closes https://github.com/rust-lang/rust/issues/82205

3 years agoast: Keep expansion status for out-of-line module items
Vadim Petrochenkov [Tue, 16 Feb 2021 21:56:07 +0000 (00:56 +0300)]
ast: Keep expansion status for out-of-line module items

Also remove `ast::Mod` which is mostly redundant now

3 years agoAuto merge of #81993 - flip1995:clippyup, r=Manishearth
bors [Wed, 17 Feb 2021 22:37:42 +0000 (22:37 +0000)]
Auto merge of #81993 - flip1995:clippyup, r=Manishearth

Update Clippy

Biweekly Clippy update

r? `@Manishearth`

3 years agoreplace if-let and while-let with `if let` and `while let`
Takayuki Maeda [Wed, 17 Feb 2021 10:26:38 +0000 (19:26 +0900)]
replace if-let and while-let with `if let` and `while let`

3 years agoOnly store a LocalDefId in hir::ImplItem.
Camille GILLOT [Sat, 30 Jan 2021 22:25:03 +0000 (23:25 +0100)]
Only store a LocalDefId in hir::ImplItem.

3 years agoOnly store a LocalDefId in hir::TraitItem.
Camille GILLOT [Sat, 30 Jan 2021 19:46:50 +0000 (20:46 +0100)]
Only store a LocalDefId in hir::TraitItem.

3 years agoOnly store a LocalDefId in hir::Item.
Camille GILLOT [Sat, 30 Jan 2021 16:47:51 +0000 (17:47 +0100)]
Only store a LocalDefId in hir::Item.

Items are guaranteed to be HIR owner.

3 years agoUse ItemId as a strongly typed index.
Camille GILLOT [Sat, 30 Jan 2021 11:06:04 +0000 (12:06 +0100)]
Use ItemId as a strongly typed index.

3 years agoAuto merge of #81238 - RalfJung:copy-intrinsics, r=m-ou-se
bors [Sat, 13 Feb 2021 20:30:07 +0000 (20:30 +0000)]
Auto merge of #81238 - RalfJung:copy-intrinsics, r=m-ou-se

directly expose copy and copy_nonoverlapping intrinsics

This effectively un-does https://github.com/rust-lang/rust/pull/57997. That should help with `ptr::read` codegen in debug builds (and any other of these low-level functions that bottoms out at `copy`/`copy_nonoverlapping`), where the wrapper function will not get inlined. See the discussion in https://github.com/rust-lang/rust/pull/80290 and https://github.com/rust-lang/rust/issues/81163.

Cc `@bjorn3` `@therealprof`

3 years agoFix clippy's path to the copy intrinsics.
Mara Bos [Sat, 13 Feb 2021 17:58:54 +0000 (18:58 +0100)]
Fix clippy's path to the copy intrinsics.

3 years agoMerge commit '70c0f90453701e7d6d9b99aaa1fc6a765937b736' into clippyup
flip1995 [Thu, 11 Feb 2021 14:04:38 +0000 (15:04 +0100)]
Merge commit '70c0f90453701e7d6d9b99aaa1fc6a765937b736' into clippyup

3 years agoRename HIR UnOp variants
Ömer Sinan Ağacan [Tue, 9 Feb 2021 08:15:53 +0000 (11:15 +0300)]
Rename HIR UnOp variants

This renames the variants in HIR UnOp from

    enum UnOp {
        UnDeref,
        UnNot,
        UnNeg,
    }

to

    enum UnOp {
        Deref,
        Not,
        Neg,
    }

Motivations:

- This is more consistent with the rest of the code base where most enum
  variants don't have a prefix.

- These variants are never used without the `UnOp` prefix so the extra
  `Un` prefix doesn't help with readability. E.g. we don't have any
  `UnDeref`s in the code, we only have `UnOp::UnDeref`.

- MIR `UnOp` type variants don't have a prefix so this is more
  consistent with MIR types.

- "un" prefix reads like "inverse" or "reverse", so as a beginner in
  rustc code base when I see "UnDeref" what comes to my mind is
  something like "&*" instead of just "*".

3 years agoRollup merge of #81680 - camsteffen:primty, r=oli-obk
Jonas Schievink [Sat, 6 Feb 2021 16:01:45 +0000 (17:01 +0100)]
Rollup merge of #81680 - camsteffen:primty, r=oli-obk

Refactor `PrimitiveTypeTable` for Clippy

I removed `PrimitiveTypeTable` and added `PrimTy::ALL` and `PrimTy::from_name` in its place. This allows Clippy to use `PrimTy::from_name` for the `builtin_type_shadow` lint, and a `const` list of primitive types is deleted from Clippy code (the goal). All changes should be a little faster, if anything.

3 years agoBump clippy version
Mark Rousskov [Fri, 5 Feb 2021 23:29:05 +0000 (18:29 -0500)]
Bump clippy version

3 years agoSuggest panic!("{}", ..) instead of panic!(..) clippy::expect_fun_call.
Mara Bos [Wed, 3 Feb 2021 09:55:33 +0000 (10:55 +0100)]
Suggest panic!("{}", ..) instead of panic!(..) clippy::expect_fun_call.

3 years agoFix/allow non_fmt_panic in clippy tests.
Mara Bos [Tue, 2 Feb 2021 19:24:42 +0000 (20:24 +0100)]
Fix/allow non_fmt_panic in clippy tests.

3 years agoUse PrimTy in builtin type shadow lint
Cameron Steffen [Tue, 2 Feb 2021 18:28:58 +0000 (12:28 -0600)]
Use PrimTy in builtin type shadow lint

3 years agoMerge commit '3e4179766bcecd712824da04356621b8df012ea4' into sync-from-clippy
Manish Goregaokar [Wed, 3 Feb 2021 04:43:30 +0000 (20:43 -0800)]
Merge commit '3e4179766bcecd712824da04356621b8df012ea4' into sync-from-clippy

3 years agoRollup merge of #81260 - vn971:restore-editorconfig, r=Mark-Simulacrum
Jack Huey [Tue, 2 Feb 2021 21:01:33 +0000 (16:01 -0500)]
Rollup merge of #81260 - vn971:restore-editorconfig, r=Mark-Simulacrum

Add .editorconfig

This adds a .editorconfig file to rust-lang/rust, matching Clippy's. It's not clear that this will benefit many people, but the cost is low and the rewards are potentially meaningful.

3 years agoAuto merge of #81405 - bugadani:ast, r=cjgillot
bors [Tue, 2 Feb 2021 17:34:08 +0000 (17:34 +0000)]
Auto merge of #81405 - bugadani:ast, r=cjgillot

Box the biggest ast::ItemKind variants

This PR is a different approach on https://github.com/rust-lang/rust/pull/81400, aiming to save memory in humongous ASTs.

The three affected item kind enums are:
 - `ast::ItemKind` (208 -> 112 bytes)
 - `ast::AssocItemKind` (176 -> 72 bytes)
 - `ast::ForeignItemKind` (176 -> 72 bytes)

3 years agoAdd .editorconfig
Vasili Novikov [Fri, 22 Jan 2021 08:51:23 +0000 (09:51 +0100)]
Add .editorconfig

Editorconfig is a lightweight specification that
helps maintaining consistent coding/formatting style
accross editors, especially those editors
that are not explicitly aware of Rust and rustfmt.

https://editorconfig.org/

3 years agoAuto merge of #80851 - m-ou-se:panic-2021, r=petrochenkov
bors [Mon, 1 Feb 2021 10:25:31 +0000 (10:25 +0000)]
Auto merge of #80851 - m-ou-se:panic-2021, r=petrochenkov

Implement Rust 2021 panic

This implements the Rust 2021 versions of `panic!()`. See https://github.com/rust-lang/rust/issues/80162 and https://github.com/rust-lang/rfcs/pull/3007.

It does so by replacing `{std, core}::panic!()` by a bulitin macro that expands to either `$crate::panic::panic_2015!(..)` or `$crate::panic::panic_2021!(..)` depending on the edition of the caller.

This does not yet make std's panic an alias for core's panic on Rust 2021 as the RFC proposes. That will be a separate change: https://github.com/rust-lang/rust/pull/80879/commits/c5273bdfb266c35e8eab9413aa8d58d27fdbe114 That change is blocked on figuring out what to do with https://github.com/rust-lang/rust/issues/80846 first.

3 years agoBox the biggest ast::ItemKind variants
Dániel Buga [Fri, 29 Jan 2021 07:31:08 +0000 (08:31 +0100)]
Box the biggest ast::ItemKind variants

3 years agoUpdate clippy test output for panic macros.
Mara Bos [Sat, 30 Jan 2021 18:33:21 +0000 (19:33 +0100)]
Update clippy test output for panic macros.

3 years agoMerge commit '95c0459217d1661edfa794c8bb122452b92fb485' into clippyup
flip1995 [Sat, 30 Jan 2021 17:06:34 +0000 (18:06 +0100)]
Merge commit '95c0459217d1661edfa794c8bb122452b92fb485' into clippyup

3 years agoRollup merge of #81176 - camsteffen:qpath-res, r=oli-obk
Yuki Okushi [Fri, 29 Jan 2021 00:17:32 +0000 (09:17 +0900)]
Rollup merge of #81176 - camsteffen:qpath-res, r=oli-obk

Improve safety of `LateContext::qpath_res`

This is my first rustc code change, inspired by hacking on clippy!

The first change is to clear cached `TypeckResults` from `LateContext` when visiting a nested item. I took a hint from [here](https://github.com/rust-lang/rust/blob/5e91c4ecc09312d8b63d250a432b0f3ef83f1df7/compiler/rustc_privacy/src/lib.rs#L1300).

Clippy has a `qpath_res` util function to avoid a possible ICE in `LateContext::qpath_res`. But the docs of `LateContext::qpath_res` promise no ICE. So this updates the `LateContext` method to keep its promises, and removes the util function.

Related: rust-lang/rust-clippy#4545

CC ````````````@eddyb```````````` since you've done related work
CC ````````````@flip1995```````````` FYI

3 years agoRollup merge of #81277 - flip1995:from_diag_items, r=matthewjasper
Yuki Okushi [Thu, 28 Jan 2021 06:09:08 +0000 (15:09 +0900)]
Rollup merge of #81277 - flip1995:from_diag_items, r=matthewjasper

Make more traits of the From/Into family diagnostic items

Following traits are now diagnostic items:
- `From` (unchanged)
- `Into`
- `TryFrom`
- `TryInto`

This also adds symbols for those items:
- `into_trait`
- `try_from_trait`
- `try_into_trait`

Related: https://github.com/rust-lang/rust-clippy/pull/6620#discussion_r562482587

3 years agoRollup merge of #79951 - LeSeulArtichaut:ty-ir, r=nikomatsakis
Yuki Okushi [Thu, 28 Jan 2021 06:09:02 +0000 (15:09 +0900)]
Rollup merge of #79951 - LeSeulArtichaut:ty-ir, r=nikomatsakis

Refractor a few more types to `rustc_type_ir`

In the continuation of #79169, ~~blocked on that PR~~.

This PR:
 - moves `IntVarValue`, `FloatVarValue`, `InferTy` (and friends) and `Variance`
 - creates the `IntTy`, `UintTy` and `FloatTy` enums in `rustc_type_ir`, based on their `ast` and `chalk_ir` equilavents, and uses them for types in the rest of the compiler.

~~I will split up that commit to make this easier to review and to have a better commit history.~~
EDIT: done, I split the PR in commits of 200-ish lines each

r? `````@nikomatsakis````` cc `````@jackh726`````

3 years agoMake more traits of the From/Into family diagnostic items
flip1995 [Fri, 22 Jan 2021 17:07:00 +0000 (18:07 +0100)]
Make more traits of the From/Into family diagnostic items

Following traits are now diagnostic items:
- `From` (unchanged)
- `Into`
- `TryFrom`
- `TryInto`

This also adds symbols for those items:
- `into_trait`
- `try_from_trait`
- `try_into_trait`

3 years agoRollup merge of #81236 - estebank:everybody-loop-now, r=oli-obk
Mara Bos [Fri, 22 Jan 2021 14:30:19 +0000 (14:30 +0000)]
Rollup merge of #81236 - estebank:everybody-loop-now, r=oli-obk

Gracefully handle loop labels missing leading `'` in different positions

Fix #81192.

* Account for labels when suggesting `loop` instead of `while true`
* Suggest `'a` when given `a` only when appropriate
* Add loop head span to hir
* Tweak error for invalid `break expr`
* Add more misspelled label tests
* Avoid emitting redundant "unused label" lint
* Parse loop labels missing a leading `'`

Each commit can be reviewed in isolation.

3 years agoAuto merge of #81135 - jyn514:no-backticks, r=flip1995
bors [Fri, 22 Jan 2021 06:13:19 +0000 (06:13 +0000)]
Auto merge of #81135 - jyn514:no-backticks, r=flip1995

Fix formatting for removed lints

- Don't add backticks for the reason a lint was removed. This is almost
never a code block, and when it is the backticks should be in the reason
itself.
- Don't assume clippy is the only tool that needs to be checked for
backwards compatibility

I split this out of https://github.com/rust-lang/rust/pull/80527/ because it kept causing tests to fail, and it's a good change to have anyway.

r? `@flip1995`

3 years agoFix clippy and comment
Esteban Küber [Fri, 22 Jan 2021 00:48:17 +0000 (16:48 -0800)]
Fix clippy and comment

3 years agoAdd loop head span to hir
Esteban Küber [Thu, 21 Jan 2021 01:15:08 +0000 (17:15 -0800)]
Add loop head span to hir

3 years agoForce token collection to run when parsing nonterminals
Aaron Hill [Mon, 18 Jan 2021 21:47:37 +0000 (16:47 -0500)]
Force token collection to run when parsing nonterminals

Fixes #81007

Previously, we would fail to collect tokens in the proper place when
only builtin attributes were present. As a result, we would end up with
attribute tokens in the collected `TokenStream`, leading to duplication
when we attempted to prepend the attributes from the AST node.

We now explicitly track when token collection must be performed due to
nomterminal parsing.

3 years agoRemove qpath_res util function
Cameron Steffen [Mon, 18 Jan 2021 19:36:32 +0000 (13:36 -0600)]
Remove qpath_res util function

3 years agoUse ty::{IntTy,UintTy,FloatTy} in rustdoc and clippy
LeSeulArtichaut [Sat, 12 Dec 2020 14:32:45 +0000 (15:32 +0100)]
Use ty::{IntTy,UintTy,FloatTy} in rustdoc and clippy

3 years agoRollup merge of #81038 - flip1995:clippyup, r=Manishearth
Ashley Mannix [Mon, 18 Jan 2021 11:53:22 +0000 (21:53 +1000)]
Rollup merge of #81038 - flip1995:clippyup, r=Manishearth

Update Clippy

Biweekly Clippy update

r? ``@Manishearth``

3 years agoFix formatting for removed lints
Joshua Nelson [Sun, 17 Jan 2021 19:23:25 +0000 (14:23 -0500)]
Fix formatting for removed lints

- Don't add backticks for the reason a lint was removed. This is almost
never a code block, and when it is the backticks should be in the reason
itself.
- Don't assume clippy is the only tool that needs to be checked for
backwards compatibility

3 years agoAuto merge of #80679 - jackh726:predicate-kind-take2, r=lcnr
bors [Sun, 17 Jan 2021 20:49:11 +0000 (20:49 +0000)]
Auto merge of #80679 - jackh726:predicate-kind-take2, r=lcnr

Remove PredicateKind and instead only use Binder<PredicateAtom>

Originally brought up in https://github.com/rust-lang/rust/pull/76814#discussion_r546858171

r? `@lcnr`

3 years agoReview changes
Jack Huey [Thu, 7 Jan 2021 16:20:28 +0000 (11:20 -0500)]
Review changes

3 years agoCleanup
Jack Huey [Mon, 4 Jan 2021 21:50:36 +0000 (16:50 -0500)]
Cleanup

3 years agoUse pred not binder
Jack Huey [Mon, 4 Jan 2021 20:30:22 +0000 (15:30 -0500)]
Use pred not binder

3 years agoCleanup
Jack Huey [Mon, 4 Jan 2021 06:58:33 +0000 (01:58 -0500)]
Cleanup

3 years agoRemove PredicateKind
Jack Huey [Wed, 23 Dec 2020 21:36:23 +0000 (16:36 -0500)]
Remove PredicateKind

3 years agoRemove PredicateKind::Atom
Jack Huey [Tue, 22 Dec 2020 03:49:03 +0000 (22:49 -0500)]
Remove PredicateKind::Atom

3 years agoDeprecate unknown_clippy_lints
flip1995 [Sat, 16 Jan 2021 16:30:31 +0000 (17:30 +0100)]
Deprecate unknown_clippy_lints

This is now handled by unknown_lints

3 years agoMerge commit '953f024793dab92745fee9cd2c4dee6a60451771' into clippyup
flip1995 [Fri, 15 Jan 2021 09:56:44 +0000 (10:56 +0100)]
Merge commit '953f024793dab92745fee9cd2c4dee6a60451771' into clippyup

3 years agoAuto merge of #79328 - c410-f3r:hir-if, r=matthewjasper
bors [Thu, 14 Jan 2021 14:41:58 +0000 (14:41 +0000)]
Auto merge of #79328 - c410-f3r:hir-if, r=matthewjasper

Reintroduce hir::ExprKind::If

Basically copied and paste #59288/https://github.com/rust-lang/rust-clippy/pull/4080 with some modifications.

The vast majority of tests were fixed and now there are only a few remaining. Since I am still unable to figure out the missing pieces, any help with the following list is welcome.

- [ ] **Unnecessary `typeck` exception**: [Cheated on this one to make CI green.](https://github.com/rust-lang/rust/pull/79328/files#diff-3faee9ba23fc54a12b7c43364ba81f8c5660045c7e1d7989a02a0cee1c5b2051)
- [x] **Incorrect span**: [Span should reference `then` and `else` separately.](https://github.com/rust-lang/rust/pull/79328/files#diff-cf2c46e82222ee4b1037a68fff8a1af3c4f1de7a6b3fd798aacbf3c0475abe3d)
- [x] **New note regarding `assert!`**: [Modified but not "wrong". Maybe can be a good thing?](https://github.com/rust-lang/rust/pull/79328/files#diff-9e0d7c89ed0224e2b62060c957177c27db43c30dfe3c2974cb6b5091cda9cfb5)
- [x] **Inverted report location**: [Modified but not "wrong". Locations were inverted.](https://github.com/rust-lang/rust/pull/79328/files#diff-f637ce7c1f68d523a165aa9651765df05e36c4d7d279194b1a6b28b48a323691)
- [x] **`src/test/ui/point-to-type-err-cause-on-impl-trait-return.rs` has weird errors**: [Not sure why this is happening.](https://github.com/rust-lang/rust/pull/79328/files#diff-c823c09660f5b112f95e97e8ff71f1797b6c7f37dbb3d16f8e98bbaea8072e95)
- [x] **Missing diagnostic**: [???](https://github.com/rust-lang/rust/pull/79328/files#diff-6b8ab09360d725ba4513933827f9796b42ff9522b0690f80b76de067143af2fc)

3 years agoAuto merge of #77524 - Patryk27:fixes/66228, r=estebank
bors [Wed, 13 Jan 2021 20:35:58 +0000 (20:35 +0000)]
Auto merge of #77524 - Patryk27:fixes/66228, r=estebank

Rework diagnostics for wrong number of generic args (fixes #66228 and #71924)

This PR reworks the `wrong number of {} arguments` message, so that it provides more details and contextual hints.

3 years agoSeparate out a `hir::Impl` struct
Joshua Nelson [Sun, 22 Nov 2020 22:46:21 +0000 (17:46 -0500)]
Separate out a `hir::Impl` struct

This makes it possible to pass the `Impl` directly to functions, instead
of having to pass each of the many fields one at a time. It also
simplifies matches in many cases.

3 years agoRework diagnostics for wrong number of generic args
Patryk Wychowaniec [Sat, 2 Jan 2021 18:45:11 +0000 (19:45 +0100)]
Rework diagnostics for wrong number of generic args

3 years agoast: Remove some indirection layers from values in key-value attributes
Vadim Petrochenkov [Sat, 19 Dec 2020 20:38:22 +0000 (23:38 +0300)]
ast: Remove some indirection layers from values in key-value attributes

3 years agoReintroduce hir::ExprKind::If
Caio [Fri, 1 Jan 2021 18:38:11 +0000 (15:38 -0300)]
Reintroduce hir::ExprKind::If

3 years agoUse bootstrap rustc for versioncheck in Clippy
flip1995 [Sat, 2 Jan 2021 17:01:42 +0000 (18:01 +0100)]
Use bootstrap rustc for versioncheck in Clippy

3 years agoMerge commit '1fcc74cc9e03bc91eaa80ecf92976b0b14b3aeb6' into clippyup
flip1995 [Sat, 2 Jan 2021 15:29:43 +0000 (16:29 +0100)]
Merge commit '1fcc74cc9e03bc91eaa80ecf92976b0b14b3aeb6' into clippyup

3 years agofirst pass at default values for const generics
Julian Knodt [Thu, 31 Dec 2020 00:58:27 +0000 (01:58 +0100)]
first pass at default values for const generics

- Adds optional default values to const generic parameters in the AST
  and HIR
- Parses these optional default values
- Adds a `const_generics_defaults` feature gate