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,
|
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,
|
||||||
|
}
|
||||||
|
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;
|
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
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user