]> git.lizzy.rs Git - rust.git/blob - tests/ui/trivial-bounds/trivial-bounds-inconsistent-projection.rs
Rollup merge of #106661 - mjguzik:linux_statx, r=Mark-Simulacrum
[rust.git] / tests / ui / trivial-bounds / trivial-bounds-inconsistent-projection.rs
1 // run-pass
2 // Check that global bounds result in the expected choice of associated type
3
4 #![feature(trivial_bounds)]
5 #![allow(unused)]
6
7 struct B;
8
9 trait A {
10     type X;
11     fn get_x() -> Self::X;
12 }
13
14 impl A for B {
15     type X = u8;
16     fn get_x() -> u8 { 0 }
17 }
18
19 fn underspecified_bound() -> u8
20 where
21     B: A //~ WARNING trivial_bounds
22 {
23     B::get_x()
24 }
25
26 fn inconsistent_bound() -> i32
27 where
28     B: A<X = i32> //~ WARNING trivial_bounds
29 {
30     B::get_x()
31 }
32
33 fn redundant_bound() -> u8
34 where
35     B: A<X = u8> //~ WARNING trivial_bounds
36 {
37     B::get_x()
38 }
39
40 fn inconsistent_dup_bound() -> i32
41 where
42     B: A<X = i32> + A
43     //~^ WARNING trivial_bounds
44     //~| WARNING trivial_bounds
45 {
46     B::get_x()
47 }
48
49 fn redundant_dup_bound() -> u8
50 where
51     B: A<X = u8> + A
52     //~^ WARNING trivial_bounds
53     //~| WARNING trivial_bounds
54 {
55     B::get_x()
56 }
57
58 fn main () {}