Skip to content

Enums with a variant named Type, at least one variant with data and #[derive(TryFromBytes)] generate an error on stable rust. #2915

@mageowl

Description

@mageowl

Creating an enum with a Type variant, as well as at least one variant that holds data produces the following error:

#[derive(TryFromBytes)]
#[repr(u8)]
enum MyEnum {
    Type,
    OtherWithData(u8),
}
error: ambiguous associated item
    --> golm/src/compile/types.rs:7:24
     |
   7 | #[derive(Debug, Clone, TryFromBytes)]
     |                        ^^^^^^^^^^^^
     |
     = 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 #57644 <https://github.com/rust-lang/rust/issues/57644>
note: `Type` could refer to the variant defined here
    --> golm/src/compile/types.rs:12:5
     |
  12 |     Type = 1,
     |     ^^^^
note: `Type` could also refer to the associated type defined here
    --> /home/owl/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/zerocopy-0.8.33/src/lib.rs:1139:5
     |
1139 |     type Type: ?Sized;
     |     ^^^^^^^^^^^^^^^^^
     = note: `#[deny(ambiguous_associated_items)]` (part of `#[deny(future_incompatible)]`) on by default
     = note: this error originates in the derive macro `TryFromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions