1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
13 struct Misc<T:?Sized>(T);
15 fn check<T: Iterator, U: ?Sized>() {
16 // suggest a where-clause, if needed
18 //~^ ERROR `U: std::marker::Sized` is not satisfied
19 //~| HELP consider adding a `where U: std::marker::Sized` bound
20 //~| NOTE required by `std::mem::size_of`
22 mem::size_of::<Misc<U>>();
23 //~^ ERROR `U: std::marker::Sized` is not satisfied
24 //~| HELP consider adding a `where U: std::marker::Sized` bound
25 //~| NOTE required because it appears within the type `Misc<U>`
26 //~| NOTE required by `std::mem::size_of`
28 // ... even if T occurs as a type parameter
30 <u64 as From<T>>::from;
31 //~^ ERROR `u64: std::convert::From<T>` is not satisfied
32 //~| HELP consider adding a `where u64: std::convert::From<T>` bound
33 //~| NOTE required by `std::convert::From::from`
35 <u64 as From<<T as Iterator>::Item>>::from;
36 //~^ ERROR `u64: std::convert::From<<T as std::iter::Iterator>::Item>` is not satisfied
37 //~| HELP consider adding a `where u64:
38 //~| NOTE required by `std::convert::From::from`
40 // ... but not if there are inference variables
42 <Misc<_> as From<T>>::from;
43 //~^ ERROR `Misc<_>: std::convert::From<T>` is not satisfied
44 //~| NOTE required by `std::convert::From::from`
46 // ... and also not if the error is not related to the type
48 mem::size_of::<[T]>();
49 //~^ ERROR `[T]: std::marker::Sized` is not satisfied
50 //~| NOTE `[T]` does not have a constant size
51 //~| NOTE required by `std::mem::size_of`
53 mem::size_of::<[&U]>();
54 //~^ ERROR `[&U]: std::marker::Sized` is not satisfied
55 //~| NOTE `[&U]` does not have a constant size
56 //~| NOTE required by `std::mem::size_of`