小编yas*_*sin的帖子

为什么`cargo build`没有在我的代码中显示所有错误?

此代码无法编译:

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 …
Run Code Online (Sandbox Code Playgroud)

rust

3
推荐指数
1
解决办法
259
查看次数

标签 统计

rust ×1