mirror of
https://github.com/github/codeql.git
synced 2026-04-28 10:15:14 +02:00
Rust: Fix canonical path for Deref trait
This commit is contained in:
@@ -21,7 +21,7 @@ private predicate isOverloaded(string op, int arity, string path, string method)
|
||||
op = "!" and path = "core::ops::bit::Not" and method = "not"
|
||||
or
|
||||
// Dereference
|
||||
op = "*" and path = "core::ops::Deref" and method = "deref"
|
||||
op = "*" and path = "core::ops::deref::Deref" and method = "deref"
|
||||
)
|
||||
or
|
||||
arity = 2 and
|
||||
|
||||
@@ -1098,9 +1098,9 @@ mod method_call_type_conversion {
|
||||
println!("{:?}", x5.m1()); // $ method=m1
|
||||
println!("{:?}", x5.0); // $ fieldof=S
|
||||
|
||||
let x6 = &S(S2);
|
||||
let x6 = &S(S2); // $ SPURIOUS: type=x6:&T.&T.S
|
||||
// explicit dereference
|
||||
println!("{:?}", (*x6).m1()); // $ method=m1
|
||||
println!("{:?}", (*x6).m1()); // $ method=m1 method=deref
|
||||
|
||||
let x7 = S(&S2);
|
||||
// Non-implicit dereference with nested borrow in order to test that the
|
||||
@@ -1191,7 +1191,7 @@ mod borrowed_typed {
|
||||
x.f2(); // $ method=f2
|
||||
S::f3(&x);
|
||||
|
||||
let n = **&&true; // $ type=n:bool
|
||||
let n = **&&true; // $ type=n:bool method=deref
|
||||
|
||||
// In this example the type of `flag` must be inferred at the call to
|
||||
// `flip` and flow through the borrow in the argument.
|
||||
|
||||
@@ -1352,22 +1352,40 @@ inferType
|
||||
| main.rs:1099:26:1099:27 | x5 | &T.T | main.rs:1060:5:1061:14 | S2 |
|
||||
| main.rs:1099:26:1099:29 | x5.0 | | main.rs:1060:5:1061:14 | S2 |
|
||||
| main.rs:1101:13:1101:14 | x6 | | file://:0:0:0:0 | & |
|
||||
| main.rs:1101:13:1101:14 | x6 | &T | file://:0:0:0:0 | & |
|
||||
| main.rs:1101:13:1101:14 | x6 | &T | main.rs:1057:5:1058:19 | S |
|
||||
| main.rs:1101:13:1101:14 | x6 | &T.&T | main.rs:1057:5:1058:19 | S |
|
||||
| main.rs:1101:13:1101:14 | x6 | &T.&T.T | main.rs:1060:5:1061:14 | S2 |
|
||||
| main.rs:1101:13:1101:14 | x6 | &T.T | main.rs:1060:5:1061:14 | S2 |
|
||||
| main.rs:1101:18:1101:23 | &... | | file://:0:0:0:0 | & |
|
||||
| main.rs:1101:18:1101:23 | &... | &T | file://:0:0:0:0 | & |
|
||||
| main.rs:1101:18:1101:23 | &... | &T | main.rs:1057:5:1058:19 | S |
|
||||
| main.rs:1101:18:1101:23 | &... | &T.&T | main.rs:1057:5:1058:19 | S |
|
||||
| main.rs:1101:18:1101:23 | &... | &T.&T.T | main.rs:1060:5:1061:14 | S2 |
|
||||
| main.rs:1101:18:1101:23 | &... | &T.T | main.rs:1060:5:1061:14 | S2 |
|
||||
| main.rs:1101:19:1101:23 | S(...) | | file://:0:0:0:0 | & |
|
||||
| main.rs:1101:19:1101:23 | S(...) | | main.rs:1057:5:1058:19 | S |
|
||||
| main.rs:1101:19:1101:23 | S(...) | &T | main.rs:1057:5:1058:19 | S |
|
||||
| main.rs:1101:19:1101:23 | S(...) | &T.T | main.rs:1060:5:1061:14 | S2 |
|
||||
| main.rs:1101:19:1101:23 | S(...) | T | main.rs:1060:5:1061:14 | S2 |
|
||||
| main.rs:1101:21:1101:22 | S2 | | main.rs:1060:5:1061:14 | S2 |
|
||||
| main.rs:1103:18:1103:23 | "{:?}\\n" | | {EXTERNAL LOCATION} | str |
|
||||
| main.rs:1103:26:1103:30 | (...) | | file://:0:0:0:0 | & |
|
||||
| main.rs:1103:26:1103:30 | (...) | | main.rs:1057:5:1058:19 | S |
|
||||
| main.rs:1103:26:1103:30 | (...) | &T | main.rs:1057:5:1058:19 | S |
|
||||
| main.rs:1103:26:1103:30 | (...) | &T.T | main.rs:1060:5:1061:14 | S2 |
|
||||
| main.rs:1103:26:1103:30 | (...) | T | main.rs:1060:5:1061:14 | S2 |
|
||||
| main.rs:1103:26:1103:35 | ... .m1() | | main.rs:1060:5:1061:14 | S2 |
|
||||
| main.rs:1103:27:1103:29 | * ... | | file://:0:0:0:0 | & |
|
||||
| main.rs:1103:27:1103:29 | * ... | | main.rs:1057:5:1058:19 | S |
|
||||
| main.rs:1103:27:1103:29 | * ... | &T | main.rs:1057:5:1058:19 | S |
|
||||
| main.rs:1103:27:1103:29 | * ... | &T.T | main.rs:1060:5:1061:14 | S2 |
|
||||
| main.rs:1103:27:1103:29 | * ... | T | main.rs:1060:5:1061:14 | S2 |
|
||||
| main.rs:1103:28:1103:29 | x6 | | file://:0:0:0:0 | & |
|
||||
| main.rs:1103:28:1103:29 | x6 | &T | file://:0:0:0:0 | & |
|
||||
| main.rs:1103:28:1103:29 | x6 | &T | main.rs:1057:5:1058:19 | S |
|
||||
| main.rs:1103:28:1103:29 | x6 | &T.&T | main.rs:1057:5:1058:19 | S |
|
||||
| main.rs:1103:28:1103:29 | x6 | &T.&T.T | main.rs:1060:5:1061:14 | S2 |
|
||||
| main.rs:1103:28:1103:29 | x6 | &T.T | main.rs:1060:5:1061:14 | S2 |
|
||||
| main.rs:1105:13:1105:14 | x7 | | main.rs:1057:5:1058:19 | S |
|
||||
| main.rs:1105:13:1105:14 | x7 | T | file://:0:0:0:0 | & |
|
||||
@@ -1531,15 +1549,21 @@ inferType
|
||||
| main.rs:1192:15:1192:16 | &x | &T | main.rs:1168:5:1168:13 | S |
|
||||
| main.rs:1192:16:1192:16 | x | | main.rs:1168:5:1168:13 | S |
|
||||
| main.rs:1194:13:1194:13 | n | | {EXTERNAL LOCATION} | bool |
|
||||
| main.rs:1194:13:1194:13 | n | | file://:0:0:0:0 | & |
|
||||
| main.rs:1194:17:1194:24 | * ... | | {EXTERNAL LOCATION} | bool |
|
||||
| main.rs:1194:17:1194:24 | * ... | | file://:0:0:0:0 | & |
|
||||
| main.rs:1194:18:1194:24 | * ... | | file://:0:0:0:0 | & |
|
||||
| main.rs:1194:18:1194:24 | * ... | &T | {EXTERNAL LOCATION} | bool |
|
||||
| main.rs:1194:18:1194:24 | * ... | &T | file://:0:0:0:0 | & |
|
||||
| main.rs:1194:19:1194:24 | &... | | file://:0:0:0:0 | & |
|
||||
| main.rs:1194:19:1194:24 | &... | &T | file://:0:0:0:0 | & |
|
||||
| main.rs:1194:19:1194:24 | &... | &T.&T | {EXTERNAL LOCATION} | bool |
|
||||
| main.rs:1194:19:1194:24 | &... | &T.&T | file://:0:0:0:0 | & |
|
||||
| main.rs:1194:20:1194:24 | &true | | file://:0:0:0:0 | & |
|
||||
| main.rs:1194:20:1194:24 | &true | &T | {EXTERNAL LOCATION} | bool |
|
||||
| main.rs:1194:20:1194:24 | &true | &T | file://:0:0:0:0 | & |
|
||||
| main.rs:1194:21:1194:24 | true | | {EXTERNAL LOCATION} | bool |
|
||||
| main.rs:1194:21:1194:24 | true | | file://:0:0:0:0 | & |
|
||||
| main.rs:1198:13:1198:20 | mut flag | | main.rs:1157:5:1160:5 | MyFlag |
|
||||
| main.rs:1198:24:1198:41 | ...::default(...) | | main.rs:1157:5:1160:5 | MyFlag |
|
||||
| main.rs:1199:22:1199:30 | &mut flag | | file://:0:0:0:0 | & |
|
||||
|
||||
Reference in New Issue
Block a user