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

Bridge attribute breaks inner attributes #833

Closed
dtolnay opened this issue Apr 14, 2021 · 0 comments · Fixed by #834
Closed

Bridge attribute breaks inner attributes #833

dtolnay opened this issue Apr 14, 2021 · 0 comments · Fixed by #834
Labels

Comments

@dtolnay
Copy link
Owner

dtolnay commented Apr 14, 2021

#[cxx::bridge]
mod ffi {
    #![deny(missing_docs)]

    unsafe extern "C++" {
        include!("example/include/header.h");

        /// wow
        fn f();
    }
}

pub use self::ffi::*;
error: an inner attribute is not permitted in this context
 --> src/main.rs:3:5
  |
3 |     #![deny(missing_docs)]
  |     ^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them.

Probably what's going wrong is we are accidentally transporting the inner attributes out to outside of the corresponding item in the macro output, which is not where they are supposed to go.

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

Successfully merging a pull request may close this issue.

1 participant