mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 22:31:43 +00:00
ItemTree: make variant fields inherit the enum's visibility
This commit is contained in:
parent
c7eb19ebf9
commit
28e3e683b2
2 changed files with 43 additions and 4 deletions
|
@ -359,3 +359,41 @@ trait Tr<'a, T: 'a>: Super {}
|
|||
"#]],
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn inherit_visibility() {
|
||||
check(
|
||||
r#"
|
||||
pub(crate) enum En {
|
||||
Var1(u8),
|
||||
Var2 {
|
||||
fld: u8,
|
||||
},
|
||||
}
|
||||
|
||||
pub(crate) trait Tr {
|
||||
fn f();
|
||||
fn method(&self) {}
|
||||
}
|
||||
"#,
|
||||
expect![[r#"
|
||||
pub(crate) enum En {
|
||||
Var1(
|
||||
pub(crate) 0: u8,
|
||||
),
|
||||
Var2 {
|
||||
pub(crate) fld: u8,
|
||||
},
|
||||
}
|
||||
|
||||
pub(crate) trait Tr<Self> {
|
||||
pub(crate) fn f() -> ();
|
||||
|
||||
// flags = 0x3
|
||||
pub(crate) fn method(
|
||||
_: &Self,
|
||||
) -> ();
|
||||
}
|
||||
"#]],
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue