mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-30 11:37:31 +00:00
Optimize private visibility resolution
This commit is contained in:
parent
e129cdc202
commit
b3768cdc0e
10 changed files with 83 additions and 39 deletions
|
|
@ -141,10 +141,11 @@ pub fn print_variant_body_hir(db: &dyn DefDatabase, owner: VariantId, edition: E
|
|||
let FieldData { name, type_ref, visibility, is_unsafe } = data;
|
||||
match visibility {
|
||||
crate::item_tree::RawVisibility::Module(interned, _visibility_explicitness) => {
|
||||
w!(p, "{}", interned.display(db, p.edition))
|
||||
w!(p, "pub(in {})", interned.display(db, p.edition))
|
||||
}
|
||||
crate::item_tree::RawVisibility::Public => w!(p, "pub "),
|
||||
crate::item_tree::RawVisibility::PubCrate => w!(p, "pub(crate) "),
|
||||
crate::item_tree::RawVisibility::PubSelf(_) => w!(p, "pub(self) "),
|
||||
}
|
||||
if *is_unsafe {
|
||||
w!(p, "unsafe ");
|
||||
|
|
|
|||
|
|
@ -397,7 +397,6 @@ fn main() {
|
|||
fn underscore_import() {
|
||||
// This used to panic, because the default (private) visibility inside block expressions would
|
||||
// point into the containing `DefMap`, which visibilities should never be able to do.
|
||||
cov_mark::check!(adjust_vis_in_block_def_map);
|
||||
check_at(
|
||||
r#"
|
||||
mod m {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue