fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
3.0 KiB78 linesraw
1error[E0277]: the trait bound `dyn Setup<From = T>: Setup` is not satisfied
2  --> $DIR/object-unsafety.rs:12:12
3   |
4LL |     copy::<dyn Setup<From=T>>(t)
5   |            ^^^^^^^^^^^^^^^^^ the trait `Setup` is not implemented for `dyn Setup<From = T>`
6   |
7note: required by a bound in `copy`
8  --> $DIR/object-unsafety.rs:7:12
9   |
10LL | fn copy<U: Setup + ?Sized>(from: &U::From) -> U::From {
11   |            ^^^^^ required by this bound in `copy`
12help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
13   |
14LL | pub fn copy_any<T>(t: &T) -> T where dyn Setup<From = T>: Setup {
15   |                                ++++++++++++++++++++++++++++++++
16
17error: the type `&<dyn Setup<From = T> as Setup>::From` is not well-formed
18  --> $DIR/object-unsafety.rs:12:31
19   |
20LL |     copy::<dyn Setup<From=T>>(t)
21   |                               ^
22
23error[E0308]: mismatched types
24  --> $DIR/object-unsafety.rs:12:31
25   |
26LL |     copy::<dyn Setup<From=T>>(t)
27   |     ------------------------- ^ types differ
28   |     |
29   |     arguments to this function are incorrect
30   |
31   = note: expected reference `&<dyn Setup<From = T> as Setup>::From`
32              found reference `&T`
33note: function defined here
34  --> $DIR/object-unsafety.rs:7:4
35   |
36LL | fn copy<U: Setup + ?Sized>(from: &U::From) -> U::From {
37   |    ^^^^                    --------------
38
39error[E0308]: mismatched types
40  --> $DIR/object-unsafety.rs:12:5
41   |
42LL | pub fn copy_any<T>(t: &T) -> T {
43   |                 -            - expected `T` because of return type
44   |                 |
45   |                 this type parameter
46LL |     copy::<dyn Setup<From=T>>(t)
47   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ
48   |
49   = note: expected type parameter `T`
50             found associated type `<dyn Setup<From = T> as Setup>::From`
51   = note: you might be missing a type parameter or trait bound
52
53error: the type `<dyn Setup<From = T> as Setup>::From` is not well-formed
54  --> $DIR/object-unsafety.rs:12:5
55   |
56LL |     copy::<dyn Setup<From=T>>(t)
57   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
58
59error[E0277]: the size for values of type `<dyn Setup<From = T> as Setup>::From` cannot be known at compilation time
60  --> $DIR/object-unsafety.rs:12:5
61   |
62LL |     copy::<dyn Setup<From=T>>(t)
63   |     ^^^^^^^^^^^^^^^^^^^^^^^^^---
64   |     |
65   |     doesn't have a size known at compile-time
66   |     this returned value is of type `<dyn Setup<From = T> as Setup>::From`
67   |
68   = help: the trait `Sized` is not implemented for `<dyn Setup<From = T> as Setup>::From`
69   = note: the return type of a function must have a statically known size
70help: consider further restricting the associated type
71   |
72LL | pub fn copy_any<T>(t: &T) -> T where <dyn Setup<From = T> as Setup>::From: Sized {
73   |                                +++++++++++++++++++++++++++++++++++++++++++++++++
74
75error: aborting due to 6 previous errors
76
77Some errors have detailed explanations: E0277, E0308.
78For more information about an error, try `rustc --explain E0277`.