Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

derive_more::Error panics on associated type bounds #337

Closed
RapidPencil opened this issue Feb 27, 2024 · 4 comments
Closed

derive_more::Error panics on associated type bounds #337

RapidPencil opened this issue Feb 27, 2024 · 4 comments

Comments

@RapidPencil
Copy link

Example:

trait Foo {}
impl<T> Foo for T {}

#[derive(Debug, derive_more::Error)]
enum MyError<A, B: Foo> {
    TypeA(A),
    TypeB(B),
}

fn main() {
    let err: MyError<String, i32> = MyError::TypeA("String error".to_owned());
    println!("{:?}", err);
}

errors at compile time with

error: proc-macro derive panicked
 --> src/main.rs:4:17
  |
4 | #[derive(Debug, derive_more::Error)]
  |                 ^^^^^^^^^^^^^^^^^^
  |
  = help: message: expected `,`

For the sake of comparison, replace derive_more::Error with thiserror::Error and this then works.

  • derive_more v0.99.17
  • rustc 1.76.0
  • linux
@RapidPencil RapidPencil changed the title derive_more::Error panics on associated trait bounds derive_more::Error panics on associated type bounds Feb 27, 2024
@JelteF
Copy link
Owner

JelteF commented Feb 27, 2024

Can you try with derive_more v1.0.0-beta.6

@RapidPencil
Copy link
Author

Seems to work 👍

I'm not in the loop: What is the rough ETA for 1.0.0?

@JelteF
Copy link
Owner

JelteF commented Feb 27, 2024

There's two things that we still want to address before the final 1.0.0 release:

  1. affix is confusing with outer-level enum display formatting #142
  2. Fix incorrect fmt::Pointer implementations #328

But how long it will take us to implement, I don't know (a couple of months seems likely). In general I'd recommend using the 1.0.0-beta.6 release until we release the final 1.0.0 release. It has many fixes and a lot more tests than the 0.99 series. And there won't be many additional breaking changes in the final release.

@RapidPencil
Copy link
Author

Alright, tyvm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants