summary refs log tree commit diff
path: root/src/librustc_passes
AgeCommit message (Collapse)AuthorLines
2020-05-29liveness: Warn about unused captured variablesTomasz Miąsko-54/+170
2020-05-29liveness: Include upvars in the analysisTomasz Miąsko-36/+33
2020-05-29liveness: Remove unused fallthrough_lnTomasz Miąsko-9/+1
2020-05-29liveness: Remove unused clean_exit_varTomasz Miąsko-14/+1
2020-05-29liveness: Log information about used variablesTomasz Miąsko-5/+8
2020-05-26Rollup merge of #72581 - samrat:allow-desugared-break-in-labeled-block, ↵Dylan DPC-1/+2
r=davidtwco Allow unlabeled breaks from desugared `?` in labeled blocks `?` is desugared into a `break` targeting the innermost `try` scope in which it resides. The `break` however will not have a label. https://github.com/rust-lang/rust/blob/master/src/librustc_ast_lowering/expr.rs#L1560 Since the `target` of the `break` is known, the compiler should not complain about an unlabeled jump for `break`s desugared from `?`. Closes https://github.com/rust-lang/rust/issues/72483
2020-05-26Allow unlabeled breaks from desugared `?` in labeled blocksSamrat Man Singh-1/+2
2020-05-25Rollup merge of #72544 - sexxi-goose:upvars_mentioned, r=matthewjasperRalf Jung-7/+7
librustc_middle: Rename upvars query to upvars_mentioned As part of supporting RFC 2229, we will be capturing all the Places that were mentioned in the closure. This commit modifies the name of the upvars query to upvars_mentioned. r? @nikomatsakis @blitzerr @matthewjasper
2020-05-25Rollup merge of #72537 - Amanieu:fix-asm-liveness, r=petrochenkovRalf Jung-8/+2
Fix InlineAsmOperand expresions being visited twice during liveness checking
2020-05-24librustc_middle: Rename upvars query to upvars_mentionedAman Arora-7/+7
As part of supporting RFC 2229, we will be capturing all the Places that were mentioned in the closure. This commit modifies the name of the upvars query to upvars_mentioned. Co-authored-by: Aman Arora <me@aman-arora.com> Co-authored-by: Chris Pardy <chrispardy36@gmail.com>
2020-05-24Fix InlineAsmOperand expresions being visited twice during liveness checkingAmanieu d'Antras-8/+2
2020-05-22Use `OnceCell` instead of `Once`Dylan MacKenzie-3/+3
2020-05-18Move InlineAsmTemplatePiece and InlineAsmOptions to librustc_astAmanieu d'Antras-3/+3
2020-05-18Add support for high byte registers on x86Amanieu d'Antras-13/+11
2020-05-18Apply review feedbackAmanieu d'Antras-3/+14
2020-05-18HIR passes for asm!Amanieu d'Antras-13/+363
2020-05-11Fix clippy warningsMatthias Krüger-3/+3
Fixes clippy::{cone_on_copy, filter_next, redundant_closure, single_char_pattern, len_zero,redundant_field_names, useless_format, identity_conversion, map_clone, into_iter_on_ref, needless_return, option_as_ref_deref, unused_unit, unnecessary_mut_passed}
2020-05-09Rollup merge of #71555 - cjgillot:nameless, r=matthewjasperRalf Jung-7/+6
Remove ast::{Ident, Name} reexports. The reexport of `Symbol` into `Name` confused me.
2020-05-09Rollup merge of #71947 - mibac138:dead-code, r=cramertjDylan DPC-2/+12
Dead-code pass highlights too much of impl functions Fixes #66627. Previous diagnostic: ``` error: method is never used: `unused_impl_fn_3` --> src/main.rs:28:5 | 28 | / fn unused_impl_fn_3( 29 | | var: i32, 30 | | ) { 31 | | println!("bar {}", var); 32 | | } | |_____^ ``` New diagnostic: ``` error: associated function is never used: `unused_impl_fn_3` --> $DIR/lint-dead-code-6.rs:13:8 | LL | fn unused_impl_fn_3( | ^^^^^^^^^^^^^^^^ ``` This makes associated functions in line with free-standing functions.
2020-05-08Remove ast::{Ident, Name} reexports.Camille GILLOT-7/+6
2020-05-07Use `hir::ConstContext` instead of local enumsDylan MacKenzie-48/+7
2020-05-06Dead-code pass highlights too much of impl functionsmibac138-2/+12
2020-05-02Rollup merge of #71777 - petrochenkov:crtype, r=Mark-SimulacrumDylan DPC-17/+15
cleanup: `config::CrateType` -> `CrateType`
2020-05-02cleanup: `config::CrateType` -> `CrateType`Vadim Petrochenkov-17/+15
2020-05-01Mark query function as must_use.Camille GILLOT-2/+2
2020-05-01Auto merge of #70674 - cjgillot:query-arena-all, r=matthewjasperbors-8/+8
Have the per-query caches store the results on arenas This PR leverages the cache for each query to serve as storage area for the query results. It introduces a new cache `ArenaCache`, which moves the result to an arena, and only stores the reference in the hash map. This allows to remove a sizeable part of the usage of the global `TyCtxt` arena. I only migrated queries that already used arenas before.
2020-04-30Rollup merge of #71205 - NeoRaider:check_attr, r=jonas-schievinkDylan DPC-1/+4
rustc: fix check_attr() for methods, closures and foreign functions This fixes an issue that previously turned up for methods in https://github.com/rust-lang/rust/pull/69274, but also exists for closures and foreign function: `check_attr` does not call `codegen_fn_attrs()` for these types when it should, meaning that incorrectly used function attributes are not diagnosed without codegen. The issue affects our UI tests, as they run with `--emit=metadata` by default, but as it turns out, this is not the only case: Function attributes are not checked on any dead code without this fix! This makes the fix a **breaking change**. The following very silly Rust programs compiles fine on stable Rust when it should not, which is fixed by this PR. ```rust fn main() { #[target_feature(enable = "sse2")] || {}; } ``` I assume any real-world program which may trigger this issue would at least emit a dead code warning, but of course that is no guarantee that such code does not exist... Fixes #70307
2020-04-28Move a few queries to using an arena.Camille GILLOT-1/+1
2020-04-28Use the query system to allocate.Camille GILLOT-7/+7
2020-04-27Change return type of `entry_fn` query to return a `LocalDefId`marmeladema-9/+11
2020-04-27Use `LocalDefId` in `typeck_tables_of` and `used_trait_imports` queriesmarmeladema-4/+4
2020-04-26Rollup merge of #70043 - mark-i-m:def-kind-more, r=eddybDylan DPC-36/+20
Add all remaining `DefKind`s. r? @eddyb or @Centril ~~I'm not sure if this is what you were thinking of. There are also a few places where I'm not sure what the correct choice is because I don't fully understand the meaning of some variants.~~ ~~In general, it feels a bit odd to add some of these as `DefKind`s (e.g. `Arm`) because they don't feel like definitions. Are there things that it makes sense not to add?~~
2020-04-24Avoid unused Option::map resultsJosh Stone-1/+3
These are changes that would be needed if we add `#[must_use]` to `Option::map`, per #71484.
2020-04-24fix a couple more uses of def_kindmark-2/+2
2020-04-24Remove redundant `descr`/`descriptive_variant` methods from HIR.Eduard-Mihai Burtescu-36/+20
2020-04-23Address comments from reviewmarmeladema-3/+2
2020-04-23Modify `as_local_hir_id` to return a bare `HirId`marmeladema-23/+15
2020-04-23Modify `as_local_hir_id` to accept a `LocalDefId` instead of a `DefId`marmeladema-15/+24
2020-04-23librustc_middle: return LocalDefId instead of DefId in local_def_idmarmeladema-14/+14
2020-04-20Remove unused dependenciesShotaro Yamada-2/+0
2020-04-19Auto merge of #71331 - Dylan-DPC:rollup-5rn1isc, r=Dylan-DPCbors-1/+3
Rollup of 4 pull requests Successful merges: - #71026 (Fix false "never constructed" warnings for `Self::` variant paths) - #71310 (Do not show DefId in diagnostics) - #71317 (miri-unleash test for llvm_asm) - #71324 (Fix some tests failing in `--pass check` mode) Failed merges: r? @ghost
2020-04-19Dogfood more or_patterns in the compilerJosh Stone-19/+21
2020-04-19Fix false "never constructed" warnings for `Self::` variant pathsseiya-1/+3
2020-04-17Rollup merge of #69642 - ecstatic-morse:issue-69615, r=oli-obkDylan DPC-7/+7
Use query to determine whether function needs const checking Resolves #69615. The HIR const-checker was checking the `constness` of a function's `fn_sig` to determine whether a function needed const-checking. Now that const trait impls are a thing, this is no longer enough. All code should use the `is_const_fn_raw` query instead, which takes the constness of the impl block into account. r? @oli-obk
2020-04-16rustc: fix check_attr() for methods, closures and foreign functionsMatthias Schiffer-1/+4
UI tests are updated with additional error messages that were missing before.
2020-04-16don't clone types that are copy (clippy::clone_on_copy)Matthias Krüger-1/+1
2020-04-14Remove `DUMMY_HIR_ID`marmeladema-10/+0
2020-04-12Rollup merge of #71069 - marmeladema:dummy-hir-id-obligation-clause, r=eddybDylan DPC-11/+10
Remove some usage of `DUMMY_HIR_ID` Use `ObligationClause::dummy()` when appropriate or replace `hir::DUMMY_HIR_ID`by `hir::CRATE_HIR_ID`, as used in `ObligationClause::dummy()`.
2020-04-12Rollup merge of #67766 - sapir:fix-unused-in-or-pattern-warning, r=matthewjasperDylan DPC-26/+49
Fix warning for unused variables in or pattern (issue #67691) Is this a good way to fix it? Also, the tests fail, the "fixed" code output says `{ i, j }` instead of `{ i, j: _ }`, how can I fix that?
2020-04-12Remove usage of `DUMMY_HIR_ID` in `CheckAttrVisitor::check_inline`marmeladema-3/+2