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 //~| NOTE trait `U: std::marker::Sized` not satisfied
20 //~| HELP consider adding a `where U: std::marker::Sized` bound
21 //~| NOTE required by `std::mem::size_of`
23 mem::size_of::<Misc<U>>();
24 //~^ ERROR `U: std::marker::Sized` is not satisfied
25 //~| NOTE trait `U: std::marker::Sized` not satisfied
26 //~| HELP consider adding a `where U: std::marker::Sized` bound
27 //~| NOTE required because it appears within the type `Misc<U>`
28 //~| NOTE required by `std::mem::size_of`
30 // ... even if T occurs as a type parameter
32 <u64 as From<T>>::from;
33 //~^ ERROR `u64: std::convert::From<T>` is not satisfied
34 //~| NOTE trait `u64: std::convert::From<T>` not satisfied
35 //~| HELP consider adding a `where u64: std::convert::From<T>` bound
36 //~| NOTE required by `std::convert::From::from`
38 <u64 as From<<T as Iterator>::Item>>::from;
39 //~^ ERROR `u64: std::convert::From<<T as std::iter::Iterator>::Item>` is not satisfied
40 //~| NOTE trait `u64: std::convert::From<<T as std::iter::Iterator>::Item>` not satisfied
41 //~| HELP consider adding a `where u64:
42 //~| NOTE required by `std::convert::From::from`
44 // ... but not if there are inference variables
46 <Misc<_> as From<T>>::from;
47 //~^ ERROR `Misc<_>: std::convert::From<T>` is not satisfied
48 //~| NOTE trait `Misc<_>: std::convert::From<T>` not satisfied
49 //~| NOTE required by `std::convert::From::from`
51 // ... and also not if the error is not related to the type
53 mem::size_of::<[T]>();
54 //~^ ERROR `[T]: std::marker::Sized` is not satisfied
55 //~| NOTE `[T]: std::marker::Sized` not satisfied
56 //~| NOTE `[T]` does not have a constant size
57 //~| NOTE required by `std::mem::size_of`
59 mem::size_of::<[&U]>();
60 //~^ ERROR `[&U]: std::marker::Sized` is not satisfied
61 //~| NOTE `[&U]: std::marker::Sized` not satisfied
62 //~| NOTE `[&U]` does not have a constant size
63 //~| NOTE required by `std::mem::size_of`