about summary refs log tree commit diff
path: root/src/librustdoc/json
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-12-18 05:55:24 +0000
committerbors <bors@rust-lang.org>2020-12-18 05:55:24 +0000
commitfee693d08e98d25f566075cbed73e12236c05abd (patch)
treebcaa85bb4059293663789644fb33e9f15b209d4a /src/librustdoc/json
parent8d006c06b571d4db9fb2ef5b5eb1af28f4ef3574 (diff)
parent44e226ceb753075b44bcaadf349b1d1b6a23ad8d (diff)
downloadrust-fee693d08e98d25f566075cbed73e12236c05abd.tar.gz
rust-fee693d08e98d25f566075cbed73e12236c05abd.zip
Auto merge of #80119 - GuillaumeGomez:str-to-symbol, r=jyn514
Continue String to Symbol conversion in rustdoc

Follow-up of https://github.com/rust-lang/rust/pull/80091.

This PR is already big enough so I'll stop here before the next one.

r? `@jyn514`
Diffstat (limited to 'src/librustdoc/json')
-rw-r--r--src/librustdoc/json/conversions.rs19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/librustdoc/json/conversions.rs b/src/librustdoc/json/conversions.rs
index 809cfb9d743..9dc27e3411d 100644
--- a/src/librustdoc/json/conversions.rs
+++ b/src/librustdoc/json/conversions.rs
@@ -120,7 +120,7 @@ impl From<clean::GenericArg> for GenericArg {
     fn from(arg: clean::GenericArg) -> Self {
         use clean::GenericArg::*;
         match arg {
-            Lifetime(l) => GenericArg::Lifetime(l.0),
+            Lifetime(l) => GenericArg::Lifetime(l.0.to_string()),
             Type(t) => GenericArg::Type(t.into()),
             Const(c) => GenericArg::Const(c.into()),
         }
@@ -163,7 +163,9 @@ impl From<clean::ItemKind> for ItemEnum {
         use clean::ItemKind::*;
         match item {
             ModuleItem(m) => ItemEnum::ModuleItem(m.into()),
-            ExternCrateItem(c, a) => ItemEnum::ExternCrateItem { name: c, rename: a },
+            ExternCrateItem(c, a) => {
+                ItemEnum::ExternCrateItem { name: c.to_string(), rename: a.map(|x| x.to_string()) }
+            }
             ImportItem(i) => ItemEnum::ImportItem(i.into()),
             StructItem(s) => ItemEnum::StructItem(s.into()),
             UnionItem(u) => ItemEnum::StructItem(u.into()),
@@ -302,7 +304,7 @@ impl From<clean::WherePredicate> for WherePredicate {
                 bounds: bounds.into_iter().map(Into::into).collect(),
             },
             RegionPredicate { lifetime, bounds } => WherePredicate::RegionPredicate {
-                lifetime: lifetime.0,
+                lifetime: lifetime.0.to_string(),
                 bounds: bounds.into_iter().map(Into::into).collect(),
             },
             EqPredicate { lhs, rhs } => {
@@ -323,7 +325,7 @@ impl From<clean::GenericBound> for GenericBound {
                     modifier: modifier.into(),
                 }
             }
-            Outlives(lifetime) => GenericBound::Outlives(lifetime.0),
+            Outlives(lifetime) => GenericBound::Outlives(lifetime.0.to_string()),
         }
     }
 }
@@ -365,7 +367,7 @@ impl From<clean::Type> for Type {
                 type_: Box::new((*type_).into()),
             },
             BorrowedRef { lifetime, mutability, type_ } => Type::BorrowedRef {
-                lifetime: lifetime.map(|l| l.0),
+                lifetime: lifetime.map(|l| l.0.to_string()),
                 mutable: mutability == ast::Mutability::Mut,
                 type_: Box::new((*type_).into()),
             },
@@ -503,7 +505,7 @@ impl From<clean::Import> for Import {
         match import.kind {
             Simple(s) => Import {
                 span: import.source.path.whole_name(),
-                name: s,
+                name: s.to_string(),
                 id: import.source.did.map(Into::into),
                 glob: false,
             },
@@ -519,7 +521,10 @@ impl From<clean::Import> for Import {
 
 impl From<clean::ProcMacro> for ProcMacro {
     fn from(mac: clean::ProcMacro) -> Self {
-        ProcMacro { kind: mac.kind.into(), helpers: mac.helpers }
+        ProcMacro {
+            kind: mac.kind.into(),
+            helpers: mac.helpers.iter().map(|x| x.to_string()).collect(),
+        }
     }
 }