]> git.lizzy.rs Git - rust.git/blob - src/test/ui/associated-types/defaults-specialization.stderr
feat(rustdoc): open sidebar menu when links inside it are focused
[rust.git] / src / test / ui / associated-types / defaults-specialization.stderr
1 warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
2   --> $DIR/defaults-specialization.rs:3:38
3    |
4 LL | #![feature(associated_type_defaults, specialization)]
5    |                                      ^^^^^^^^^^^^^^
6    |
7    = note: `#[warn(incomplete_features)]` on by default
8    = note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
9    = help: consider using `min_specialization` instead, which is more stable and complete
10
11 error[E0053]: method `make` has an incompatible type for trait
12   --> $DIR/defaults-specialization.rs:19:18
13    |
14 LL |     fn make() -> Self::Ty {
15    |                  -------- type in trait
16 ...
17 LL |     fn make() -> u8 { 0 }
18    |                  ^^
19    |                  |
20    |                  expected associated type, found `u8`
21    |                  help: change the output type to match the trait: `<A<T> as Tr>::Ty`
22    |
23    = note: expected fn pointer `fn() -> <A<T> as Tr>::Ty`
24               found fn pointer `fn() -> u8`
25
26 error[E0053]: method `make` has an incompatible type for trait
27   --> $DIR/defaults-specialization.rs:35:18
28    |
29 LL |     fn make() -> Self::Ty {
30    |                  -------- type in trait
31 ...
32 LL |     default type Ty = bool;
33    |     ----------------------- expected this associated type
34 LL | 
35 LL |     fn make() -> bool { true }
36    |                  ^^^^
37    |                  |
38    |                  expected associated type, found `bool`
39    |                  help: change the output type to match the trait: `<B<T> as Tr>::Ty`
40    |
41    = note: expected fn pointer `fn() -> <B<T> as Tr>::Ty`
42               found fn pointer `fn() -> bool`
43
44 error[E0308]: mismatched types
45   --> $DIR/defaults-specialization.rs:10:9
46    |
47 LL |     type Ty = u8;
48    |     ------------- associated type defaults can't be assumed inside the trait defining them
49 LL | 
50 LL |     fn make() -> Self::Ty {
51    |                  -------- expected `<Self as Tr>::Ty` because of return type
52 LL |         0u8
53    |         ^^^ expected associated type, found `u8`
54    |
55    = note: expected associated type `<Self as Tr>::Ty`
56                          found type `u8`
57
58 error[E0308]: mismatched types
59   --> $DIR/defaults-specialization.rs:26:29
60    |
61 LL |     fn make() -> Self::Ty { 0u8 }
62    |                  --------   ^^^ expected associated type, found `u8`
63    |                  |
64    |                  expected `<A2<T> as Tr>::Ty` because of return type
65    |
66    = note: expected associated type `<A2<T> as Tr>::Ty`
67                          found type `u8`
68    = help: consider constraining the associated type `<A2<T> as Tr>::Ty` to `u8` or calling a method that returns `<A2<T> as Tr>::Ty`
69    = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
70
71 error[E0308]: mismatched types
72   --> $DIR/defaults-specialization.rs:44:29
73    |
74 LL |     default type Ty = bool;
75    |     ----------------------- expected this associated type
76 LL | 
77 LL |     fn make() -> Self::Ty { true }
78    |                  --------   ^^^^ expected associated type, found `bool`
79    |                  |
80    |                  expected `<B2<T> as Tr>::Ty` because of return type
81    |
82    = note: expected associated type `<B2<T> as Tr>::Ty`
83                          found type `bool`
84
85 error[E0308]: mismatched types
86   --> $DIR/defaults-specialization.rs:87:32
87    |
88 LL |     let _: <B<()> as Tr>::Ty = 0u8;
89    |            -----------------   ^^^ expected associated type, found `u8`
90    |            |
91    |            expected due to this
92    |
93    = note: expected associated type `<B<()> as Tr>::Ty`
94                          found type `u8`
95 help: a method is available that returns `<B<()> as Tr>::Ty`
96   --> $DIR/defaults-specialization.rs:9:5
97    |
98 LL |     fn make() -> Self::Ty {
99    |     ^^^^^^^^^^^^^^^^^^^^^ consider calling `Tr::make`
100
101 error[E0308]: mismatched types
102   --> $DIR/defaults-specialization.rs:88:32
103    |
104 LL |     let _: <B<()> as Tr>::Ty = true;
105    |            -----------------   ^^^^ expected associated type, found `bool`
106    |            |
107    |            expected due to this
108    |
109    = note: expected associated type `<B<()> as Tr>::Ty`
110                          found type `bool`
111 help: a method is available that returns `<B<()> as Tr>::Ty`
112   --> $DIR/defaults-specialization.rs:9:5
113    |
114 LL |     fn make() -> Self::Ty {
115    |     ^^^^^^^^^^^^^^^^^^^^^ consider calling `Tr::make`
116
117 error[E0308]: mismatched types
118   --> $DIR/defaults-specialization.rs:89:33
119    |
120 LL |     let _: <B2<()> as Tr>::Ty = 0u8;
121    |            ------------------   ^^^ expected associated type, found `u8`
122    |            |
123    |            expected due to this
124    |
125    = note: expected associated type `<B2<()> as Tr>::Ty`
126                          found type `u8`
127 help: a method is available that returns `<B2<()> as Tr>::Ty`
128   --> $DIR/defaults-specialization.rs:9:5
129    |
130 LL |     fn make() -> Self::Ty {
131    |     ^^^^^^^^^^^^^^^^^^^^^ consider calling `Tr::make`
132
133 error[E0308]: mismatched types
134   --> $DIR/defaults-specialization.rs:90:33
135    |
136 LL |     let _: <B2<()> as Tr>::Ty = true;
137    |            ------------------   ^^^^ expected associated type, found `bool`
138    |            |
139    |            expected due to this
140    |
141    = note: expected associated type `<B2<()> as Tr>::Ty`
142                          found type `bool`
143 help: a method is available that returns `<B2<()> as Tr>::Ty`
144   --> $DIR/defaults-specialization.rs:9:5
145    |
146 LL |     fn make() -> Self::Ty {
147    |     ^^^^^^^^^^^^^^^^^^^^^ consider calling `Tr::make`
148
149 error: aborting due to 9 previous errors; 1 warning emitted
150
151 Some errors have detailed explanations: E0053, E0308.
152 For more information about an error, try `rustc --explain E0053`.