-
Notifications
You must be signed in to change notification settings - Fork 2k
Rust: Update legacy MaD models 3 #19946
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
Changes from 1 commit
3027f75
8d0c14c
097ac69
a034e29
47a4ba3
7ba18fa
7507834
01c75e3
6de5a61
33ea822
68a37f9
e20ae48
05e1cd4
be7db80
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +0,0 @@ | ||
| | main.rs:34:37:34:54 | //... | Missing result: database-read | | ||
| | main.rs:35:37:35:54 | //... | Missing result: database-read | | ||
| | main.rs:36:37:36:54 | //... | Missing result: database-read | | ||
| | main.rs:43:41:43:58 | //... | Missing result: database-read | | ||
| | main.rs:44:41:44:58 | //... | Missing result: database-read | | ||
| | main.rs:45:41:45:58 | //... | Missing result: database-read | | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,27 +24,27 @@ fn main() -> Result<(), Box<dyn std::error::Error>> { | |
| )", | ||
| (), | ||
| )?; | ||
|
|
||
| let query = format!("INSERT INTO person (name, age) VALUES ('{}', '{}')", name, age); | ||
|
|
||
| connection.execute(&query, ())?; // $ sql-sink | ||
|
|
||
| let person = connection.query_row(&query, (), |row| { // $ sql-sink | ||
| Ok(Person { | ||
| id: row.get(0)?, // $ database-read | ||
| name: row.get(1)?, // $ database-read | ||
| age: row.get(2)?, // $ database-read | ||
| id: row.get(0)?, // $ MISSING: database-read | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you sure the problem is a missing canonical path, or is the problem that
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just checked the canonical path exists, the problem is the type inferencer, most likely the closure argument.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep you're right, the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah that's why I use a predicate test(MethodCallExpr e, Function target, string path) {
target = e.getStaticTarget() and
path = concat(target.getCanonicalPath())
}
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Correct; type inference for closures is a known gap.
I can also recommend the various debug predicates in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will try the |
||
| name: row.get(1)?, // $ MISSING: database-read | ||
| age: row.get(2)?, // $ MISSING: database-read | ||
| }) | ||
| })?; | ||
|
|
||
| let mut stmt = connection.prepare("SELECT id, name, age FROM person")?; // $ sql-sink | ||
| let people = stmt.query_map([], |row| { | ||
| Ok(Person { | ||
|
geoffw0 marked this conversation as resolved.
|
||
| id: row.get_unwrap(0), // $ database-read | ||
| name: row.get_unwrap(1), // $ database-read | ||
| age: row.get_unwrap(2), // $ database-read | ||
| id: row.get_unwrap(0), // $ MISSING: database-read | ||
| name: row.get_unwrap(1), // $ MISSING: database-read | ||
| age: row.get_unwrap(2), // $ MISSING: database-read | ||
| }) | ||
| })?; | ||
|
|
||
| Ok(()) | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.