]> git.proxmox.com Git - rustc.git/blob - src/test/ui/feature-gates/feature-gate-object_safe_for_dispatch.stderr
New upstream version 1.55.0+dfsg1
[rustc.git] / src / test / ui / feature-gates / feature-gate-object_safe_for_dispatch.stderr
1 error[E0038]: the trait `NonObjectSafe1` cannot be made into an object
2 --> $DIR/feature-gate-object_safe_for_dispatch.rs:18:39
3 |
4 LL | fn takes_non_object_safe_ref<T>(obj: &dyn NonObjectSafe1) {
5 | ^^^^^^^^^^^^^^^^^^ `NonObjectSafe1` cannot be made into an object
6 |
7 note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
8 --> $DIR/feature-gate-object_safe_for_dispatch.rs:4:23
9 |
10 LL | trait NonObjectSafe1: Sized {}
11 | -------------- ^^^^^ ...because it requires `Self: Sized`
12 | |
13 | this trait cannot be made into an object...
14
15 error[E0038]: the trait `NonObjectSafe2` cannot be made into an object
16 --> $DIR/feature-gate-object_safe_for_dispatch.rs:22:36
17 |
18 LL | fn return_non_object_safe_ref() -> &'static dyn NonObjectSafe2 {
19 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `NonObjectSafe2` cannot be made into an object
20 |
21 note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
22 --> $DIR/feature-gate-object_safe_for_dispatch.rs:7:8
23 |
24 LL | trait NonObjectSafe2 {
25 | -------------- this trait cannot be made into an object...
26 LL | fn static_fn() {}
27 | ^^^^^^^^^ ...because associated function `static_fn` has no `self` parameter
28 help: consider turning `static_fn` into a method by giving it a `&self` argument
29 |
30 LL | fn static_fn(&self) {}
31 | ^^^^^
32 help: alternatively, consider constraining `static_fn` so it does not apply to trait objects
33 |
34 LL | fn static_fn() where Self: Sized {}
35 | ^^^^^^^^^^^^^^^^^
36
37 error[E0038]: the trait `NonObjectSafe3` cannot be made into an object
38 --> $DIR/feature-gate-object_safe_for_dispatch.rs:27:39
39 |
40 LL | fn takes_non_object_safe_box(obj: Box<dyn NonObjectSafe3>) {
41 | ^^^^^^^^^^^^^^^^^^ `NonObjectSafe3` cannot be made into an object
42 |
43 = help: consider moving `foo` to another trait
44 note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
45 --> $DIR/feature-gate-object_safe_for_dispatch.rs:11:8
46 |
47 LL | trait NonObjectSafe3 {
48 | -------------- this trait cannot be made into an object...
49 LL | fn foo<T>(&self);
50 | ^^^ ...because method `foo` has generic type parameters
51
52 error[E0038]: the trait `NonObjectSafe4` cannot be made into an object
53 --> $DIR/feature-gate-object_safe_for_dispatch.rs:31:35
54 |
55 LL | fn return_non_object_safe_rc() -> std::rc::Rc<dyn NonObjectSafe4> {
56 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `NonObjectSafe4` cannot be made into an object
57 |
58 = help: consider moving `foo` to another trait
59 note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
60 --> $DIR/feature-gate-object_safe_for_dispatch.rs:15:22
61 |
62 LL | trait NonObjectSafe4 {
63 | -------------- this trait cannot be made into an object...
64 LL | fn foo(&self, s: &Self);
65 | ^^^^^ ...because method `foo` references the `Self` type in this parameter
66
67 error[E0038]: the trait `NonObjectSafe1` cannot be made into an object
68 --> $DIR/feature-gate-object_safe_for_dispatch.rs:38:16
69 |
70 LL | impl Trait for dyn NonObjectSafe1 {}
71 | ^^^^^^^^^^^^^^^^^^ `NonObjectSafe1` cannot be made into an object
72 |
73 note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
74 --> $DIR/feature-gate-object_safe_for_dispatch.rs:4:23
75 |
76 LL | trait NonObjectSafe1: Sized {}
77 | -------------- ^^^^^ ...because it requires `Self: Sized`
78 | |
79 | this trait cannot be made into an object...
80
81 error: aborting due to 5 previous errors
82
83 For more information about this error, try `rustc --explain E0038`.