• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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]
10 pub 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 
undocumented_rust_fn() -> u837         pub fn undocumented_rust_fn() -> u8;
38 
39         /// ...
documented_rust_fn() -> u840         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 
undocumented_foreign_fn() -> u854         pub fn undocumented_foreign_fn() -> u8;
55 
56         /// ...
documented_foreign_fn() -> u857         pub fn documented_foreign_fn() -> u8;
58     }
59 
60     #[allow(missing_docs)]
61     pub struct SuppressUndocumentedStruct {
62         pub undocumented_field: u8,
63     }
64 }
65 
66 struct UndocumentedRustType;
67 struct DocumentedRustType;
68 
69 mod 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 
undocumented_rust_fn() -> u886 fn undocumented_rust_fn() -> u8 {
87     0
88 }
89 
documented_rust_fn() -> u890 fn documented_rust_fn() -> u8 {
91     0
92 }
93 
main()94 fn main() {}
95