< 返回版块

diesel orm 问题

Eric 发表于

我用diesel orm 编译出错: error: cannot find macro impl_Insertable! in this scope --> :1:1 | 1 | impl_Insertable ! { ( struct_name = NewBook , table_name = books , struct_ty = NewBook , lifetimes = ( ) , ) , fields = [ { field_name: title ,column_name: title , field_ty: String , field_kind: regular , inner_field_ty: String , } { field_name: author , column_name: author , field_ty: String , field_kind: regular , inner_field_ty: String , } { field_name: published , column_name: published , field_ty: i8 , field_kind: regular , inner_field_ty: i8 , } ] , }

diesel = { version = "1.2.2", features = ["mysql"] } diesel_codegen = { version = "0.16.0",features = ["mysql"] } dotenv = "0.11.0"

rustc 1.27.0-nightly (ac3c2288f 2018-04-18)

谁遇到过这个问题,麻烦指点下,谢了

评论区

LiuTongshuo 2018-04-28T01:50:28.643887

使用#[macro_use] 可以使被注解crate中的宏应用到当前crate作用域中。

作者 Eric 2018-04-28T02:03:41.652393

main.rs 文件里有这个

#[macro_use] extern crate diesel; #[macro_use] extern crate diesel_codegen; extern crate dotenv; 还是编译不了

@LiuTongshuo 使用#[macro_use] 可以使被注解crate中的宏应用到当前crate作用域中。

作者 Eric 2018-04-30T13:30:34.665024

diesel_codegen 已经不维护了,移除这个依赖就可以了

1 共 3 评论, 共 1 页