-
Notifications
You must be signed in to change notification settings - Fork 11.7k
[move-compiler] More lint filtering #19364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Skipped Deployments
|
// utils | ||
//************************************************************************************************** | ||
|
||
pub fn has_special<FCommand, FExp>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of special
, maybe any
? The names has_any_command
and has_any_exp
might better-communicate what this code is doing.
fn has_special_( | ||
cfg: &ImmForwardCFG, | ||
p_command: &mut impl FnMut(&Command) -> bool, | ||
p_exp: &mut impl FnMut(&Exp) -> bool, | ||
) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work?
fn has_special_( | |
cfg: &ImmForwardCFG, | |
p_command: &mut impl FnMut(&Command) -> bool, | |
p_exp: &mut impl FnMut(&Exp) -> bool, | |
) -> bool { | |
fn has_special_<FCmd, FExp>( | |
cfg: &ImmForwardCFG, | |
p_command: &mut impl FCommand, | |
p_exp: &mut impl FExp, | |
) -> bool | |
where | |
FCommand: FnMut(&Command) -> bool, | |
FExp: FnMut(&Exp) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It did not, but I'll try again to be sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error[E0382]: use of moved value: `p_exp`
--> crates/move-compiler/src/cfgir/visitor.rs:861:86
|
846 | mut p_exp: FExp,
| --------- move occurs because `p_exp` has type `FExp`, which does not implement the `Copy` trait
...
861 | C::Mutate(el, er) => has_special_exp_(el, p_exp) || has_special_exp_(er, p_ex...
| ----- value moved here ^^^^^ value used here after move
|
note: consider changing this parameter type in function `has_special_exp_` to borrow instead if owning the value isn't necessary
--> crates/move-compiler/src/cfgir/visitor.rs:868:43
|
868 | fn has_special_exp_<FExp>(e: &Exp, mut p: FExp) -...
| ---------------- in this function ^^^^ this parameter takes ownership of the value
help: if `FExp` implemented `Clone`, you could clone the value
--> crates/move-compiler/src/cfgir/visitor.rs:843:35
|
843 | ...mmand, FExp>(
| ^^^^ consider constraining this type parameter with `Clone`
...
861 | ...r) => has_special_exp_(el, p_exp) || has_spec...
| ----- you could clone this value
help: consider mutably borrowing `p_exp`
|
861 | C::Mutate(el, er) => has_special_exp_(el, &mut p_exp) || has_special_exp_(er, p_exp),
| ++++
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do wonder how much work the pre-filtering is saving us in terms of clock time, but otherwise LGTM.
It is a good question. For the abstract interpretation ones, I would imagine a good bit? And these are the only ones I put it on. But I haven't really clocked it. Maybe I should |
Description
Test plan
Release notes
Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.
For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.