| Age | Commit message (Collapse) | Author | Lines |
|
|
|
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.
|
|
`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.)
|
|
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.
|
|
|
|
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`.
|
|
They're now unused.
|
|
By just cloning the entire `Results` in the one place where
`ResultsClonedCursor` was used. This is extra allocations but the
performance effect is negligible.
|
|
It's no longer used.
|
|
The new code is a little clunky, but I couldn't see how to make it
better.
|
|
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.)
|
|
|
|
And insert some whitespace.
|
|
Use `is_{some,ok}_and` more in the compiler
slightly more fluent-reading code
|
|
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.
|
|
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.
|
|
|
|
Minor `rustc_mir_dataflow` cleanups
r? `@cjgillot`
|
|
We can just call `ResultsCursor::state` and `ResultsCursor::analysis`
separately.
|
|
`mut_results` immediately below is the `&mut self` version, this one
should be `&self`.
|
|
`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.
|
|
|
|
|
|
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.
|
|
|
|
All the fields are named.
|
|
`Forward` is the default.
|
|
|
|
|
|
It's not useful, and only obfuscates things.
|
|
`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`.
|
|
The current order is a mess.
|
|
|
|
Similar to the previous commit, this replaces `newtype_index`'s opt-out
`no_ord_impl` attribute with the opt-in `orderable` attribute.
|
|
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`.
Then I had to remove a few unnecessary parens and muts that were exposed
now.
|
|
also adds some comments
|
|
|
|
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.
|
|
report `unused_import` for empty reexports even it is pub
Fixes #116032
An easy fix. r? `@petrochenkov`
(Discovered this issue while reviewing #115993.)
|
|
|
|
|
|
As drop elaboration only tracks places that need dropping, is has become
equivalent to `on_all_children_bits`.
|
|
|
|
|
|
|
|
|
|
That information is redundant. Is the path is terminal, `first_child` will
already be `None`.
|
|
|
|
|
|
|