You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error: trait objects without an explicit `dyn` are deprecated
2
+
--> $DIR/bare-trait-dont-suggest-dyn.rs:3:33
3
+
|
4
+
LL | fn ord_prefer_dot(s: String) -> Ord {
5
+
| ^^^
6
+
|
7
+
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
8
+
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
9
+
note: the lint level is defined here
10
+
--> $DIR/bare-trait-dont-suggest-dyn.rs:2:9
11
+
|
12
+
LL | #![deny(bare_trait_objects)]
13
+
| ^^^^^^^^^^^^^^^^^^
14
+
help: `Ord` is not object safe, use `impl Ord` to return an opaque type, as long as you return a single underlying type
15
+
|
16
+
LL | fn ord_prefer_dot(s: String) -> impl Ord {
17
+
| ++++
18
+
19
+
error[E0038]: the trait `Ord` cannot be made into an object
20
+
--> $DIR/bare-trait-dont-suggest-dyn.rs:3:33
21
+
|
22
+
LL | fn ord_prefer_dot(s: String) -> Ord {
23
+
| ^^^ `Ord` cannot be made into an object
24
+
|
25
+
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>
26
+
--> $SRC_DIR/core/src/cmp.rs:LL:COL
27
+
|
28
+
= note: the trait cannot be made into an object because it uses `Self` as a type parameter
29
+
::: $SRC_DIR/core/src/cmp.rs:LL:COL
30
+
|
31
+
= note: the trait cannot be made into an object because it uses `Self` as a type parameter
32
+
33
+
error: aborting due to 2 previous errors
34
+
35
+
For more information about this error, try `rustc --explain E0038`.
0 commit comments