Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cfg(doc) doesn't seem to be passed down to dependencies #8902

Closed
GuillaumeGomez opened this issue Nov 26, 2020 · 5 comments
Closed

cfg(doc) doesn't seem to be passed down to dependencies #8902

GuillaumeGomez opened this issue Nov 26, 2020 · 5 comments
Labels
C-bug Category: bug

Comments

@GuillaumeGomez
Copy link
Member

GuillaumeGomez commented Nov 26, 2020

I have in cairo-sys the following:

#[cfg(any(feature = "pdf", all(not(doctest), doc)))]
pub type cairo_pdf_version_t = c_int;

And in cairo:

#[cfg(any(feature = "pdf", all(not(doctest), doc)))]
#[doc(hidden)]
impl From<PdfVersion> for ffi::cairo_pdf_version_t {
    fn from(val: PdfVersion) -> ffi::cairo_pdf_version_t {
        match val {
            PdfVersion::_1_4 => ffi::PDF_VERSION__1_4,
            PdfVersion::_1_5 => ffi::PDF_VERSION__1_5,
            PdfVersion::__Unknown(value) => value,
        }
    }
}

But when running cargo doc, I get:

error[E0412]: cannot find type `cairo_pdf_version_t` in crate `ffi`
    --> cairo/src/enums.rs:1565:32
     |
1565 | impl From<PdfVersion> for ffi::cairo_pdf_version_t {
     |                                ^^^^^^^^^^^^^^^^^^^ not found in `ffi`

So I assume that the cfg(doc) isn't passed down to dependencies, contrary to what's expected.

Extra info wih cargo -v:

     Running `rustdoc --edition=2018 --crate-type lib --crate-name cairo_sys cairo/sys/src/lib.rs -o /home/imperio/rust/gtk-rs/target/doc --cfg 'feature="freetype"' --cfg 'feature="glib_ffi"' --cfg 'feature="use_glib"' --error-format=json --json=diagnostic-rendered-ansi -L dependency=/home/imperio/rust/gtk-rs/target/debug/deps --extern glib_ffi=/home/imperio/rust/gtk-rs/target/debug/deps/libglib_sys-1f466c66096ae0c3.rmeta --extern libc=/home/imperio/rust/gtk-rs/target/debug/deps/liblibc-87e5377408253f4a.rmeta --crate-version 0.13.0`
@GuillaumeGomez GuillaumeGomez added the C-bug Category: bug label Nov 26, 2020
@GuillaumeGomez
Copy link
Member Author

It was already discussed in rust-lang/rust#76252 (comment)

@jnqnfe
Copy link

jnqnfe commented Nov 30, 2020

It was already discussed in rust-lang/rust#76252 (comment)

And dup of issue #8811 ?

@GuillaumeGomez
Copy link
Member Author

The problem seems similar but not sure if it's exactly the same...

@ehuss
Copy link
Contributor

ehuss commented Nov 30, 2020

Can you clarify what appears to be different? AFAICT, it is the same, that dependencies do not set --cfg doc.

@GuillaumeGomez
Copy link
Member Author

Then it's the same. Closing this one then!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

3 participants