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 @@ -367,6 +367,8 @@ pub(crate) enum HrefError {
367
367
Private ,
368
368
// Not in external cache, href link should be in same page
369
369
NotInExternalCache ,
370
+ /// Refers to an unnamable item, such as one defined within a function or const block.
371
+ UnnamableItem ,
370
372
}
371
373
372
374
// Panics if `syms` is empty.
@@ -509,7 +511,13 @@ fn url_parts(
509
511
builder. extend ( module_fqp. iter ( ) . copied ( ) ) ;
510
512
Ok ( builder)
511
513
}
512
- ExternalLocation :: Local => Ok ( href_relative_parts ( module_fqp, relative_to) ) ,
514
+ ExternalLocation :: Local => {
515
+ if module_fqp. iter ( ) . any ( |sym| sym. as_str ( ) == "_" ) {
516
+ Err ( HrefError :: UnnamableItem )
517
+ } else {
518
+ Ok ( href_relative_parts ( module_fqp, relative_to) )
519
+ }
520
+ }
513
521
ExternalLocation :: Unknown => Err ( HrefError :: DocumentationNotBuilt ) ,
514
522
}
515
523
}
You can’t perform that action at this time.
0 commit comments