Skip to content

Commit 94a6fd5

Browse files
committed
Rust: Add example with multiple where clause items for the same type parameter
1 parent 8b5637c commit 94a6fd5

File tree

3 files changed

+3506
-3489
lines changed

3 files changed

+3506
-3489
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
multipleCallTargets
22
| dereference.rs:61:15:61:24 | e1.deref() |
3-
| main.rs:2304:13:2304:31 | ...::from(...) |
4-
| main.rs:2305:13:2305:31 | ...::from(...) |
5-
| main.rs:2306:13:2306:31 | ...::from(...) |
6-
| main.rs:2312:13:2312:31 | ...::from(...) |
73
| main.rs:2313:13:2313:31 | ...::from(...) |
84
| main.rs:2314:13:2314:31 | ...::from(...) |
5+
| main.rs:2315:13:2315:31 | ...::from(...) |
6+
| main.rs:2321:13:2321:31 | ...::from(...) |
7+
| main.rs:2322:13:2322:31 | ...::from(...) |
8+
| main.rs:2323:13:2323:31 | ...::from(...) |

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)