< 返回版块

Eric 发表于 2018-04-28 09:44

我用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)

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

评论区

写评论
作者 Eric 2018-04-30 21:30

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

作者 Eric 2018-04-28 10:03

main.rs 文件里有这个

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

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

LiuTongshuo 2018-04-28 09:50

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

1 共 3 条评论, 1 页