The crate native_db
conflicts with another crate, specta
.
Here is the code/error:
use native_db::{native_db, InnerKeyValue};
use native_model::{native_model, Model};
use serde::{Deserialize, Serialize};
use specta::{Type};
#[derive(Type, Serialize, Deserialize, Debug)]
#[native_model(id = 1, version = 1)]
#[native_db]
pub struct Person {
#[primary_key]
pub name: String,
pub age: i32,
}
error[E0659]: `doc` is ambiguous
--> src/main.rs:25:9
|
25 | #[native_db]
| ^^^^^^^^^^^^ ambiguous name
|
= note: ambiguous because of a name conflict with a builtin attribute
= note: `doc` could refer to a built-in attribute
note: `doc` could also refer to the derive helper attribute defined here
--> src/main.rs:23:18
|
23 | #[derive(Type, Serialize, Deserialize, Debug)]
| ^^^^
= note: this error originates in the attribute macro `native_db` (in Nightly builds, run with -Z macro-backtrace for more info)
If I understand correctly, the keyword doc
conflicts with another keyword doc
that would be brought by native_db
, but there are no references in the code of native_db
to the addition of the keyword doc
generated by the macro.
Can proc_macro_derive
macros conflict even if they do not have any keywords in common?
Here is the definition of the two proc_macro_derive
.
#[proc_macro_derive(KeyAttributes, attributes(primary_key, secondary_key))]
pub fn key_attributes(_input: TokenStream) -> TokenStream {
...
#[proc_macro_derive(Type, attributes(specta, serde, doc))]
pub fn derive_type(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
...
The problem does not appear with the release candidate version 2.0.0-rc.10
of Specta because the doc
field is not present in the attributes of the macro. However, I would like to understand why I am getting this error (my curiosity :p)
Note/Context: I'm the owner of native_db
, and the question coming from this topic.