Skip to content

Commit 33e6310

Browse files
authored
Merge pull request #19993 from hvitved/rust/type-inference-function-call-expectations
Rust: Add type inference inline expectations for all function calls
2 parents aef357c + fad5e0d commit 33e6310

File tree

6 files changed

+2695
-2680
lines changed

6 files changed

+2695
-2680
lines changed

rust/ql/lib/rust.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ import codeql.rust.elements.AsyncBlockExpr
1515
import codeql.rust.elements.Variable
1616
import codeql.rust.elements.NamedFormatArgument
1717
import codeql.rust.elements.PositionalFormatArgument
18+
private import codeql.rust.elements.Call as Call
19+
20+
class Call = Call::Call;
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
multipleCallTargets
22
| dereference.rs:61:15:61:24 | e1.deref() |
3-
| main.rs:2086:13:2086:31 | ...::from(...) |
4-
| main.rs:2087:13:2087:31 | ...::from(...) |
5-
| main.rs:2088:13:2088:31 | ...::from(...) |
6-
| main.rs:2094:13:2094:31 | ...::from(...) |
7-
| main.rs:2095:13:2095:31 | ...::from(...) |
83
| main.rs:2096:13:2096:31 | ...::from(...) |
9-
| main.rs:2132:21:2132:43 | ...::from(...) |
4+
| main.rs:2097:13:2097:31 | ...::from(...) |
5+
| main.rs:2098:13:2098:31 | ...::from(...) |
6+
| main.rs:2104:13:2104:31 | ...::from(...) |
7+
| main.rs:2105:13:2105:31 | ...::from(...) |
8+
| main.rs:2106:13:2106:31 | ...::from(...) |
9+
| main.rs:2142:21:2142:43 | ...::from(...) |

rust/ql/test/library-tests/type-inference/dereference.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,15 @@ fn explicit_ref_dereference() {
7171

7272
fn explicit_box_dereference() {
7373
// Explicit dereference with type parameter
74-
let g1: Box<char> = Box::new('a');
74+
let g1: Box<char> = Box::new('a'); // $ method=new
7575
let _h1 = g1.deref(); // $ method=deref type=_h1:&T.char
7676

7777
// Explicit dereference with type parameter
78-
let g2: Box<char> = Box::new('a');
78+
let g2: Box<char> = Box::new('a'); // $ method=new
7979
let _h2 = *g2; // $ method=deref type=_h2:char
8080

8181
// Call method on explicitly dereferenced value with type parameter
82-
let g3: Box<i64> = Box::new(34i64);
82+
let g3: Box<i64> = Box::new(34i64); // $ method=new
8383
let _h3 = (*g3).is_positive(); // $ method=deref method=is_positive type=_h3:bool
8484
}
8585

@@ -94,9 +94,9 @@ fn implicit_dereference() {
9494
}
9595

9696
pub fn test() {
97-
explicit_monomorphic_dereference();
98-
explicit_polymorphic_dereference();
99-
explicit_ref_dereference();
100-
explicit_box_dereference();
101-
implicit_dereference();
97+
explicit_monomorphic_dereference(); // $ method=explicit_monomorphic_dereference
98+
explicit_polymorphic_dereference(); // $ method=explicit_polymorphic_dereference
99+
explicit_ref_dereference(); // $ method=explicit_ref_dereference
100+
explicit_box_dereference(); // $ method=explicit_box_dereference
101+
implicit_dereference(); // $ method=implicit_dereference
102102
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy