I encountered something weird: I made a module named meta
. But the compiler prints this error:
error[E0463]: can't find crate for `meta`
--> src/macros/src/lib.rs:21:5
|
21 | use meta::RustField;
| ^^^^ can't find crate
When I rename the module to something else, it works. The error only occurs when the module is named meta
.
The error occurs in lib.rs
, which is a proc-macro crate. Here are the first lines of the file:
extern crate proc_macro;
use std::collections::HashSet;
use proc_macro::TokenStream as OldStream;
use proc_macro2::{TokenStream, Ident};
use quote::{quote, ToTokens};
use syn::{
parse_macro_input,
spanned::Spanned,
DeriveInput, Data, DataStruct, Field, Fields, Type, Attribute, FieldsNamed,
};
mod attributes;
mod errors;
mod types;
mod meta;
use attributes::{EntityAttribute, FieldAttribute, GetAttributes};
use errors::{MacroResult, err};
use types::get_type;
use meta::RustField; // error!
I also tried it with nightly rust, but that didn’t make a difference. Is it a bug, or am I doing something wrong?