此代码无法编译:
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));
}
它显示:
error: cannot find macro `mime!` in this scope
--> src/main.rs:10:22
|
10 | response.set_mut(mime!(Text/Html; Charset=Utf8));
| ^^^^
如果我添加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;
| ^^^^^^^^^^^^
如果我早些时候能看到这个,它会帮助我解决这个错误......
我猜Cargo只显示一个错误?我在网上找不到任何有关此行为的信息。我怎样才能看到所有错误?
答案 0 :(得分:7)
编译过程分为几个阶段,如果在其中一个过程中出现错误,则不会进一步处理以下阶段。这不是特定于货物,而是rustc
(例如:When are numeric literals assigned to default types?)。
我还没有看到它正式记录,但是高级流程has been described by japaric: