Skip to content

This crate fails to build if the serde derive feature is enabled. #3

@Emmanuel32

Description

@Emmanuel32

I tried this:

I was trying to use this crate while also importing serde with the derive feature enabled.

This happened:

The simplest reproduction is running cargo build --workspace --all-targets --features "serde/derive" which returns these errors

error[E0252]: the name `Deserialize` is defined multiple times
 --> core/src/models/map.rs:2:20
  |
1 | use serde::{Serialize, Deserialize};
  |                        ----------- previous import of the macro `Deserialize` here
2 | use serde_derive::{Deserialize, Serialize};
  |                    ^^^^^^^^^^^--
  |                    |
  |                    `Deserialize` reimported here
  |                    help: remove unnecessary import
  |
  = note: `Deserialize` must be defined only once in the macro namespace of this module

error[E0252]: the name `Serialize` is defined multiple times
 --> core/src/models/map.rs:2:33
  |
1 | use serde::{Serialize, Deserialize};
  |             --------- previous import of the macro `Serialize` here
2 | use serde_derive::{Deserialize, Serialize};
  |                                 ^^^^^^^^^ `Serialize` reimported here
  |
  = note: `Serialize` must be defined only once in the macro namespace of this module

I expected this:

No response

Is there a workaround?

One way to fix this is to fully qualify all the instances of Serialize and Deserialize in core/src/models/map.rs as serde::Serialize or serde_derive::Serialize.

Anything else?

cargo build --workspace --all-targets --features "serde/derive" could be added to the github actions to check for this bug.

Platform(s)

No response

Community Notes

  • Please vote by adding a 👍 reaction to the issue to help us prioritize.
  • If you are interested to work on this issue, please leave a comment.name: Bug Report 🐞

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomers

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    pFad - Phonifier reborn

    Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

    Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy