plotters icon indicating copy to clipboard operation
plotters copied to clipboard

[BUG] `doc!` macro not exported (needed for `define_color!`.

Open hpux735 opened this issue 3 years ago • 0 comments

Describe the bug I was working on some custom palettes, and I looked how they were made in the upstream code. It seems like define_color! is the way to do it. I tried using it myself, but the compiler complained that it couldn't access the doc! macro.

To Reproduce Try to make a color yourself:

use plotters::define_color;

define_color!(MOODY_BLUE, 0, 63, 92, "*Moody Blue*");

fn main() { }

the compiler will complain:

error[E0432]: unresolved import `plotters::doc`
 --> src/bin/plotters.rs:7:30
  |
7 | use plotters::{define_color, doc};
  |                              ^^^ no `doc` in the root

error: cannot determine resolution for the macro `doc`
  --> src/bin/plotters.rs:10:1
   |
10 | define_color!(MOODY_BLUE, 255, 255, 255, "*Moody Blue*");
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: import resolution is stuck, try simplifying macro imports
   = note: this error originates in the macro `define_color` (in Nightly builds, run with -Z macro-backtrace for more info)

Version Information Compiling plotters v0.3.3

The fix is as easy as adding #[macro_export] on line 6

hpux735 avatar Sep 08 '22 16:09 hpux735