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, A,
B, B,
#[doc(hidden)] #[doc(hidden)]
C, 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; extern crate hidden;
use hidden::Foo; use hidden::HiddenEnum;
fn main() { fn main() {
match Foo::A { match HiddenEnum::A {
Foo::A => {} HiddenEnum::A => {}
Foo::B => {} HiddenEnum::B => {}
} }
//~^^^^ non-exhaustive patterns: `_` not covered //~^^^^ non-exhaustive patterns: `_` not covered
match Foo::A { match HiddenEnum::A {
Foo::A => {} HiddenEnum::A => {}
Foo::C => {} HiddenEnum::C => {}
} }
//~^^^^ non-exhaustive patterns: `B` not covered //~^^^^ non-exhaustive patterns: `B` not covered
match Foo::A { match HiddenEnum::A {
Foo::A => {} HiddenEnum::A => {}
} }
//~^^^ non-exhaustive patterns: `B` and `_` not covered //~^^^ non-exhaustive patterns: `B` and `_` not covered
match None { match None {
None => {} None => {}
Some(Foo::A) => {} Some(HiddenEnum::A) => {}
} }
//~^^^^ non-exhaustive patterns: `Some(B)` and `Some(_)` not covered //~^^^^ non-exhaustive patterns: `Some(B)` and `Some(_)` not covered
} }