#![deny(rust_2018_idioms)]
// works
// #[macro_use]
// extern crate clap; // 2.32.0
// err
use clap::app_from_crate;
fn main() {
app_from_crate!();
}
Err:
error: cannot find macro `crate_name!` in this scope
--> src/main.rs:11:3
|
11 | app_from_crate!();
| ^^^^^^^^^^^^^^^^^^
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: cannot find macro `crate_version!` in this scope
--> src/main.rs:11:3
|
11 | app_from_crate!();
| ^^^^^^^^^^^^^^^^^^ help: you could try the macro: `rustc_version`
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: cannot find macro `crate_authors!` in this scope
--> src/main.rs:11:3
|
11 | app_from_crate!();
| ^^^^^^^^^^^^^^^^^^
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
And it's kind of strange that rustc won't complain about unidiomatic extern crate ... even #![deny(rust_2018_idioms)] in the working one.
cc @petrochenkov
This is not an issue in rustc, clap just doesn't use $crate::crate_name! or #[macro_export(local_inner_macros)], so you have to continue using #[macro_use] or to import all the helper macros by yourself:
`use clap::{app_from_crate, crate_name, crate_version, crate_authors}`
or
use clap::*;
Most helpful comment
This is not an issue in rustc,
clapjust doesn't use$crate::crate_name!or#[macro_export(local_inner_macros)], so you have to continue using#[macro_use]or to import all the helper macros by yourself:or