Skip to content

Instantly share code, notes, and snippets.

@AfoHT
Created April 7, 2020 19:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AfoHT/87e3ca58c6670c2298aaec392a9cd97b to your computer and use it in GitHub Desktop.
Save AfoHT/87e3ca58c6670c2298aaec392a9cd97b to your computer and use it in GitHub Desktop.
cfgstruct with panic
❯ cargo build
Compiling cfgstruct-macros v0.1.0 (/home/henrik/rust/cfg-proc_macro_test/cfgstruct/macros)
warning: unreachable expression
--> macros/src/lib.rs:12:5
|
11 | panic!("{}", item);
| ------------------- any code following this expression is unreachable
12 | item
| ^^^^ unreachable expression
|
= note: `#[warn(unreachable_code)]` on by default
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
Compiling cfgstruct v0.1.0 (/home/henrik/rust/cfg-proc_macro_test/cfgstruct)
Input to proc_macro_attribute:
#####################################################
fn main() {
let res = LateResources{x: 0, dummy: (),};
println!("{:#?}", res);
#[cfg(feature = "feature_x")]
println!("Hello, world!");
}
#####################################################
End of proc macro input.
error: custom attribute panicked
--> src/main.rs:10:1
|
10 | #[init]
| ^^^^^^^
|
= help: message: fn main() {
let res = LateResources{x: 0, dummy: (),};
println!("{:#?}", res);
#[cfg(feature = "feature_x")]
println!("Hello, world!");
}
error: aborting due to previous error
error: could not compile `cfgstruct`.
To learn more, run the command again with --verbose.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment