From 83f84ff1bc002ef33c359626f6cafbd22c5d294d Mon Sep 17 00:00:00 2001 From: Nick Cameron Date: Wed, 15 Mar 2017 08:58:04 +1300 Subject: [PATCH] Use out-of-tree rustc serialize And remove a few data structures in favour of rls-data ones --- src/Cargo.lock | 24 ++++----- src/librustc_save_analysis/Cargo.toml | 3 +- src/librustc_save_analysis/data.rs | 60 ++++++++++----------- src/librustc_save_analysis/dump_visitor.rs | 2 +- src/librustc_save_analysis/external_data.rs | 57 +++++++++----------- src/librustc_save_analysis/json_dumper.rs | 27 ++++------ src/librustc_save_analysis/lib.rs | 2 +- 7 files changed, 80 insertions(+), 95 deletions(-) diff --git a/src/Cargo.lock b/src/Cargo.lock index f7fcedf26d5e..818a6c2f7c5c 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -27,7 +27,7 @@ version = "0.0.0" dependencies = [ "build_helper 0.1.0", "core 0.0.0", - "gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.44 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.0.0", ] @@ -75,7 +75,7 @@ dependencies = [ "build_helper 0.1.0", "cmake 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", "filetime 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.44 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", @@ -122,7 +122,7 @@ name = "cmake" version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -140,7 +140,7 @@ version = "0.0.0" dependencies = [ "build_helper 0.1.0", "core 0.0.0", - "gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -196,7 +196,7 @@ name = "flate" version = "0.0.0" dependencies = [ "build_helper 0.1.0", - "gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -205,7 +205,7 @@ version = "0.0.0" [[package]] name = "gcc" -version = "0.3.43" +version = "0.3.44" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -410,7 +410,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "rls-data" version = "0.1.0" -source = "git+https://github.com/nrc/rls-data#eb8de823771ef33edf78dc18fc0b279e6c4b6336" +source = "git+https://github.com/nrc/rls-data#aa5268cae09f4594303b0560c55627dfa8f75839" dependencies = [ "rls-span 0.1.0 (git+https://github.com/nrc/rls-span)", "rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", @@ -604,7 +604,7 @@ name = "rustc_llvm" version = "0.0.0" dependencies = [ "build_helper 0.1.0", - "gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.44 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_bitflags 0.0.0", ] @@ -719,7 +719,7 @@ dependencies = [ "log 0.0.0", "rls-data 0.1.0 (git+https://github.com/nrc/rls-data)", "rustc 0.0.0", - "serialize 0.0.0", + "rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", "syntax 0.0.0", "syntax_pos 0.0.0", ] @@ -779,7 +779,7 @@ version = "0.0.0" dependencies = [ "arena 0.0.0", "build_helper 0.1.0", - "gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.44 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.0.0", "rustc 0.0.0", "rustc_back 0.0.0", @@ -827,7 +827,7 @@ dependencies = [ "collections 0.0.0", "compiler_builtins 0.0.0", "core 0.0.0", - "gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.44 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.0.0", "panic_abort 0.0.0", "panic_unwind 0.0.0", @@ -998,7 +998,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum env_logger 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "15abd780e45b3ea4f76b4e9a26ff4843258dd8a3eed2775a0e7368c2e7936c2f" "checksum env_logger 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e3856f1697098606fc6cb97a93de88ca3f3bc35bb878c725920e6e82ecf05e83" "checksum filetime 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "5363ab8e4139b8568a6237db5248646e5a8a2f89bd5ccb02092182b11fd3e922" -"checksum gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)" = "c07c758b972368e703a562686adb39125707cc1ef3399da8c019fc6c2498a75d" +"checksum gcc 0.3.44 (registry+https://github.com/rust-lang/crates.io-index)" = "a32cd40070d7611ab76343dcb3204b2bb28c8a9450989a83a3d590248142f439" "checksum getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9047cfbd08a437050b363d35ef160452c5fe8ea5187ae0a624708c91581d685" "checksum handlebars 0.25.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b2249f6f0dc5a3bb2b3b1a8f797dfccbc4b053344d773d654ad565e51427d335" "checksum itoa 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eb2f404fbc66fd9aac13e998248505e7ecb2ad8e44ab6388684c5fb11c6c251c" diff --git a/src/librustc_save_analysis/Cargo.toml b/src/librustc_save_analysis/Cargo.toml index 130e4fd6266f..c4cbe426548a 100644 --- a/src/librustc_save_analysis/Cargo.toml +++ b/src/librustc_save_analysis/Cargo.toml @@ -12,6 +12,7 @@ crate-type = ["dylib"] log = { path = "../liblog" } rustc = { path = "../librustc" } syntax = { path = "../libsyntax" } -serialize = { path = "../libserialize" } +# FIXME should move rustc serialize out of tree +rustc-serialize = "0.3" syntax_pos = { path = "../libsyntax_pos" } rls-data = { git = "https://github.com/nrc/rls-data" } diff --git a/src/librustc_save_analysis/data.rs b/src/librustc_save_analysis/data.rs index 6a80b703d9da..d4ded71a3339 100644 --- a/src/librustc_save_analysis/data.rs +++ b/src/librustc_save_analysis/data.rs @@ -28,7 +28,7 @@ pub struct CrateData { /// Data for any entity in the Rust language. The actual data contained varies /// with the kind of entity being queried. See the nested structs for details. -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub enum Data { /// Data for Enums. EnumData(EnumData), @@ -79,7 +79,7 @@ pub enum Data { VariableRefData(VariableRefData), } -#[derive(Eq, PartialEq, Clone, Copy, Debug, RustcEncodable)] +#[derive(Eq, PartialEq, Clone, Copy, Debug)] pub enum Visibility { Public, Restricted, @@ -109,7 +109,7 @@ impl<'a> From<&'a hir::Visibility> for Visibility { } /// Data for the prelude of a crate. -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct CratePreludeData { pub crate_name: String, pub crate_root: String, @@ -118,7 +118,7 @@ pub struct CratePreludeData { } /// Data for enum declarations. -#[derive(Clone, Debug, RustcEncodable)] +#[derive(Clone, Debug)] pub struct EnumData { pub id: NodeId, pub name: String, @@ -134,7 +134,7 @@ pub struct EnumData { } /// Data for extern crates. -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct ExternCrateData { pub id: NodeId, pub name: String, @@ -145,7 +145,7 @@ pub struct ExternCrateData { } /// Data about a function call. -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct FunctionCallData { pub span: Span, pub scope: NodeId, @@ -153,7 +153,7 @@ pub struct FunctionCallData { } /// Data for all kinds of functions and methods. -#[derive(Clone, Debug, RustcEncodable)] +#[derive(Clone, Debug)] pub struct FunctionData { pub id: NodeId, pub name: String, @@ -170,14 +170,14 @@ pub struct FunctionData { } /// Data about a function call. -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct FunctionRefData { pub span: Span, pub scope: NodeId, pub ref_id: DefId, } -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct ImplData { pub id: NodeId, pub span: Span, @@ -186,7 +186,7 @@ pub struct ImplData { pub self_ref: Option, } -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] // FIXME: this struct should not exist. However, removing it requires heavy // refactoring of dump_visitor.rs. See PR 31838 for more info. pub struct ImplData2 { @@ -200,7 +200,7 @@ pub struct ImplData2 { pub self_ref: Option, } -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct InheritanceData { pub span: Span, pub base_id: DefId, @@ -208,7 +208,7 @@ pub struct InheritanceData { } /// Data about a macro declaration. -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct MacroData { pub span: Span, pub name: String, @@ -217,7 +217,7 @@ pub struct MacroData { } /// Data about a macro use. -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct MacroUseData { pub span: Span, pub name: String, @@ -230,7 +230,7 @@ pub struct MacroUseData { } /// Data about a method call. -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct MethodCallData { pub span: Span, pub scope: NodeId, @@ -239,7 +239,7 @@ pub struct MethodCallData { } /// Data for method declarations (methods with a body are treated as functions). -#[derive(Clone, Debug, RustcEncodable)] +#[derive(Clone, Debug)] pub struct MethodData { pub id: NodeId, pub name: String, @@ -256,7 +256,7 @@ pub struct MethodData { } /// Data for modules. -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct ModData { pub id: NodeId, pub name: String, @@ -272,7 +272,7 @@ pub struct ModData { } /// Data for a reference to a module. -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct ModRefData { pub span: Span, pub scope: NodeId, @@ -280,7 +280,7 @@ pub struct ModRefData { pub qualname: String } -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct StructData { pub span: Span, pub name: String, @@ -296,7 +296,7 @@ pub struct StructData { pub attributes: Vec, } -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct StructVariantData { pub span: Span, pub name: String, @@ -311,7 +311,7 @@ pub struct StructVariantData { pub attributes: Vec, } -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct TraitData { pub span: Span, pub id: NodeId, @@ -326,7 +326,7 @@ pub struct TraitData { pub attributes: Vec, } -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct TupleVariantData { pub span: Span, pub id: NodeId, @@ -342,7 +342,7 @@ pub struct TupleVariantData { } /// Data for a typedef. -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct TypeDefData { pub id: NodeId, pub name: String, @@ -357,7 +357,7 @@ pub struct TypeDefData { } /// Data for a reference to a type or trait. -#[derive(Clone, Debug, RustcEncodable)] +#[derive(Clone, Debug)] pub struct TypeRefData { pub span: Span, pub scope: NodeId, @@ -365,7 +365,7 @@ pub struct TypeRefData { pub qualname: String, } -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct UseData { pub id: NodeId, pub span: Span, @@ -375,7 +375,7 @@ pub struct UseData { pub visibility: Visibility, } -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct UseGlobData { pub id: NodeId, pub span: Span, @@ -385,7 +385,7 @@ pub struct UseGlobData { } /// Data for local and global variables (consts and statics). -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct VariableData { pub id: NodeId, pub kind: VariableKind, @@ -402,7 +402,7 @@ pub struct VariableData { pub attributes: Vec, } -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub enum VariableKind { Static, Const, @@ -412,7 +412,7 @@ pub enum VariableKind { /// Data for the use of some item (e.g., the use of a local variable, which /// will refer to that variables declaration (by ref_id)). -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct VariableRefData { pub name: String, pub span: Span, @@ -424,7 +424,7 @@ pub struct VariableRefData { /// Encodes information about the signature of a definition. This should have /// enough information to create a nice display about a definition without /// access to the source code. -#[derive(Clone, Debug, RustcEncodable)] +#[derive(Clone, Debug)] pub struct Signature { pub span: Span, pub text: String, @@ -438,7 +438,7 @@ pub struct Signature { /// An element of a signature. `start` and `end` are byte offsets into the `text` /// of the parent `Signature`. -#[derive(Clone, Debug, RustcEncodable)] +#[derive(Clone, Debug)] pub struct SigElement { pub id: DefId, pub start: usize, diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs index 85bef9f3170a..4efc3d7baa64 100644 --- a/src/librustc_save_analysis/dump_visitor.rs +++ b/src/librustc_save_analysis/dump_visitor.rs @@ -139,7 +139,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> { let lo_loc = self.span.sess.codemap().lookup_char_pos(c.span.lo); ExternalCrateData { name: c.name, - num: CrateNum::from_u32(c.number), + num: c.number, file_name: SpanUtils::make_path_string(&lo_loc.file.name), } }).collect(); diff --git a/src/librustc_save_analysis/external_data.rs b/src/librustc_save_analysis/external_data.rs index 355588700749..bf296283da42 100644 --- a/src/librustc_save_analysis/external_data.rs +++ b/src/librustc_save_analysis/external_data.rs @@ -21,7 +21,7 @@ use std::path::PathBuf; use data::{self, Visibility, SigElement}; -use rls_data::{SpanData, CratePreludeData}; +use rls_data::{SpanData, CratePreludeData, Attribute}; // FIXME: this should be pub(crate), but the current snapshot doesn't allow it yet pub trait Lower { @@ -55,13 +55,6 @@ pub fn span_from_span(span: Span, cm: &CodeMap) -> SpanData { } } -/// Represent an arbitrary attribute on a code element -#[derive(Clone, Debug, RustcEncodable)] -pub struct Attribute { - pub value: String, - pub span: SpanData, -} - impl Lower for Vec { type Target = Vec; @@ -102,7 +95,7 @@ impl Lower for data::CratePreludeData { } /// Data for enum declarations. -#[derive(Clone, Debug, RustcEncodable)] +#[derive(Clone, Debug)] pub struct EnumData { pub id: DefId, pub value: String, @@ -138,7 +131,7 @@ impl Lower for data::EnumData { } /// Data for extern crates. -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct ExternCrateData { pub id: DefId, pub name: String, @@ -164,7 +157,7 @@ impl Lower for data::ExternCrateData { } /// Data about a function call. -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct FunctionCallData { pub span: SpanData, pub scope: DefId, @@ -184,7 +177,7 @@ impl Lower for data::FunctionCallData { } /// Data for all kinds of functions and methods. -#[derive(Clone, Debug, RustcEncodable)] +#[derive(Clone, Debug)] pub struct FunctionData { pub id: DefId, pub name: String, @@ -222,7 +215,7 @@ impl Lower for data::FunctionData { } /// Data about a function call. -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct FunctionRefData { pub span: SpanData, pub scope: DefId, @@ -240,7 +233,7 @@ impl Lower for data::FunctionRefData { } } } -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct ImplData { pub id: DefId, pub span: SpanData, @@ -263,7 +256,7 @@ impl Lower for data::ImplData { } } -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct InheritanceData { pub span: SpanData, pub base_id: DefId, @@ -283,7 +276,7 @@ impl Lower for data::InheritanceData { } /// Data about a macro declaration. -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct MacroData { pub span: SpanData, pub name: String, @@ -305,7 +298,7 @@ impl Lower for data::MacroData { } /// Data about a macro use. -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct MacroUseData { pub span: SpanData, pub name: String, @@ -331,7 +324,7 @@ impl Lower for data::MacroUseData { } /// Data about a method call. -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct MethodCallData { pub span: SpanData, pub scope: DefId, @@ -353,7 +346,7 @@ impl Lower for data::MethodCallData { } /// Data for method declarations (methods with a body are treated as functions). -#[derive(Clone, Debug, RustcEncodable)] +#[derive(Clone, Debug)] pub struct MethodData { pub id: DefId, pub name: String, @@ -391,7 +384,7 @@ impl Lower for data::MethodData { } /// Data for modules. -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct ModData { pub id: DefId, pub name: String, @@ -427,7 +420,7 @@ impl Lower for data::ModData { } /// Data for a reference to a module. -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct ModRefData { pub span: SpanData, pub scope: DefId, @@ -448,7 +441,7 @@ impl Lower for data::ModRefData { } } -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct StructData { pub span: SpanData, pub name: String, @@ -485,7 +478,7 @@ impl Lower for data::StructData { } } -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct StructVariantData { pub span: SpanData, pub name: String, @@ -520,7 +513,7 @@ impl Lower for data::StructVariantData { } } -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct TraitData { pub span: SpanData, pub name: String, @@ -555,7 +548,7 @@ impl Lower for data::TraitData { } } -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct TupleVariantData { pub span: SpanData, pub id: DefId, @@ -591,7 +584,7 @@ impl Lower for data::TupleVariantData { } /// Data for a typedef. -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct TypeDefData { pub id: DefId, pub name: String, @@ -625,7 +618,7 @@ impl Lower for data::TypeDefData { } /// Data for a reference to a type or trait. -#[derive(Clone, Debug, RustcEncodable)] +#[derive(Clone, Debug)] pub struct TypeRefData { pub span: SpanData, pub scope: DefId, @@ -646,7 +639,7 @@ impl Lower for data::TypeRefData { } } -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct UseData { pub id: DefId, pub span: SpanData, @@ -671,7 +664,7 @@ impl Lower for data::UseData { } } -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct UseGlobData { pub id: DefId, pub span: SpanData, @@ -695,7 +688,7 @@ impl Lower for data::UseGlobData { } /// Data for local and global variables (consts and statics). -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct VariableData { pub id: DefId, pub name: String, @@ -736,7 +729,7 @@ impl Lower for data::VariableData { /// Data for the use of some item (e.g., the use of a local variable, which /// will refer to that variables declaration (by ref_id)). -#[derive(Debug, RustcEncodable)] +#[derive(Debug)] pub struct VariableRefData { pub name: String, pub span: SpanData, @@ -757,7 +750,7 @@ impl Lower for data::VariableRefData { } } -#[derive(Clone, Debug, RustcEncodable)] +#[derive(Clone, Debug)] pub struct Signature { pub span: SpanData, pub text: String, diff --git a/src/librustc_save_analysis/json_dumper.rs b/src/librustc_save_analysis/json_dumper.rs index 8a4146ad1050..3b7625bdcc1b 100644 --- a/src/librustc_save_analysis/json_dumper.rs +++ b/src/librustc_save_analysis/json_dumper.rs @@ -143,15 +143,6 @@ fn id_from_def_id(id: DefId) -> Id { } } -impl Into for Attribute { - fn into(self) -> rls_data::Attribute { - rls_data::Attribute { - value: self.value, - span: self.span, - } - } -} - impl Into for ExternCrateData { fn into(self) -> Import { Import { @@ -200,7 +191,7 @@ impl Into for EnumData { decl_id: None, docs: self.docs, sig: Some(self.sig.into()), - attributes: self.attributes.into_iter().map(|a| a.into()).collect(), + attributes: self.attributes, } } } @@ -219,7 +210,7 @@ impl Into for TupleVariantData { decl_id: None, docs: self.docs, sig: Some(self.sig.into()), - attributes: self.attributes.into_iter().map(|a| a.into()).collect(), + attributes: self.attributes, } } } @@ -237,7 +228,7 @@ impl Into for StructVariantData { decl_id: None, docs: self.docs, sig: Some(self.sig.into()), - attributes: self.attributes.into_iter().map(|a| a.into()).collect(), + attributes: self.attributes, } } } @@ -255,7 +246,7 @@ impl Into for StructData { decl_id: None, docs: self.docs, sig: Some(self.sig.into()), - attributes: self.attributes.into_iter().map(|a| a.into()).collect(), + attributes: self.attributes, } } } @@ -273,7 +264,7 @@ impl Into for TraitData { decl_id: None, docs: self.docs, sig: Some(self.sig.into()), - attributes: self.attributes.into_iter().map(|a| a.into()).collect(), + attributes: self.attributes, } } } @@ -291,7 +282,7 @@ impl Into for FunctionData { decl_id: None, docs: self.docs, sig: Some(self.sig.into()), - attributes: self.attributes.into_iter().map(|a| a.into()).collect(), + attributes: self.attributes, } } } @@ -309,7 +300,7 @@ impl Into for MethodData { decl_id: self.decl_id.map(|id| id_from_def_id(id)), docs: self.docs, sig: Some(self.sig.into()), - attributes: self.attributes.into_iter().map(|a| a.into()).collect(), + attributes: self.attributes, } } } @@ -345,7 +336,7 @@ impl Into for TypeDefData { decl_id: None, docs: String::new(), sig: self.sig.map(|s| s.into()), - attributes: self.attributes.into_iter().map(|a| a.into()).collect(), + attributes: self.attributes, } } } @@ -368,7 +359,7 @@ impl Into for VariableData { decl_id: None, docs: self.docs, sig: None, - attributes: self.attributes.into_iter().map(|a| a.into()).collect(), + attributes: self.attributes, } } } diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index 39b47b1645a7..ec637268d91a 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -26,7 +26,7 @@ #[macro_use] extern crate log; #[macro_use] extern crate syntax; -extern crate serialize as rustc_serialize; +extern crate rustc_serialize; extern crate syntax_pos; extern crate rls_data;