about summary refs log tree commit diff
path: root/compiler/rustc_mir_dataflow/src
AgeCommit message (Collapse)AuthorLines
2023-12-15NFC don't convert types to identical typesMatthias Krüger-5/+1
2023-12-10remove redundant importssurechen-2/+0
detects redundant imports that can be eliminated. for #117772 : In order to facilitate review and modification, split the checking code and removing redundant imports code into two PR.
2023-12-08Tweak `GenKillAnalysis`.Nicholas Nethercote-19/+22
`GenKillAnalysis` has five methods that take a transfer function arg: - `statement_effect` - `before_statement_effect` - `terminator_effect` - `before_terminator_effect` - `call_return_effect` All the transfer function args have type `&mut impl GenKill<Self::Idx>`, except for `terminator_effect`, which takes the simpler `Self::Domain`. But only the first two need to be `impl GenKill`. The other three can all be `Self::Domain`, just like `Analysis`. So this commit changes the last two to take `Self::Domain`, making `GenKillAnalysis` and `Analysis` more similar. (Another idea would be to make all these methods `impl GenKill`. But that doesn't work: `MaybeInitializedPlaces::terminator_effect` requires the arg be `Self::Domain` so that `self_is_unwind_dead(place, state)` can be called on it.)
2023-12-08Remove `impl_visitable!`.Nicholas Nethercote-2/+2
It is used just once. With it removed, the relevant code is a little boilerplate-y but much easier to read, and is the same length. Overall I think it's an improvement.
2023-12-08Remove unused arguments from `ResultsVisitor::visit_block_{start,end}`.Nicholas Nethercote-34/+8
2023-11-27Deparameterize `Results` and `ResultsCursor`.Nicholas Nethercote-72/+27
They both now only ever contain a `Results<'tcx, A>`. This means `AnalysisResults` can be removed, as can many `borrow`/`borrow_mut` calls. Also `Results` no longer needs a `PhantomData` because `'tcx` is now named by `entry_sets`.
2023-11-27Remove `ResultsCloned` and `ResultsClonedCursor`.Nicholas Nethercote-26/+4
They're now unused.
2023-11-27Remove uses of `ResultsClonedCursor`.Nicholas Nethercote-14/+14
By just cloning the entire `Results` in the one place where `ResultsClonedCursor` was used. This is extra allocations but the performance effect is negligible.
2023-11-27Remove `ResultsRefCursor`.Nicholas Nethercote-29/+2
It's no longer used.
2023-11-27Remove another use of `as_results_cursor`.Nicholas Nethercote-40/+62
The new code is a little clunky, but I couldn't see how to make it better.
2023-11-27Remove `CloneAnalysis`.Nicholas Nethercote-29/+5
It's only implemented for analyses that implement `Copy`, which means it's basically a complicated synonym for `Copy`. So this commit removes it and uses `Copy` directly. (That direct use will be removed in a later commit.)
2023-11-27Remove some unused code relating to `ResultsCloned`.Nicholas Nethercote-39/+2
2023-11-27Use typedefs to clarify some impls.Nicholas Nethercote-2/+5
And insert some whitespace.
2023-11-25Rollup merge of #118288 - compiler-errors:is_some_and, r=lqd,dtolnayMichael Goulet-1/+1
Use `is_{some,ok}_and` more in the compiler slightly more fluent-reading code
2023-11-26Use `rustc_fluent_macro::fluent_messages!` directly.Nicholas Nethercote-2/+1
Currently we always do this: ``` use rustc_fluent_macro::fluent_messages; ... fluent_messages! { "./example.ftl" } ``` But there is no need, we can just do this everywhere: ``` rustc_fluent_macro::fluent_messages! { "./example.ftl" } ``` which is shorter.
2023-11-26Avoid need for `{D,Subd}iagnosticMessage` imports.Nicholas Nethercote-1/+0
The `fluent_messages!` macro produces uses of `crate::{D,Subd}iagnosticMessage`, which means that every crate using the macro must have this import: ``` use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage}; ``` This commit changes the macro to instead use `rustc_errors::{D,Subd}iagnosticMessage`, which avoids the need for the imports.
2023-11-25is_{some,ok}_andMichael Goulet-1/+1
2023-11-25Auto merge of #118203 - nnethercote:rustc_mir_dataflow, r=cjgillotbors-164/+88
Minor `rustc_mir_dataflow` cleanups r? `@cjgillot`
2023-11-24Remove `ResultsCursor::get_with_analysis`.Nicholas Nethercote-6/+2
We can just call `ResultsCursor::state` and `ResultsCursor::analysis` separately.
2023-11-24Remove unnecessary `mut`.Nicholas Nethercote-1/+1
`mut_results` immediately below is the `&mut self` version, this one should be `&self`.
2023-11-24Remove unused arguments from `on_all_children_bits`.Nicholas Nethercote-56/+25
`on_all_children_bits` has two arguments that are unused: `tcx` and `body`. This was not detected by the compiler because it's a recursive function. This commit removes them, and removes lots of other arguments and fields that are no longer necessary.
2023-11-24Remove unused `EverInitializedPlaces::tcx` field.Nicholas Nethercote-4/+2
2023-11-24Remove unneeded derives from `MaybeLiveLocals`.Nicholas Nethercote-1/+0
2023-11-23Use `'mir` lifetime name more.Nicholas Nethercote-14/+14
Some types have a `body: &'mir Body<'tcx>` and some have `body: &'a Body<'tcx>`. The former is more readable, so this commit converts some fo the latter to the former.
2023-11-23Remove unnecessary things from `State` and `Map`.Nicholas Nethercote-25/+4
2023-11-23Remove unnecessary and misleading `..` in a pattern.Nicholas Nethercote-1/+0
All the fields are named.
2023-11-23Remove unnecessary `ValueAnalysisWrapper::Direction`.Nicholas Nethercote-5/+1
`Forward` is the default.
2023-11-23Reduce `pub` usage.Nicholas Nethercote-12/+10
2023-11-23Avoid unnecessary exports.Nicholas Nethercote-11/+11
2023-11-23Remove `indexes` module.Nicholas Nethercote-6/+1
It's not useful, and only obfuscates things.
2023-11-23Move `has_rustc_mir_with`.Nicholas Nethercote-19/+17
`lib.rs` is a strange place for it, and it's only used within `rustc_peek.rs`, so it doesn't need to be `pub`.
2023-11-23Reorder some `use` items.Nicholas Nethercote-8/+6
The current order is a mess.
2023-11-23Remove unused feature.Nicholas Nethercote-1/+0
2023-11-22Replace `no_ord_impl` with `orderable`.Nicholas Nethercote-0/+2
Similar to the previous commit, this replaces `newtype_index`'s opt-out `no_ord_impl` attribute with the opt-in `orderable` attribute.
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-15/+11
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`. Then I had to remove a few unnecessary parens and muts that were exposed now.
2023-11-08rename `BorrowKind::Shallow` to `Fake`lcnr-2/+2
also adds some comments
2023-11-08generator layout: ignore fake borrowslcnr-2/+7
2023-10-24Auto merge of #116300 - cjgillot:split-move, r=petrochenkovbors-253/+125
Separate move path tracking between borrowck and drop elaboration. The primary goal of this PR is to skip creating a `MovePathIndex` for path that do not need dropping in drop elaboration. The 2 first commits are cleanups. The next 2 commits displace `move` errors from move-path builder to borrowck. Move-path builder keeps the same logic, but does not carry error information any more. The remaining commits allow to filter `MovePathIndex` creation according to types. This is used in drop elaboration, to avoid computing dataflow for paths that do not need dropping.
2023-10-23Auto merge of #116033 - bvanjoi:fix-116032, r=petrochenkovbors-1/+1
report `unused_import` for empty reexports even it is pub Fixes #116032 An easy fix. r? `@petrochenkov` (Discovered this issue while reviewing #115993.)
2023-10-22use visibility to check unused imports and delete some stmtsbohan-1/+1
2023-10-21Use terse form for Fn bound.Camille GILLOT-16/+4
2023-10-21Remove on_all_drop_children_bits.Camille GILLOT-27/+3
As drop elaboration only tracks places that need dropping, is has become equivalent to `on_all_children_bits`.
2023-10-21Parametrize gather_moves by filter.Camille GILLOT-60/+84
2023-10-21Stop computing error info in move path builder.Camille GILLOT-82/+26
2023-10-21Avoid using a magic value for untracked locals.Camille GILLOT-25/+32
2023-10-21Do not report errors from move path builder.Camille GILLOT-17/+8
2023-10-21Remove is_terminal_path.Camille GILLOT-59/+1
That information is redundant. Is the path is terminal, `first_child` will already be `None`.
2023-10-21Improve naming and comments.Camille GILLOT-17/+45
2023-10-21Implement JumpThreading pass.Camille GILLOT-18/+89
2023-10-20s/generator/coroutine/Oli Scherer-13/+13