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