File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -1097,12 +1097,20 @@ impl clean::Visibility {
1097
1097
clean:: Inherited => Ok ( ( ) ) ,
1098
1098
1099
1099
clean:: Visibility :: Restricted ( vis_did) => {
1100
- if find_closest_parent_module ( tcx, item_did) == Some ( vis_did) {
1100
+ let parent_module = find_closest_parent_module ( tcx, item_did) ;
1101
+
1102
+ if parent_module == Some ( vis_did) {
1101
1103
// `pub(in foo)` where `foo` is the parent module
1102
1104
// is the same as no visibility modifier
1103
1105
Ok ( ( ) )
1104
1106
} else if vis_did. index == CRATE_DEF_INDEX {
1105
1107
write ! ( f, "pub(crate) " )
1108
+ } else if parent_module
1109
+ . map ( |parent| find_closest_parent_module ( tcx, parent) )
1110
+ . flatten ( )
1111
+ == Some ( vis_did)
1112
+ {
1113
+ write ! ( f, "pub(super) " )
1106
1114
} else {
1107
1115
f. write_str ( "pub(" ) ?;
1108
1116
let path = tcx. def_path ( vis_did) ;
You can’t perform that action at this time.
0 commit comments