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 {
367367 Private ,
368368 // Not in external cache, href link should be in same page
369369 NotInExternalCache ,
370+ /// Refers to an unnamable item, such as one defined within a function or const block.
371+ UnnamableItem ,
370372}
371373
372374// Panics if `syms` is empty.
@@ -509,7 +511,13 @@ fn url_parts(
509511 builder. extend ( module_fqp. iter ( ) . copied ( ) ) ;
510512 Ok ( builder)
511513 }
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+ }
513521 ExternalLocation :: Unknown => Err ( HrefError :: DocumentationNotBuilt ) ,
514522 }
515523}
You can’t perform that action at this time.
0 commit comments