]> git.proxmox.com Git - rustc.git/blame - 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
CommitLineData
e74abb32 1error[E0038]: the trait `NonObjectSafe1` cannot be made into an object
136023e0 2 --> $DIR/feature-gate-object_safe_for_dispatch.rs:18:39
e74abb32 3 |
29967ef6 4LL | fn takes_non_object_safe_ref<T>(obj: &dyn NonObjectSafe1) {
136023e0 5 | ^^^^^^^^^^^^^^^^^^ `NonObjectSafe1` cannot be made into an object
29967ef6
XL
6 |
7note: 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 |
74b04a01 10LL | trait NonObjectSafe1: Sized {}
29967ef6 11 | -------------- ^^^^^ ...because it requires `Self: Sized`
74b04a01
XL
12 | |
13 | this trait cannot be made into an object...
e74abb32
XL
14
15error[E0038]: the trait `NonObjectSafe2` cannot be made into an object
74b04a01 16 --> $DIR/feature-gate-object_safe_for_dispatch.rs:22:36
e74abb32 17 |
29967ef6
XL
18LL | fn return_non_object_safe_ref() -> &'static dyn NonObjectSafe2 {
19 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `NonObjectSafe2` cannot be made into an object
20 |
21note: 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 |
74b04a01
XL
24LL | trait NonObjectSafe2 {
25 | -------------- this trait cannot be made into an object...
e74abb32 26LL | fn static_fn() {}
29967ef6
XL
27 | ^^^^^^^^^ ...because associated function `static_fn` has no `self` parameter
28help: consider turning `static_fn` into a method by giving it a `&self` argument
74b04a01 29 |
29967ef6
XL
30LL | fn static_fn(&self) {}
31 | ^^^^^
32help: alternatively, consider constraining `static_fn` so it does not apply to trait objects
74b04a01
XL
33 |
34LL | fn static_fn() where Self: Sized {}
35 | ^^^^^^^^^^^^^^^^^
e74abb32
XL
36
37error[E0038]: the trait `NonObjectSafe3` cannot be made into an object
136023e0 38 --> $DIR/feature-gate-object_safe_for_dispatch.rs:27:39
e74abb32 39 |
e74abb32 40LL | fn takes_non_object_safe_box(obj: Box<dyn NonObjectSafe3>) {
136023e0 41 | ^^^^^^^^^^^^^^^^^^ `NonObjectSafe3` cannot be made into an object
74b04a01
XL
42 |
43 = help: consider moving `foo` to another trait
29967ef6
XL
44note: 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 |
47LL | trait NonObjectSafe3 {
48 | -------------- this trait cannot be made into an object...
49LL | fn foo<T>(&self);
50 | ^^^ ...because method `foo` has generic type parameters
e74abb32
XL
51
52error[E0038]: the trait `NonObjectSafe4` cannot be made into an object
74b04a01 53 --> $DIR/feature-gate-object_safe_for_dispatch.rs:31:35
e74abb32 54 |
e74abb32 55LL | fn return_non_object_safe_rc() -> std::rc::Rc<dyn NonObjectSafe4> {
29967ef6 56 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `NonObjectSafe4` cannot be made into an object
74b04a01
XL
57 |
58 = help: consider moving `foo` to another trait
29967ef6 59note: 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>
cdc7bbd5 60 --> $DIR/feature-gate-object_safe_for_dispatch.rs:15:22
29967ef6
XL
61 |
62LL | trait NonObjectSafe4 {
63 | -------------- this trait cannot be made into an object...
cdc7bbd5
XL
64LL | fn foo(&self, s: &Self);
65 | ^^^^^ ...because method `foo` references the `Self` type in this parameter
e74abb32
XL
66
67error[E0038]: the trait `NonObjectSafe1` cannot be made into an object
3dfed10e 68 --> $DIR/feature-gate-object_safe_for_dispatch.rs:38:16
e74abb32 69 |
29967ef6
XL
70LL | impl Trait for dyn NonObjectSafe1 {}
71 | ^^^^^^^^^^^^^^^^^^ `NonObjectSafe1` cannot be made into an object
72 |
73note: 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 |
74b04a01 76LL | trait NonObjectSafe1: Sized {}
29967ef6 77 | -------------- ^^^^^ ...because it requires `Self: Sized`
74b04a01
XL
78 | |
79 | this trait cannot be made into an object...
e74abb32
XL
80
81error: aborting due to 5 previous errors
82
83For more information about this error, try `rustc --explain E0038`.