Skip to content

Commit c328a92

Browse files
committed
Rust: Add example with multiple where clause items for the same type parameter
1 parent ff4cb51 commit c328a92

File tree

2 files changed

+3502
-3485
lines changed

2 files changed

+3502
-3485
lines changed

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,15 @@ mod type_parameter_bounds {
559559
fn snd(self) -> P2;
560560
}
561561

562+
fn trait_per_multiple_where_bounds_with_type<T>(x: T, y: T)
563+
where
564+
T: FirstTrait<S1>,
565+
T: Pair<S1, bool>,
566+
{
567+
let _ = x.fst(); // $ target=fst type=_:S1
568+
let _ = y.method(); // $ target=FirstTrait::method _:S1
569+
}
570+
562571
fn call_trait_per_bound_with_type_1<T: Pair<S1, S2>>(x: T, y: T) {
563572
// The type in the type parameter bound determines the return type.
564573
let s1 = x.fst(); // $ target=fst type=s1:S1
@@ -2015,7 +2024,7 @@ mod impl_trait {
20152024
let c = uses_my_trait2(a); // $ type=c:S2 target=uses_my_trait2
20162025
let d = uses_my_trait2(S1); // $ type=d:S2 target=uses_my_trait2
20172026
let e = get_a_my_trait2(S1).get_a(); // $ target=get_a_my_trait2 target=MyTrait::get_a type=e:S1
2018-
// For this function the `impl` type does not appear in the root of the return type
2027+
// For this function the `impl` type does not appear in the root of the return type
20192028
let f = get_a_my_trait3(S1).unwrap().get_a(); // $ target=get_a_my_trait3 target=unwrap target=MyTrait::get_a type=f:S1
20202029
let g = get_a_my_trait4(S1).0.get_a(); // $ target=get_a_my_trait4 target=MyTrait::get_a type=g:S1
20212030
}

0 commit comments

Comments
 (0)