mirror of
https://github.com/github/codeql.git
synced 2026-04-23 07:45:17 +02:00
Merge pull request #19751 from hvitved/rust/type-inference-macro-expr
Rust: Type inference for macro expressions
This commit is contained in:
@@ -265,6 +265,8 @@ private predicate typeEquality(AstNode n1, TypePath prefix1, AstNode n2, TypePat
|
||||
n1 = be.getLhs() and
|
||||
n2 = be.getRhs()
|
||||
)
|
||||
or
|
||||
n1 = n2.(MacroExpr).getMacroCall().getMacroCallExpansion()
|
||||
)
|
||||
or
|
||||
n1 = n2.(RefExpr).getExpr() and
|
||||
|
||||
@@ -1810,6 +1810,12 @@ mod indexers {
|
||||
}
|
||||
}
|
||||
|
||||
mod macros {
|
||||
pub fn f() {
|
||||
let x = format!("Hello, {}", "World!"); // $ MISSING: type=x:String -- needs https://github.com/github/codeql/pull/19658
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
field_access::f();
|
||||
method_impl::f();
|
||||
@@ -1832,4 +1838,5 @@ fn main() {
|
||||
async_::f();
|
||||
impl_trait::f();
|
||||
indexers::f();
|
||||
macros::f();
|
||||
}
|
||||
|
||||
@@ -1021,8 +1021,12 @@ inferType
|
||||
| main.rs:912:19:912:22 | self | Snd | main.rs:910:15:910:17 | Snd |
|
||||
| main.rs:913:43:913:82 | MacroExpr | | main.rs:910:15:910:17 | Snd |
|
||||
| main.rs:913:50:913:81 | "PairNone has no second elemen... | | {EXTERNAL LOCATION} | str |
|
||||
| main.rs:913:50:913:81 | MacroExpr | | main.rs:910:15:910:17 | Snd |
|
||||
| main.rs:913:50:913:81 | { ... } | | main.rs:910:15:910:17 | Snd |
|
||||
| main.rs:914:43:914:81 | MacroExpr | | main.rs:910:15:910:17 | Snd |
|
||||
| main.rs:914:50:914:80 | "PairFst has no second element... | | {EXTERNAL LOCATION} | str |
|
||||
| main.rs:914:50:914:80 | MacroExpr | | main.rs:910:15:910:17 | Snd |
|
||||
| main.rs:914:50:914:80 | { ... } | | main.rs:910:15:910:17 | Snd |
|
||||
| main.rs:915:37:915:39 | snd | | main.rs:910:15:910:17 | Snd |
|
||||
| main.rs:915:45:915:47 | snd | | main.rs:910:15:910:17 | Snd |
|
||||
| main.rs:916:41:916:43 | snd | | main.rs:910:15:910:17 | Snd |
|
||||
@@ -2642,9 +2646,13 @@ inferType
|
||||
| main.rs:1809:24:1809:25 | xs | | file://:0:0:0:0 | [] |
|
||||
| main.rs:1809:24:1809:25 | xs | [T;...] | main.rs:1764:5:1765:13 | S |
|
||||
| main.rs:1809:24:1809:25 | xs | [T] | main.rs:1764:5:1765:13 | S |
|
||||
| main.rs:1815:5:1815:20 | ...::f(...) | | main.rs:67:5:67:21 | Foo |
|
||||
| main.rs:1816:5:1816:60 | ...::g(...) | | main.rs:67:5:67:21 | Foo |
|
||||
| main.rs:1816:20:1816:38 | ...::Foo {...} | | main.rs:67:5:67:21 | Foo |
|
||||
| main.rs:1816:41:1816:59 | ...::Foo {...} | | main.rs:67:5:67:21 | Foo |
|
||||
| main.rs:1832:5:1832:15 | ...::f(...) | | {EXTERNAL LOCATION} | trait Future |
|
||||
| main.rs:1815:25:1815:35 | "Hello, {}" | | {EXTERNAL LOCATION} | str |
|
||||
| main.rs:1815:25:1815:45 | ...::format(...) | | {EXTERNAL LOCATION} | String |
|
||||
| main.rs:1815:25:1815:45 | { ... } | | {EXTERNAL LOCATION} | String |
|
||||
| main.rs:1815:38:1815:45 | "World!" | | {EXTERNAL LOCATION} | str |
|
||||
| main.rs:1821:5:1821:20 | ...::f(...) | | main.rs:67:5:67:21 | Foo |
|
||||
| main.rs:1822:5:1822:60 | ...::g(...) | | main.rs:67:5:67:21 | Foo |
|
||||
| main.rs:1822:20:1822:38 | ...::Foo {...} | | main.rs:67:5:67:21 | Foo |
|
||||
| main.rs:1822:41:1822:59 | ...::Foo {...} | | main.rs:67:5:67:21 | Foo |
|
||||
| main.rs:1838:5:1838:15 | ...::f(...) | | {EXTERNAL LOCATION} | trait Future |
|
||||
testFailures
|
||||
|
||||
Reference in New Issue
Block a user