alecmocatta / serde_traitobject

Serializable trait objects for Rust.
Apache License 2.0
52 stars 10 forks source link

warning: the trait Any cannot be made into an object #23

Open alecmocatta opened 5 years ago

alecmocatta commented 5 years ago

This warning is spurious, as noted in the linked issue https://github.com/rust-lang/rust/issues/51443 the lint is overly broad and in fact needn't fire for marker traits.

This could be fixed in rustc by adjusting the lint here: https://github.com/rust-lang/rust/blob/2f16be42dd64669b784559e98662d9712ce13fab/src/librustc/traits/object_safety.rs#L343

See also the commit that introdued the lint: https://github.com/rust-lang/rust/commit/1453b3a67dfe73329e07c17cd07b55bd71d7350b

warning: the trait `serde_traitobject::convenience::Any` cannot be made into an object
  |
  = note: `#[warn(where_clauses_object_safety)]` on by default
  = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
  = note: for more information, see issue #51443 <https://github.com/rust-lang/rust/issues/51443>
  = note: method `into_any_send` references the `Self` type in where clauses

rustc PR to fix this: https://github.com/rust-lang/rust/pull/66122