此代码无法编译:
extern crate iron;
#[marco_use] //misspelled here
extern crate mime;
use iron::prelude::*;
use iron::status;
fn main() {
let mut response = Response::new();
response.set_mut(mime!(Text/Html; Charset=Utf8));
}
Run Code Online (Sandbox Code Playgroud)
表明:
error: cannot find macro `mime!` in this scope
--> src/main.rs:10:22
|
10 | response.set_mut(mime!(Text/Html; Charset=Utf8));
| ^^^^
Run Code Online (Sandbox Code Playgroud)
如果我添加extern crate hyper; use hyper::mime::*;,则显示:
error: The attribute `marco_use` is currently unknown to the compiler and
may have meaning added to it in the future (see issue #29642)
--> src\main.rs:2:1
|
2 | #[marco_use] extern crate mime;
| ^^^^^^^^^^^^
Run Code Online (Sandbox Code Playgroud)
如果我早些时候能看到这个,它会帮助我解决这个错误......
我猜Cargo只显示一个错误?我在网上找不到任何有关此行为的信息.我怎么能看到所有错误?
编译过程分为几个阶段,如果在其中一个阶段出现错误而导致构建,则不会进一步处理以下阶段.这不是特定于货物,但rustc也是(例如:何时将数字文字分配给默认类型?).
我还没有看到它正式记录,但日本人已经描述了高级过程: