Skip to content

Conversation

@dtolnay
Copy link
Owner

@dtolnay dtolnay commented Jan 23, 2025

Before:

error[E0038]: the trait `MyTrait` is not dyn compatible
 --> src/main.rs:8:12
  |
8 |     let _: &dyn MyTrait;
  |            ^^^^^^^^^^^^ `MyTrait` is not dyn compatible
  |
note: for a trait to be dyn compatible it needs to allow building a vtable
      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
   --> $RUST/core/src/hash/mod.rs
    |
    |     fn hash<H: Hasher>(&self, state: &mut H);
    |        ^^^^ ...because method `hash` has generic type parameters
    |
   ::: src/main.rs:3:7
    |
3   | trait MyTrait: Hash {
    |       ------- this trait is not dyn compatible...
    = help: consider moving `hash` to another trait

After:

error[E0038]: the trait `MyTrait` is not dyn compatible
 --> src/main.rs:8:12
  |
8 |     let _: &dyn MyTrait;
  |            ^^^^^^^^^^^^ `MyTrait` is not dyn compatible
  |
note: for a trait to be dyn compatible it needs to allow building a vtable
      for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
 --> $RUST/core/src/hash/mod.rs
  |
  |     fn hash<H: Hasher>(&self, state: &mut H);
  |        ^^^^ ...because method `hash` has generic type parameters
  |
 ::: src/main.rs:3:7
  |
3 | trait MyTrait: Hash {
  |       ------- this trait is not dyn compatible...
  = help: consider moving `hash` to another trait

@dtolnay dtolnay merged commit 7a19ab7 into master Jan 23, 2025
20 checks passed
@dtolnay dtolnay deleted the multilinenote branch January 23, 2025 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants