]> git.lizzy.rs Git - rust.git/blob - src/test/ui/impl-trait/object-unsafe-trait-in-return-position-dyn-trait.stderr
Use more appropriate spans on object unsafe traits and provide structured suggestions...
[rust.git] / src / test / ui / impl-trait / object-unsafe-trait-in-return-position-dyn-trait.stderr
1 error[E0038]: the trait `NotObjectSafe` cannot be made into an object
2   --> $DIR/object-unsafe-trait-in-return-position-dyn-trait.rs:21:13
3    |
4 LL | trait NotObjectSafe {
5    |       ------------- this trait cannot be made into an object...
6 LL |     fn foo() -> Self;
7    |        --- ...because associated function `foo` has no `self` parameter
8 ...
9 LL | fn car() -> dyn NotObjectSafe {
10    |             ^^^^^^^^^^^^^^^^^ the trait `NotObjectSafe` cannot be made into an object
11    |
12 help: consider turning `foo` into a method by giving it a `&self` argument or constraining it so it does not apply to trait objects
13    |
14 LL |     fn foo() -> Self where Self: Sized;
15    |                      ^^^^^^^^^^^^^^^^^
16
17 error[E0038]: the trait `NotObjectSafe` cannot be made into an object
18   --> $DIR/object-unsafe-trait-in-return-position-dyn-trait.rs:28:13
19    |
20 LL | trait NotObjectSafe {
21    |       ------------- this trait cannot be made into an object...
22 LL |     fn foo() -> Self;
23    |        --- ...because associated function `foo` has no `self` parameter
24 ...
25 LL | fn cat() -> Box<dyn NotObjectSafe> {
26    |             ^^^^^^^^^^^^^^^^^^^^^^ the trait `NotObjectSafe` cannot be made into an object
27    |
28 help: consider turning `foo` into a method by giving it a `&self` argument or constraining it so it does not apply to trait objects
29    |
30 LL |     fn foo() -> Self where Self: Sized;
31    |                      ^^^^^^^^^^^^^^^^^
32
33 error: aborting due to 2 previous errors
34
35 For more information about this error, try `rustc --explain E0038`.