Add struct to doc hidden usefulness ui tests
This commit is contained in:
parent
f481dba3d4
commit
ef0d99d8d4
@ -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,
|
||||
}
|
||||
|
16
src/test/ui/pattern/usefulness/doc-hidden-fields.rs
Normal file
16
src/test/ui/pattern/usefulness/doc-hidden-fields.rs
Normal 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`
|
||||
}
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user