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

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

Closed
Emmanuel32 opened this issue Jan 21, 2025 · 1 comment · Fixed by #4
Closed

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

Emmanuel32 opened this issue Jan 21, 2025 · 1 comment · Fixed by #4
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@Emmanuel32
Copy link

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 🐞
@Emmanuel32 Emmanuel32 added the bug Something isn't working label Jan 21, 2025
@cdavernas
Copy link
Member

cdavernas commented Jan 21, 2025

Hi @Emmanuel32 and thanks for reporting!

Sorry about that issue, I'm pretty new to Rust. Hell, I didn't even know about the ability to enable features build wise 😛

I'll fix that tomorrow morning!

PS: Don't hesitate to show support to the project by dropping a star! Is always appreciated and, well, you'd be the first ^^

@cdavernas cdavernas added the good first issue Good for newcomers label Jan 21, 2025
@cdavernas cdavernas self-assigned this Jan 21, 2025
@cdavernas cdavernas moved this from Backlog to In Progress in Progress Tracker Jan 21, 2025
cdavernas added a commit to neuroglia-io/sdk-rust that referenced this issue Jan 22, 2025
@cdavernas cdavernas linked a pull request Jan 22, 2025 that will close this issue
@github-project-automation github-project-automation bot moved this from In Progress to Done in Progress Tracker Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants