-
Notifications
You must be signed in to change notification settings - Fork 380
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
False negative: borrow of moved value #5148
Comments
This also doesn't appropriately flag an error when taking ownership via a function call: fn main() {
let s = String::from("");
take_ownership(s);
println!("{}", s); // This should be highlighted as an error
}
fn take_ownership(s: String) {} |
Possibly related false positive on move: |
No, they are not related |
@ortem Looks like |
@Undin Yes, I disabled macro_rules! consume { ($e:expr) => ($e;); }
struct S;
fn main() {
let s = S;
consume!(s);
s; // highlighted move error
} So it would be great to use the information from move analysis to highlight corresponding macro arguments as the cause of the error. I've opened the corresponding issue: #5152 However, the cases described by @j-delaney relate to borrow analysis, not move analysis, so they are not supported yet in our plugin. Our struct S;
fn loan(s: &S) {}
fn main() {
let s1 = S;
let s2 = s1;
loan(&s1); // oops, no error highlighted
} But I think such primitive cases can be highlighted with |
Environment
Problem description
When attempting to borrow a moved value, it should identify this issue in the IDE and alert the user.
Steps to reproduce
With
cargo check
this gives:but it does not error within IDEA
The text was updated successfully, but these errors were encountered: