【发布时间】:2017-06-14 01:11:30
【问题描述】:
我试图通过直接从Diesel GitHub repo 复制examples/getting_started_step_3/ 来跟踪Diesel getting started guide,但我遇到了一些我无法修复的编译错误:
cargo build
Compiling diesel_demo_step_3 v0.1.0 (file:///home/stamm/code/rustsome/pkiexpress)
error: macro undefined: 'options!'
--> src/schema.rs:1:1
|
1 | infer_schema!("dotenv:DATABASE_URL");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in a macro outside of the current crate
error: macro undefined: 'table_name!'
--> src/models.rs:12:1
|
12 | #[table_name="posts"]
| ^^^^^^^^^^^^^^^^^^^^^
这是我的.env:
DATABASE_URL=postgres://postgres:password@localhost/pkiexpress
我正在使用 Rust 1.16.0-nightly (df8debf6d 2017-01-25) 和 Diesel 0.9.0。
【问题讨论】:
-
您正在使用夜间编译器来处理夜间版本的代码;听起来您应该针对柴油提交错误报告。
-
或者,尝试使用稳定的 Rust 版本和/或稳定的 Diesel 版本,以排除其他环境因素。
-
你复制的示例代码是最新版本吗?我只能通过使用旧版本的示例代码来得到你得到的错误。
-
我使用的是 v0.9.1 版本示例。这已经包括删除语法,破坏与当前稳定的兼容性。这显然将在 2017 年 2 月 2 日被 1.15 取代,这个新的稳定版将使我们免于使用该功能(port_macro)。
标签: rust rust-diesel