]> git.lizzy.rs Git - rust.git/blob - src/test/ui/traits/suggest-where-clause.stderr
Add regression test for #82830
[rust.git] / src / test / ui / traits / suggest-where-clause.stderr
1 error[E0277]: the size for values of type `U` cannot be known at compilation time
2   --> $DIR/suggest-where-clause.rs:7:20
3    |
4 LL | fn check<T: Iterator, U: ?Sized>() {
5    |                       - this type parameter needs to be `std::marker::Sized`
6 LL |     // suggest a where-clause, if needed
7 LL |     mem::size_of::<U>();
8    |                    ^ doesn't have a size known at compile-time
9    |
10 note: required by a bound in `std::mem::size_of`
11   --> $SRC_DIR/core/src/mem/mod.rs:LL:COL
12    |
13 LL | pub const fn size_of<T>() -> usize {
14    |                      ^ required by this bound in `std::mem::size_of`
15 help: consider removing the `?Sized` bound to make the type parameter `Sized`
16    |
17 LL - fn check<T: Iterator, U: ?Sized>() {
18 LL + fn check<T: Iterator, U>() {
19    | 
20
21 error[E0277]: the size for values of type `U` cannot be known at compilation time
22   --> $DIR/suggest-where-clause.rs:10:5
23    |
24 LL | fn check<T: Iterator, U: ?Sized>() {
25    |                       - this type parameter needs to be `std::marker::Sized`
26 ...
27 LL |     mem::size_of::<Misc<U>>();
28    |     ^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
29    |
30 note: required because it appears within the type `Misc<U>`
31   --> $DIR/suggest-where-clause.rs:3:8
32    |
33 LL | struct Misc<T:?Sized>(T);
34    |        ^^^^
35 note: required by a bound in `std::mem::size_of`
36   --> $SRC_DIR/core/src/mem/mod.rs:LL:COL
37    |
38 LL | pub const fn size_of<T>() -> usize {
39    |                      ^ required by this bound in `std::mem::size_of`
40 help: consider removing the `?Sized` bound to make the type parameter `Sized`
41    |
42 LL - fn check<T: Iterator, U: ?Sized>() {
43 LL + fn check<T: Iterator, U>() {
44    | 
45
46 error[E0277]: the trait bound `u64: From<T>` is not satisfied
47   --> $DIR/suggest-where-clause.rs:15:5
48    |
49 LL |     <u64 as From<T>>::from;
50    |     ^^^^^^^^^^^^^^^^^^^^^^ the trait `From<T>` is not implemented for `u64`
51    |
52 help: consider introducing a `where` bound, but there might be an alternative better way to express this requirement
53    |
54 LL | fn check<T: Iterator, U: ?Sized>() where u64: From<T> {
55    |                                    ++++++++++++++++++
56
57 error[E0277]: the trait bound `u64: From<<T as Iterator>::Item>` is not satisfied
58   --> $DIR/suggest-where-clause.rs:18:5
59    |
60 LL |     <u64 as From<<T as Iterator>::Item>>::from;
61    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `From<<T as Iterator>::Item>` is not implemented for `u64`
62    |
63 help: consider introducing a `where` bound, but there might be an alternative better way to express this requirement
64    |
65 LL | fn check<T: Iterator, U: ?Sized>() where u64: From<<T as Iterator>::Item> {
66    |                                    ++++++++++++++++++++++++++++++++++++++
67
68 error[E0277]: the trait bound `Misc<_>: From<T>` is not satisfied
69   --> $DIR/suggest-where-clause.rs:23:5
70    |
71 LL |     <Misc<_> as From<T>>::from;
72    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `From<T>` is not implemented for `Misc<_>`
73
74 error[E0277]: the size for values of type `[T]` cannot be known at compilation time
75   --> $DIR/suggest-where-clause.rs:28:20
76    |
77 LL |     mem::size_of::<[T]>();
78    |                    ^^^ doesn't have a size known at compile-time
79    |
80    = help: the trait `Sized` is not implemented for `[T]`
81 note: required by a bound in `std::mem::size_of`
82   --> $SRC_DIR/core/src/mem/mod.rs:LL:COL
83    |
84 LL | pub const fn size_of<T>() -> usize {
85    |                      ^ required by this bound in `std::mem::size_of`
86
87 error[E0277]: the size for values of type `[&U]` cannot be known at compilation time
88   --> $DIR/suggest-where-clause.rs:31:5
89    |
90 LL |     mem::size_of::<[&U]>();
91    |     ^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
92    |
93    = help: the trait `Sized` is not implemented for `[&U]`
94 note: required by a bound in `std::mem::size_of`
95   --> $SRC_DIR/core/src/mem/mod.rs:LL:COL
96    |
97 LL | pub const fn size_of<T>() -> usize {
98    |                      ^ required by this bound in `std::mem::size_of`
99
100 error: aborting due to 7 previous errors
101
102 For more information about this error, try `rustc --explain E0277`.