Skip to content

Commit 8451796

Browse files
committed
Rust: Add type inference test with borrow of unknown argument
1 parent 7c9d15b commit 8451796

File tree

2 files changed

+247
-235
lines changed

2 files changed

+247
-235
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1714,6 +1714,11 @@ mod overloadable_operators {
17141714
// Here the type of `default_vec2` must be inferred from the `+` call.
17151715
let default_vec2 = Default::default(); // $ type=default_vec2:Vec2
17161716
let vec2_zero_plus = Vec2 { x: 0, y: 0 } + default_vec2; // $ method=Vec2::add
1717+
1718+
// Here the type of `default_vec2` must be inferred from the `==` call
1719+
// and the type of the borrowed second argument is unknown at the call.
1720+
let default_vec2 = Default::default(); // $ MISSING: type=default_vec2:Vec2
1721+
let vec2_zero_plus = Vec2 { x: 0, y: 0 } == default_vec2; // $ method=Vec2::eq
17171722
}
17181723
}
17191724

0 commit comments

Comments
 (0)