Add struct to doc hidden usefulness ui tests

This commit is contained in:
Devin Ragotzy 2021-10-27 20:57:47 -04:00
parent f481dba3d4
commit ef0d99d8d4
3 changed files with 35 additions and 11 deletions

View File

@ -1,6 +1,14 @@
pub enum Foo {
pub enum HiddenEnum {
A,
B,
#[doc(hidden)]
C,
}
#[derive(Default)]
pub struct HiddenStruct {
pub one: u8,
pub two: bool,
#[doc(hidden)]
pub hide: usize,
}

View File

@ -0,0 +1,16 @@
// aux-build:hidden.rs
extern crate hidden;
use hidden::HiddenStruct;
fn main() {
let HiddenStruct { one, two, } = HiddenStruct::default();
//~^ pattern requires `..` due to inaccessible fields
let HiddenStruct { one, } = HiddenStruct::default();
//~^ pattern does not mention field `two` and inaccessible fields
let HiddenStruct { one, hide } = HiddenStruct::default();
//~^ pattern does not mention field `two`
}

View File

@ -2,29 +2,29 @@
extern crate hidden;
use hidden::Foo;
use hidden::HiddenEnum;
fn main() {
match Foo::A {
Foo::A => {}
Foo::B => {}
match HiddenEnum::A {
HiddenEnum::A => {}
HiddenEnum::B => {}
}
//~^^^^ non-exhaustive patterns: `_` not covered
match Foo::A {
Foo::A => {}
Foo::C => {}
match HiddenEnum::A {
HiddenEnum::A => {}
HiddenEnum::C => {}
}
//~^^^^ non-exhaustive patterns: `B` not covered
match Foo::A {
Foo::A => {}
match HiddenEnum::A {
HiddenEnum::A => {}
}
//~^^^ non-exhaustive patterns: `B` and `_` not covered
match None {
None => {}
Some(Foo::A) => {}
Some(HiddenEnum::A) => {}
}
//~^^^^ non-exhaustive patterns: `Some(B)` and `Some(_)` not covered
}