mirror of
https://gitee.com/openharmony/third_party_rust_cxx
synced 2024-11-23 23:29:50 +00:00
Add ui test of missing_docs lints inside bridge
This commit is contained in:
parent
f90cc999de
commit
593e04518d
89
tests/ui/deny_missing_docs.rs
Normal file
89
tests/ui/deny_missing_docs.rs
Normal file
@ -0,0 +1,89 @@
|
||||
// TODO: More work is needed so that the missing_docs lints produced by rustc
|
||||
// are properly positioned inside of the bridge.
|
||||
|
||||
//! ...
|
||||
|
||||
#![deny(missing_docs)]
|
||||
|
||||
/// ...
|
||||
#[cxx::bridge]
|
||||
pub mod ffi {
|
||||
pub struct UndocumentedStruct {
|
||||
pub undocumented_field: u8,
|
||||
}
|
||||
|
||||
/// ...
|
||||
pub struct DocumentedStruct {
|
||||
/// ...
|
||||
pub documented_field: u8,
|
||||
}
|
||||
|
||||
pub enum UndocumentedEnum {
|
||||
UndocumentedVariant = 0,
|
||||
}
|
||||
|
||||
/// ...
|
||||
pub enum DocumentedEnum {
|
||||
/// ...
|
||||
DocumentedVariant = 0,
|
||||
}
|
||||
|
||||
extern "Rust" {
|
||||
pub type UndocumentedRustType;
|
||||
|
||||
/// ...
|
||||
pub type DocumentedRustType;
|
||||
|
||||
pub fn undocumented_rust_fn() -> u8;
|
||||
|
||||
/// ...
|
||||
pub fn documented_rust_fn() -> u8;
|
||||
}
|
||||
|
||||
unsafe extern "C++" {
|
||||
pub type UndocumentedForeignType;
|
||||
|
||||
/// ...
|
||||
pub type DocumentedForeignType;
|
||||
|
||||
pub type UndocumentedTypeAlias = crate::bindgen::UndocumentedTypeAlias;
|
||||
|
||||
/// ...
|
||||
pub type DocumentedTypeAlias = crate::bindgen::DocumentedTypeAlias;
|
||||
|
||||
pub fn undocumented_foreign_fn() -> u8;
|
||||
|
||||
/// ...
|
||||
pub fn documented_foreign_fn() -> u8;
|
||||
}
|
||||
}
|
||||
|
||||
struct UndocumentedRustType;
|
||||
struct DocumentedRustType;
|
||||
|
||||
mod bindgen {
|
||||
use cxx::{type_id, ExternType};
|
||||
|
||||
pub struct UndocumentedTypeAlias;
|
||||
pub struct DocumentedTypeAlias;
|
||||
|
||||
unsafe impl ExternType for UndocumentedTypeAlias {
|
||||
type Id = type_id!("UndocumentedTypeAlias");
|
||||
type Kind = cxx::kind::Opaque;
|
||||
}
|
||||
|
||||
unsafe impl ExternType for DocumentedTypeAlias {
|
||||
type Id = type_id!("DocumentedTypeAlias");
|
||||
type Kind = cxx::kind::Opaque;
|
||||
}
|
||||
}
|
||||
|
||||
fn undocumented_rust_fn() -> u8 {
|
||||
0
|
||||
}
|
||||
|
||||
fn documented_rust_fn() -> u8 {
|
||||
0
|
||||
}
|
||||
|
||||
fn main() {}
|
64
tests/ui/deny_missing_docs.stderr
Normal file
64
tests/ui/deny_missing_docs.stderr
Normal file
@ -0,0 +1,64 @@
|
||||
error: missing documentation for a struct
|
||||
--> $DIR/deny_missing_docs.rs:9:1
|
||||
|
|
||||
9 | #[cxx::bridge]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/deny_missing_docs.rs:6:9
|
||||
|
|
||||
6 | #![deny(missing_docs)]
|
||||
| ^^^^^^^^^^^^
|
||||
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: missing documentation for a struct field
|
||||
--> $DIR/deny_missing_docs.rs:12:13
|
||||
|
|
||||
12 | pub undocumented_field: u8,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: missing documentation for a struct field
|
||||
--> $DIR/deny_missing_docs.rs:18:13
|
||||
|
|
||||
18 | pub documented_field: u8,
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: missing documentation for a struct
|
||||
--> $DIR/deny_missing_docs.rs:9:1
|
||||
|
|
||||
9 | #[cxx::bridge]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: missing documentation for a struct field
|
||||
--> $DIR/deny_missing_docs.rs:9:1
|
||||
|
|
||||
9 | #[cxx::bridge]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: missing documentation for an associated constant
|
||||
--> $DIR/deny_missing_docs.rs:9:1
|
||||
|
|
||||
9 | #[cxx::bridge]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: missing documentation for a type alias
|
||||
--> $DIR/deny_missing_docs.rs:9:1
|
||||
|
|
||||
9 | #[cxx::bridge]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: missing documentation for a function
|
||||
--> $DIR/deny_missing_docs.rs:9:1
|
||||
|
|
||||
9 | #[cxx::bridge]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
Loading…
Reference in New Issue
Block a user