2024-01-23 18:24:40 +00:00
|
|
|
error: trait objects without an explicit `dyn` are deprecated
|
2024-04-07 16:36:44 +00:00
|
|
|
--> $DIR/bare-trait-dont-suggest-dyn.rs:6:33
|
2024-01-23 18:24:40 +00:00
|
|
|
|
|
|
|
|
|
LL | fn ord_prefer_dot(s: String) -> Ord {
|
|
|
|
|
| ^^^
|
|
|
|
|
|
|
|
|
|
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
|
|
|
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
|
|
|
|
|
note: the lint level is defined here
|
2024-04-07 16:36:44 +00:00
|
|
|
--> $DIR/bare-trait-dont-suggest-dyn.rs:5:9
|
2024-01-23 18:24:40 +00:00
|
|
|
|
|
|
|
|
|
LL | #![deny(bare_trait_objects)]
|
|
|
|
|
| ^^^^^^^^^^^^^^^^^^
|
2024-09-25 10:38:40 +02:00
|
|
|
help: if this is a dyn-compatible trait, use `dyn`
|
2024-01-23 18:24:40 +00:00
|
|
|
|
|
|
|
|
|
LL | fn ord_prefer_dot(s: String) -> dyn Ord {
|
|
|
|
|
| +++
|
|
|
|
|
|
2024-11-20 14:19:36 -08:00
|
|
|
error[E0038]: the trait `Ord` is not dyn compatible
|
2024-04-07 16:36:44 +00:00
|
|
|
--> $DIR/bare-trait-dont-suggest-dyn.rs:6:33
|
2024-01-03 21:00:04 +00:00
|
|
|
|
|
|
|
|
|
LL | fn ord_prefer_dot(s: String) -> Ord {
|
2024-11-20 14:19:36 -08:00
|
|
|
| ^^^ `Ord` is not dyn compatible
|
2024-01-03 21:00:04 +00:00
|
|
|
|
|
2024-11-20 14:19:36 -08:00
|
|
|
note: for a trait to be dyn compatible it needs to allow building a vtable
|
2025-01-22 05:14:07 +01:00
|
|
|
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
2024-01-03 21:00:04 +00:00
|
|
|
--> $SRC_DIR/core/src/cmp.rs:LL:COL
|
|
|
|
|
|
|
2024-11-20 14:19:36 -08:00
|
|
|
= note: the trait is not dyn compatible because it uses `Self` as a type parameter
|
2024-01-03 21:00:04 +00:00
|
|
|
::: $SRC_DIR/core/src/cmp.rs:LL:COL
|
|
|
|
|
|
|
2024-11-20 14:19:36 -08:00
|
|
|
= note: the trait is not dyn compatible because it uses `Self` as a type parameter
|
2024-01-03 23:40:49 +00:00
|
|
|
help: consider using an opaque type instead
|
|
|
|
|
|
|
|
|
|
|
LL | fn ord_prefer_dot(s: String) -> impl Ord {
|
|
|
|
|
| ++++
|
2024-01-03 21:00:04 +00:00
|
|
|
|
2024-01-23 18:24:40 +00:00
|
|
|
error: aborting due to 2 previous errors
|
2024-01-03 21:00:04 +00:00
|
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0038`.
|