Correct warning message in restricted visibility

This commit is contained in:
yuk1ty
2025-05-03 20:10:56 +09:00
parent d2eadb7a94
commit 265b10fe2e
4 changed files with 57 additions and 2 deletions

View File

@@ -297,7 +297,10 @@ impl Visibility {
} else if restricted_id == tcx.parent_module_from_def_id(def_id).to_local_def_id() {
"pub(self)".to_string()
} else {
format!("pub({})", tcx.item_name(restricted_id.to_def_id()))
format!(
"pub(in crate{})",
tcx.def_path(restricted_id.to_def_id()).to_string_no_crate_verbose()
)
}
}
ty::Visibility::Public => "pub".to_string(),