summary refs log tree commit diff
path: root/compiler/rustc_passes/src
AgeCommit message (Collapse)AuthorLines
2021-03-15Revert PR 81473 to resolve (on beta) issues 81626 and 81658.Felix S. Klock II-15/+0
Revert "Add missing brace" This reverts commit 85ad773049536d7fed9a94ae0ac74f97135c8655. Revert "Simplify base_expr" This reverts commit 899aae465eb4ef295dc1eeb2603f744568e0768c. Revert "Warn write-only fields" This reverts commit d3c69a4c0dd98af2611b7553d1a65afef6a6ccb0.
2021-02-02Bump rustfmt versionMark Rousskov-1/+2
Also switches on formatting of the mir build module
2021-02-01Fixed #[inline] to be warned in fields, arms, macro defsDanuel-45/+263
Add visitors for checking #[inline] Add visitors for checking #[inline] with struct field Fix test for #[inline] Add visitors for checking #[inline] with #[macro_export] macro Add visitors for checking #[inline] without #[macro_export] macro Add use alias with Visitor Fix lint error Reduce unnecessary variable Co-authored-by: LingMan <LingMan@users.noreply.github.com> Change error to warning Add warning for checking field, arm with #[allow_internal_unstable] Add name resolver Formatting Formatting Fix error fixture Add checking field, arm, macro def
2021-01-28Add missing braceOli Scherer-1/+1
2021-01-29Simplify base_exprSeo Sanghyeon-8/+4
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
2021-01-28Warn write-only fieldsSeo Sanghyeon-0/+19
2021-01-28Rollup merge of #79951 - LeSeulArtichaut:ty-ir, r=nikomatsakisYuki Okushi-2/+2
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`````
2021-01-25This should address issue 81294.Felix S. Klock II-1/+1
(No test added. The relevant test *is* ui/panic-handler/weak-lang-item.rs, and this change should make it less flaky.)
2021-01-24Rollup merge of #81310 - tmiasko:in-pattern, r=petrochenkovJonas Schievink-1/+1
Do not mark unit variants as used when in path pattern Record that we are processing a pattern so that code responsible for handling path resolution can correctly decide whether to mark it as used or not. Closes #76788.
2021-01-24Auto merge of #80919 - cjgillot:defkey-span, r=oli-obkbors-0/+1
Generate metadata by iterating on DefId instead of traversing the HIR tree 1/N Sample from #80347.
2021-01-23Allow to query the HIR crate node.Camille GILLOT-0/+1
2021-01-23Do not mark unit variants as used when in path patternTomasz Miąsko-1/+1
Record that we are processing a pattern so that code responsible for handling path resolution can correctly decide whether to mark it as used or not.
2021-01-21Do not suggest using a break label when one is already presentEsteban Küber-6/+11
2021-01-21Tweak error for invalid `break expr`Esteban Küber-20/+56
Point at loop head on invalid `break expr`. Suggest removing `expr` or using label if available.
2021-01-21Add loop head span to hirEsteban Küber-6/+5
2021-01-18Use ty::{IntTy,UintTy,FloatTy} in rustcLeSeulArtichaut-2/+2
2021-01-18Only inherit const stability for methods of `impl const Trait` blocksoli-10/+60
2021-01-14Auto merge of #79328 - c410-f3r:hir-if, r=matthewjasperbors-4/+38
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)
2021-01-13Auto merge of #79322 - jyn514:refactor-impl, r=estebankbors-8/+11
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. See `rustc_save_analysis::dump_visitor::process_impl` or `rustdoc::clean::clean_impl` for a good example of how this makes `impl`s easier to work with. r? `@petrochenkov` maybe?
2021-01-12Separate out a `hir::Impl` structJoshua Nelson-8/+11
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.
2021-01-10Fix small typoCamelid-1/+1
transmutting -> transmuting
2021-01-07Reintroduce hir::ExprKind::IfCaio-4/+38
2021-01-06Don't use to_string on SymbolGuillaume Gomez-1/+1
2021-01-04Add an error in case the doc alias is the same as the item it's aliasingGuillaume Gomez-1/+12
2021-01-02reduce borrowing and (de)referencing around match patterns ↵Matthias Krüger-1/+1
(clippy::match_ref_pats)
2021-01-01adjust const generics defaults FIXMEs to the new feature gateRémy Rakic-1/+1
2020-12-30Rollup merge of #80495 - jyn514:rename-empty, r=petrochenkovMara Bos-1/+1
Rename kw::Invalid -> kw::Empty See https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Is.20there.20a.20symbol.20for.20the.20empty.20string.3F/near/220054471 for context. r? `@petrochenkov`
2020-12-30Rename kw::Invalid -> kw::EmptyJoshua Nelson-1/+1
See https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Is.20there.20a.20symbol.20for.20the.20empty.20string.3F/near/220054471 for context.
2020-12-24use matches!() macro in more placesMatthias Krüger-23/+20
2020-12-19Auto merge of #79073 - davidtwco:issue-78957-const-param-attrs, r=lcnrbors-0/+12
passes: prohibit invalid attrs on generic params Fixes #78957. This PR modifies the `check_attr` pass so that attribute placement on generic parameters is checked for validity. r? `@lcnr`
2020-12-17Rollup merge of #79877 - bstrie:depinfut, r=oli-obkYuki Okushi-20/+24
Allow `since="TBD"` for rustc_deprecated Closes #78381. This PR only affects `#[rustc_deprecated]`, not `#[deprecated]`, so there is no effect on any stable language feature. Likewise this PR only implements `since="TBD"`, it does not actually tag any library functions with it, so there is no effect on any stable API. Overview of changes: * `rustc_middle/stability.rs`: * change `deprecation_in_effect` function to return `false` when `since="TBD"` * tidy up the compiler output when a deprecated item has `since="TBD"` * `rustc_passes/stability.rs`: * allow `since="TBD"` to pass the sanity check for stable_version < deprecated_version * refactor the "invalid stability version" and "invalid deprecation version" error into separate errors * rustdoc: make `since="TBD"` message on a deprecated item's page match the command-line deprecation output * tests: * test rustdoc output * test that the `deprecated_in_future` lint fires when `since="TBD"` * test the new "invalid deprecation version" error message
2020-12-17Rollup merge of #79051 - LeSeulArtichaut:if-let-guard, r=matthewjasperYuki Okushi-4/+12
Implement if-let match guards Implements rust-lang/rfcs#2294 (tracking issue: #51114). I probably should do a few more things before this can be merged: - [x] Add tests (added basic tests, more advanced tests could be done in the future?) - [x] Add lint for exhaustive if-let guard (comparable to normal if-let statements) - [x] Fix clippy However since this is a nightly feature maybe it's fine to land this and do those steps in follow-up PRs. Thanks a lot `@matthewjasper` :heart: for helping me with lowering to MIR! Would you be interested in reviewing this? r? `@ghost` for now
2020-12-16Allow `since="TBD"` for rustc_deprecatedbstrie-20/+24
2020-12-09Rollup merge of #79844 - tmiasko:rwu-table-mod, r=lcnrTyler Mandry-146/+149
Move RWUTable to a separate module
2020-12-09Rollup merge of #79826 - LingMan:match_if, r=lcnrTyler Mandry-20/+10
Simplify visit_{foreign,trait}_item Using an `if` seems like a better semantic fit and saves a few lines. Noticed while looking at https://github.com/rust-lang/rust/pull/79752, but that's already merged. r? `@lcnr,` cc `@cjgillot` `@rustbot` modify labels +C-cleanup +T-compiler
2020-12-09Rollup merge of #79777 - tmiasko:remove-first-merge, r=lcnrTyler Mandry-18/+6
Remove `first_merge` from liveness debug logs
2020-12-09Auto merge of #79767 - tmiasko:malformed-required-const, r=matthewjasperbors-45/+53
Don't ICE on malformed `rustc_args_required_const` attribute
2020-12-09Move RWUTable to a separate moduleTomasz Miąsko-146/+149
2020-12-09Remove `first_merge` from liveness debug logsTomasz Miąsko-18/+6
2020-12-08Auto merge of #79727 - tmiasko:8bit-rwu, r=lcnrbors-159/+146
Compress RWU from at least 32 bits to 4 bits The liveness uses a mixed representation of RWUs based on the observation that most of them have invalid reader and invalid writer. The packed variant uses 32 bits and unpacked 96 bits. Unpacked data contains reader live node and writer live node. Since live nodes are used only to determine their validity, RWUs can always be stored in a packed form with four bits for each: reader bit, writer bit, used bit, and one extra padding bit to simplify packing and unpacking operations.
2020-12-08Simplify visit_{foreign,trait}_itemLingMan-20/+10
Using an `if` seems like a better semantic fit and saves a few lines.
2020-12-08Auto merge of #79752 - cjgillot:dead-alien, r=lcnrbors-21/+25
Visit ForeignItems when marking dead code Follow-up to #79318 r? `@lcnr`
2020-12-08Visit ForeignItems when marking dead code.Camille GILLOT-21/+25
2020-12-07Validate naked functions definitionsTomasz Miąsko-15/+224
2020-12-06Retain assembly operands span when lowering AST to HIRTomasz Miąsko-4/+4
2020-12-06Implement lowering of if-let guards to MIRLeSeulArtichaut-0/+2
2020-12-06Implement liveness passes for if-let guardsLeSeulArtichaut-4/+10
2020-12-06Don't ICE on malformed `rustc_args_required_const` attributeTomasz Miąsko-45/+53
2020-12-06Compress RWU from at least 32 bits to 4 bitsTomasz Miąsko-159/+146
The liveness uses a mixed representation of RWUs based on the observation that most of them have invalid reader and invalid writer. The packed variant uses 32 bits and unpacked 96 bits. Unpacked data contains reader live node and writer live node. Since live nodes are used only to determine their validity, RWUs can always be stored in a packed form with four bits for each: reader bit, writer bit, used bit, and one extra padding bit to simplify packing and unpacking operations.
2020-12-02Add checks for #[doc(keyword = "...")] and move them into rustc_passesGuillaume Gomez-7/+53