about summary refs log tree commit diff
path: root/src/librustdoc/json
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2025-04-15 12:28:18 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2025-04-15 15:34:18 +1000
commit31320a925f53264a1905c5228392de9638bf2d52 (patch)
tree83abfc7fb5d8627e8322ef7159ccb5f744237053 /src/librustdoc/json
parente53f2a01cea46bd7f9181e76353bde190255ea20 (diff)
Remove another `kw::Empty` use in rustdoc.
Again by using `Option<Symbol>` to represent "no name".
Diffstat (limited to 'src/librustdoc/json')
-rw-r--r--src/librustdoc/json/conversions.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/librustdoc/json/conversions.rs b/src/librustdoc/json/conversions.rs
index 9d8eb70fbe0..5d85a4676b7 100644
--- a/src/librustdoc/json/conversions.rs
+++ b/src/librustdoc/json/conversions.rs
@@ -11,7 +11,7 @@ use rustc_hir::def::CtorKind;
 use rustc_hir::def_id::DefId;
 use rustc_metadata::rendered_const;
 use rustc_middle::{bug, ty};
-use rustc_span::{Pos, Symbol};
+use rustc_span::{Pos, Symbol, kw};
 use rustdoc_json_types::*;
 
 use crate::clean::{self, ItemId};
@@ -611,7 +611,10 @@ impl FromClean<clean::FnDecl> for FunctionSignature {
             inputs: inputs
                 .values
                 .into_iter()
-                .map(|arg| (arg.name.to_string(), arg.type_.into_json(renderer)))
+                // `_` is the most sensible name for missing param names.
+                .map(|arg| {
+                    (arg.name.unwrap_or(kw::Underscore).to_string(), arg.type_.into_json(renderer))
+                })
                 .collect(),
             output: if output.is_unit() { None } else { Some(output.into_json(renderer)) },
             is_c_variadic: c_variadic,