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 @@ -368,6 +368,8 @@ pub(crate) enum HrefError {
368
368
Private ,
369
369
// Not in external cache, href link should be in same page
370
370
NotInExternalCache ,
371
+ /// Refers to an unnamable item, such as one defined within a function or const block.
372
+ UnnamableItem ,
371
373
}
372
374
373
375
/// This function is to get the external macro path because they are not in the cache used in
@@ -498,7 +500,13 @@ fn url_parts(
498
500
builder. extend ( module_fqp. iter ( ) . copied ( ) ) ;
499
501
Ok ( builder)
500
502
}
501
- ExternalLocation :: Local => Ok ( href_relative_parts ( module_fqp, relative_to) ) ,
503
+ ExternalLocation :: Local => {
504
+ if module_fqp. iter ( ) . any ( |sym| sym. as_str ( ) == "_" ) {
505
+ Err ( HrefError :: UnnamableItem )
506
+ } else {
507
+ Ok ( href_relative_parts ( module_fqp, relative_to) )
508
+ }
509
+ }
502
510
ExternalLocation :: Unknown => Err ( HrefError :: DocumentationNotBuilt ) ,
503
511
}
504
512
}
You can’t perform that action at this time.
0 commit comments