Here is a library (that does nothing) that works:
Cargo.toml:
[package]
name = "test15"
version = "0.1.0"
authors = ["me"]
[profile.release]
codegen-units = 1
[dependencies]
error-chain = "*"
src\lib.rs:
#![recursion_limit = "1024"]
#[macro_use] extern crate error_chain;
pub mod errors { // Other modules: use errors::*;
error_chain!{}
}
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}
This builds fine.
But when I try it using 2018 (I'm using 1.31.1 througout on Linux 64) I get an error (shown at the end)
Cargo.toml
[package]
name = "test18"
version = "0.1.0"
authors = ["me"]
edition = "2018"
[profile.release]
codegen-units = 1
[dependencies]
error-chain = "*"
src\lib.rs
#![recursion_limit = "1024"]
use error_chain::error_chain;
use error_chain::error_chain_processing;
use error_chain::impl_error_chain_processed;
use error_chain::impl_error_chain_kind;
use error_chain::impl_extract_backtrace;
pub mod errors { // Other modules: use errors::*;
error_chain!{}
}
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}
Error:
error: cannot find macro `error_chain!` in this scope
--> src/lib.rs:12:5
|
12 | error_chain!{}
| ^^^^^^^^^^^
error: aborting due to previous error
error: Could not compile `test18`.
What am I doing wrong?