rust/tests/ui/did_you_mean/dont-suggest-doc-hidden-fields.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

39 lines
968 B
Rust
Raw Normal View History

2023-10-04 12:10:35 -05:00
// Regression test for issue #93210.
// aux-crate:doc_hidden_fields=doc-hidden-fields.rs
// edition: 2021
#[derive(Default)]
pub struct A {
#[doc(hidden)]
pub hello: i32,
pub bye: i32,
}
#[derive(Default)]
pub struct C {
pub hello: i32,
pub bye: i32,
}
fn main() {
// We want to list the field `hello` despite being marked
// `doc(hidden)` because it's defined in this crate.
A::default().hey;
//~^ ERROR no field `hey` on type `A`
2023-11-09 00:01:10 -06:00
//~| NOTE unknown field
2023-10-04 12:10:35 -05:00
//~| NOTE available fields are: `hello`, `bye`
// Here we want to hide the field `hello` since it's marked
// `doc(hidden)` and comes from an external crate.
doc_hidden_fields::B::default().hey;
//~^ ERROR no field `hey` on type `B`
2023-11-09 00:01:10 -06:00
//~| NOTE unknown field
//~| NOTE available field is: `bye`
2023-10-04 12:10:35 -05:00
C::default().hey;
//~^ ERROR no field `hey` on type `C`
2023-11-09 00:01:10 -06:00
//~| NOTE unknown field
2023-10-04 12:10:35 -05:00
//~| NOTE available fields are: `hello`, `bye`
}