-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Rust: Add type inference inline expectations for all function calls #19993
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
Rust: Add type inference inline expectations for all function calls #19993
Conversation
c59d15e
to
fad5e0d
Compare
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
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.
This looks good to me.
@@ -15,3 +15,6 @@ import codeql.rust.elements.AsyncBlockExpr | |||
import codeql.rust.elements.Variable | |||
import codeql.rust.elements.NamedFormatArgument | |||
import codeql.rust.elements.PositionalFormatArgument | |||
private import codeql.rust.elements.Call as Call |
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.
Why not simply
import codeql.rust.elements.Call
?
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 also exposes the class ArgumentPosition
, which I'm not sure we want to.
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.
Ok makes sense. Perhaps ArgumentPosition
should have been in another file.
fn call_trait_m1<T1, T2: MyTrait<T1>>(x: T2) -> T1 { | ||
x.m1() // $ method=m1 type=x.m1():T1 | ||
} | ||
|
||
// Type parameter with bound occurs nested within another type. | ||
|
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.
Let's not shift line numbers for no good reason
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.
These linebreaks are actually all deliberate; otherwise the comments are treated as identifiers for the proceeding methods, and that breaks inline expectations.
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.
Ah ok, it looked like a formatter gone wrong.
Adds inline expectations for all kinds of calls, not just calls to methods.