]> git.lizzy.rs Git - rust.git/blob - src/test/ui/traits/suggest-where-clause.rs
:arrow_up: rust-analyzer
[rust.git] / src / test / ui / traits / suggest-where-clause.rs
1 use std::mem;
2
3 struct Misc<T:?Sized>(T);
4
5 fn check<T: Iterator, U: ?Sized>() {
6     // suggest a where-clause, if needed
7     mem::size_of::<U>();
8     //~^ ERROR the size for values of type
9
10     mem::size_of::<Misc<U>>();
11     //~^ ERROR the size for values of type
12
13     // ... even if T occurs as a type parameter
14
15     <u64 as From<T>>::from;
16     //~^ ERROR `u64: From<T>` is not satisfied
17
18     <u64 as From<<T as Iterator>::Item>>::from;
19     //~^ ERROR `u64: From<<T as Iterator>::Item>` is not satisfied
20
21     // ... but not if there are inference variables
22
23     <Misc<_> as From<T>>::from;
24     //~^ ERROR `Misc<_>: From<T>` is not satisfied
25
26     // ... and also not if the error is not related to the type
27
28     mem::size_of::<[T]>();
29     //~^ ERROR the size for values of type
30
31     mem::size_of::<[&U]>();
32     //~^ ERROR the size for values of type
33 }
34
35 fn main() {
36 }