diff options
| author | Matthew Jasper <mjjasper1@gmail.com> | 2020-06-11 15:49:57 +0100 |
|---|---|---|
| committer | Matthew Jasper <mjjasper1@gmail.com> | 2020-08-14 17:34:30 +0100 |
| commit | cbcef3effcf64bd0d89ea2dc8973e18d7fcf94c3 (patch) | |
| tree | cf11d5e77bdfe87b0a19d5f93ff251b256770325 /src/librustc_codegen_ssa | |
| parent | 55b9adfafa11b2ced5c0477c949fd875b19b3877 (diff) | |
| download | rust-cbcef3effcf64bd0d89ea2dc8973e18d7fcf94c3.tar.gz rust-cbcef3effcf64bd0d89ea2dc8973e18d7fcf94c3.zip | |
Rework `rustc_serialize`
- Move the type parameter from `encode` and `decode` methods to the trait. - Remove `UseSpecialized(En|De)codable` traits. - Remove blanket impls for references. - Add `RefDecodable` trait to allow deserializing to arena-allocated references safely. - Remove ability to (de)serialize HIR. - Create proc-macros `(Ty)?(En|De)codable` to help implement these new traits.
Diffstat (limited to 'src/librustc_codegen_ssa')
| -rw-r--r-- | src/librustc_codegen_ssa/Cargo.toml | 1 | ||||
| -rw-r--r-- | src/librustc_codegen_ssa/back/linker.rs | 2 | ||||
| -rw-r--r-- | src/librustc_codegen_ssa/lib.rs | 10 |
3 files changed, 8 insertions, 5 deletions
diff --git a/src/librustc_codegen_ssa/Cargo.toml b/src/librustc_codegen_ssa/Cargo.toml index 8fa0de37648..ff9dac372ab 100644 --- a/src/librustc_codegen_ssa/Cargo.toml +++ b/src/librustc_codegen_ssa/Cargo.toml @@ -33,5 +33,6 @@ rustc_fs_util = { path = "../librustc_fs_util" } rustc_hir = { path = "../librustc_hir" } rustc_incremental = { path = "../librustc_incremental" } rustc_index = { path = "../librustc_index" } +rustc_macros = { path = "../librustc_macros" } rustc_target = { path = "../librustc_target" } rustc_session = { path = "../librustc_session" } diff --git a/src/librustc_codegen_ssa/back/linker.rs b/src/librustc_codegen_ssa/back/linker.rs index f9a782af24c..5100ef8ad4f 100644 --- a/src/librustc_codegen_ssa/back/linker.rs +++ b/src/librustc_codegen_ssa/back/linker.rs @@ -35,7 +35,7 @@ pub fn disable_localization(linker: &mut Command) { /// For all the linkers we support, and information they might /// need out of the shared crate context before we get rid of it. -#[derive(RustcEncodable, RustcDecodable)] +#[derive(Encodable, Decodable)] pub struct LinkerInfo { exports: FxHashMap<CrateType, Vec<String>>, } diff --git a/src/librustc_codegen_ssa/lib.rs b/src/librustc_codegen_ssa/lib.rs index 85260d30a3d..6bfbda0f1d7 100644 --- a/src/librustc_codegen_ssa/lib.rs +++ b/src/librustc_codegen_ssa/lib.rs @@ -17,6 +17,8 @@ //! have to be implemented by each backends. #[macro_use] +extern crate rustc_macros; +#[macro_use] extern crate log; #[macro_use] extern crate rustc_middle; @@ -74,7 +76,7 @@ impl<M> ModuleCodegen<M> { } } -#[derive(Debug, RustcEncodable, RustcDecodable)] +#[derive(Debug, Encodable, Decodable)] pub struct CompiledModule { pub name: String, pub kind: ModuleKind, @@ -87,7 +89,7 @@ pub struct CachedModuleCodegen { pub source: WorkProduct, } -#[derive(Copy, Clone, Debug, PartialEq, RustcEncodable, RustcDecodable)] +#[derive(Copy, Clone, Debug, PartialEq, Encodable, Decodable)] pub enum ModuleKind { Regular, Metadata, @@ -110,7 +112,7 @@ bitflags::bitflags! { /// identifiers (`CrateNum`) to `CrateSource`. The other fields map `CrateNum` to the crate's own /// additional properties, so that effectively we can retrieve each dependent crate's `CrateSource` /// and the corresponding properties without referencing information outside of a `CrateInfo`. -#[derive(Debug, RustcEncodable, RustcDecodable)] +#[derive(Debug, Encodable, Decodable)] pub struct CrateInfo { pub panic_runtime: Option<CrateNum>, pub compiler_builtins: Option<CrateNum>, @@ -128,7 +130,7 @@ pub struct CrateInfo { pub dependency_formats: Lrc<Dependencies>, } -#[derive(RustcEncodable, RustcDecodable)] +#[derive(Encodable, Decodable)] pub struct CodegenResults { pub crate_name: Symbol, pub modules: Vec<CompiledModule>, |
