这段代码无法编译:
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只显示一个错误?我在网上找不到任何关于这种行为的信息。如何查看所有错误?
extern crate hyper; use hyper::mime::*;
添加到您的代码中,不会产生您在使用 Rust 1.23.0 时所述的第二个错误。您使用的是哪个版本的 Rust? - Shepmaster