1// TODO: More work is needed so that the missing_docs lints produced by rustc 2// are properly positioned inside of the bridge. 3 4//! ... 5 6#![deny(missing_docs)] 7 8/// ... 9#[cxx::bridge] 10pub mod ffi { 11 pub struct UndocumentedStruct { 12 pub undocumented_field: u8, 13 } 14 15 /// ... 16 pub struct DocumentedStruct { 17 /// ... 18 pub documented_field: u8, 19 } 20 21 pub enum UndocumentedEnum { 22 UndocumentedVariant = 0, 23 } 24 25 /// ... 26 pub enum DocumentedEnum { 27 /// ... 28 DocumentedVariant = 0, 29 } 30 31 extern "Rust" { 32 pub type UndocumentedRustType; 33 34 /// ... 35 pub type DocumentedRustType; 36 37 pub fn undocumented_rust_fn() -> u8; 38 39 /// ... 40 pub fn documented_rust_fn() -> u8; 41 } 42 43 unsafe extern "C++" { 44 pub type UndocumentedForeignType; 45 46 /// ... 47 pub type DocumentedForeignType; 48 49 pub type UndocumentedTypeAlias = crate::bindgen::UndocumentedTypeAlias; 50 51 /// ... 52 pub type DocumentedTypeAlias = crate::bindgen::DocumentedTypeAlias; 53 54 pub fn undocumented_foreign_fn() -> u8; 55 56 /// ... 57 pub fn documented_foreign_fn() -> u8; 58 } 59 60 #[allow(missing_docs)] 61 pub struct SuppressUndocumentedStruct { 62 pub undocumented_field: u8, 63 } 64} 65 66struct UndocumentedRustType; 67struct DocumentedRustType; 68 69mod bindgen { 70 use cxx::{type_id, ExternType}; 71 72 pub struct UndocumentedTypeAlias; 73 pub struct DocumentedTypeAlias; 74 75 unsafe impl ExternType for UndocumentedTypeAlias { 76 type Id = type_id!("UndocumentedTypeAlias"); 77 type Kind = cxx::kind::Opaque; 78 } 79 80 unsafe impl ExternType for DocumentedTypeAlias { 81 type Id = type_id!("DocumentedTypeAlias"); 82 type Kind = cxx::kind::Opaque; 83 } 84} 85 86fn undocumented_rust_fn() -> u8 { 87 0 88} 89 90fn documented_rust_fn() -> u8 { 91 0 92} 93 94fn main() {} 95