]> git.lizzy.rs Git - rust.git/blob - tests/ui/chalkify/type_implied_bound.rs
Auto merge of #101138 - Rejyr:diagnostic-migration-rustc-lint-pt2, r=davidtwco
[rust.git] / tests / ui / chalkify / type_implied_bound.rs
1 // run-pass
2 // compile-flags: -Z trait-solver=chalk
3
4 trait Eq { }
5 trait Hash: Eq { }
6
7 impl Eq for i32 { }
8 impl Hash for i32 { }
9
10 struct Set<T: Hash> {
11     _x: T,
12 }
13
14 fn only_eq<T: Eq>() { }
15
16 fn take_a_set<T>(_: &Set<T>) {
17     // `Set<T>` is an input type of `take_a_set`, hence we know that
18     // `T` must implement `Hash`, and we know in turn that `T` must
19     // implement `Eq`.
20     only_eq::<T>()
21 }
22
23 fn main() {
24     let set = Set {
25         _x: 5,
26     };
27
28     take_a_set(&set);
29 }