Commit Graph

532 Commits

Author SHA1 Message Date
Mark Rousskov 80ec986f9f Revert "Fix clippy's path to the copy intrinsics."
This reverts commit 1a806352e4.
2021-05-03 14:24:21 -04:00
Vadim Petrochenkov 38ed36bba4 hir: Preserve used syntax in `TyKind::TraitObject` 2021-03-18 03:02:32 +03:00
bors 36f1f04f18 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.
2021-03-17 19:39:03 +00:00
bors b4adc21c4f 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.
2021-03-17 16:49:46 +00:00
Yuki Okushi 70edab895d
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````
2021-03-17 15:20:54 +09:00
bors f5d8117c33 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`
2021-03-16 19:19:06 +00:00
Vadim Petrochenkov d1522b39dd ast: Reduce size of `ExprKind` by boxing fields of `ExprKind::Struct` 2021-03-16 11:41:24 +03:00
Vadim Petrochenkov b25d3ba781 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.
2021-03-16 11:41:24 +03:00
Vadim Petrochenkov e98b7d1bcf Update clippy tests 2021-03-16 00:12:38 +03:00
Roxane 189d206522 Fix error after rebase 2021-03-15 13:16:18 -04:00
Roxane 22eaffe71a Add comments with examples and tests 2021-03-15 13:16:04 -04:00
hyd-dev 176bb6bd38
Use `rustc_interface::interface::Config::parse_sess_created` in Clippy 2021-03-15 18:25:04 +08:00
Roxane fb3b77a8c8 Add fake_read() to clippy 2021-03-14 19:45:24 -04:00
flip1995 99d05196d6
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.
2021-03-12 15:32:35 +01:00
flip1995 fb311e14d5
Merge commit '6ed6f1e6a1a8f414ba7e6d9b8222e7e5a1686e42' into clippyup 2021-03-12 15:30:50 +01:00
bors dff1edf919 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.~~
2021-03-10 08:40:51 +00:00
bstrie 49aa79ec11 Deprecate items that accidentally weren't deprecated
Fixes #82080
2021-03-09 19:09:20 -05:00
Camille GILLOT fb753cced8 Remove hir::Expr::attrs. 2021-03-09 19:27:58 +01:00
Camille GILLOT c701872a6c Remove hir::Item::attrs. 2021-03-09 19:27:50 +01:00
Camille GILLOT 5474f17011 Remove hir::ImplItem::attrs. 2021-03-09 19:23:08 +01:00
Camille GILLOT c49359add2 Remove hir::TraitItem::attrs. 2021-03-09 19:23:08 +01:00
Camille GILLOT c298744da7 Remove hir::StructField::attrs. 2021-03-09 19:23:07 +01:00
Camille GILLOT 3c0afc3e1c Remove hir::Variant::attrs. 2021-03-09 19:23:06 +01:00
Camille GILLOT 96788df68c Remove hir::Arm::attrs. 2021-03-09 19:23:05 +01:00
Camille GILLOT a987bbb97c Remove hir::Crate::attrs. 2021-03-09 19:22:55 +01:00
Camille GILLOT 7ea1eacb17 Remove hir::Local::attrs. 2021-03-09 19:09:35 +01:00
Camille GILLOT ff79ad394f Remove hir::StmtKind::attrs. 2021-03-09 19:09:35 +01:00
Camille GILLOT 8e816056a5 Do not store attrs in FnKind. 2021-03-09 19:09:33 +01:00
Camille GILLOT f5dc5dcca3 Simplify clippy author. 2021-03-09 19:09:32 +01:00
kadmin 217ff6b7ea Switch to changing cp_non_overlap in tform
It was suggested to lower this in MIR instead of ssa, so do that instead.
2021-03-09 16:54:14 +00:00
kadmin 982382dc03 Update cranelift 2021-03-09 16:54:14 +00:00
kadmin 89f45ed9f3 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.
2021-03-09 16:54:13 +00:00
Mara Bos 0d97f9b22a
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``
2021-03-09 09:05:20 +00:00
mark 402a00a15d clippy: fix or-pattern in let binding 2021-03-08 13:16:00 -06:00
bors 27885a94c6 Auto merge of #82727 - oli-obk:shrinkmem, r=pnkfelix
Test the effect of shrinking the size of Rvalue by 16 bytes

r? `@ghost`
2021-03-08 08:39:24 +00:00
Santiago Pastorino 03c1f1762c
Make clippy set mir_opt_level using Option 2021-03-05 17:13:57 -03:00
Oli Scherer 9a2362e5a9 Shrink the size of Rvalue by 16 bytes 2021-03-05 09:33:01 +00:00
Cameron Steffen 6a3b834b39 Use diagnostic items in into_iter_collections 2021-03-01 09:04:11 -06:00
Cameron Steffen 4a6e67ead7 Add missing diagnostic item Symbols 2021-02-26 22:12:36 -06:00
flip1995 a6dd9b9606
Fix Clippy build and test 2021-02-25 11:25:45 +01:00
flip1995 81af3468fe
Merge commit '928e72dd10749875cbd412f74bfbfd7765dbcd8a' into clippyup 2021-02-25 11:25:22 +01:00
Camille GILLOT 4dbf83a209 Move try_print_query_stack to rustc_interface. 2021-02-19 17:51:55 +01:00
Dylan DPC 30f39fee9d
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)`.
2021-02-19 02:49:08 +01:00
Dylan DPC b3d3251271
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
2021-02-18 16:57:37 +01:00
Vadim Petrochenkov 4a88165124 ast: Keep expansion status for out-of-line module items
Also remove `ast::Mod` which is mostly redundant now
2021-02-18 13:07:49 +03:00
bors 93f6a4b9d8 Auto merge of #81993 - flip1995:clippyup, r=Manishearth
Update Clippy

Biweekly Clippy update

r? `@Manishearth`
2021-02-17 22:37:42 +00:00
Takayuki Maeda 0f04875d2e replace if-let and while-let with `if let` and `while let` 2021-02-17 19:26:38 +09:00
Camille GILLOT 786a80e9ea Only store a LocalDefId in hir::ImplItem. 2021-02-15 19:32:29 +01:00
Camille GILLOT a871a0f111 Only store a LocalDefId in hir::TraitItem. 2021-02-15 19:32:28 +01:00
Camille GILLOT cebbba081e Only store a LocalDefId in hir::Item.
Items are guaranteed to be HIR owner.
2021-02-15 19:32:10 +01:00