From 0c827f1b8eda5c9889a8d41bd5346431664b3344 Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Thu, 28 Mar 2024 13:02:58 +0000 Subject: [PATCH] Remove all traces of rustc-serialize --- Cargo.lock | 7 ------- Cargo.toml | 14 +++++++------- src/capture.rs | 49 ------------------------------------------------- src/lib.rs | 2 -- tests/smoke.rs | 12 ------------ 5 files changed, 7 insertions(+), 77 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ba8c53f4..af2bbad8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -44,7 +44,6 @@ dependencies = [ "miniz_oxide", "object", "rustc-demangle", - "rustc-serialize", "serde", "winapi", ] @@ -152,12 +151,6 @@ version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" -[[package]] -name = "rustc-serialize" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe834bc780604f4674073badbad26d7219cadfb4a2275802db12cbae17498401" - [[package]] name = "serde" version = "1.0.188" diff --git a/Cargo.toml b/Cargo.toml index e1ee1c37..9bd7b63c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,10 +20,10 @@ rust-version = "1.65.0" [workspace] members = ['crates/cpp_smoke_test', 'crates/as-if-std'] exclude = [ - 'crates/without_debuginfo', - 'crates/macos_frames_test', - 'crates/line-tables-only', - 'crates/debuglink', + 'crates/without_debuginfo', + 'crates/macos_frames_test', + 'crates/line-tables-only', + 'crates/debuglink', ] [dependencies] @@ -33,10 +33,11 @@ rustc-demangle = "0.1.4" # Optionally enable the ability to serialize a `Backtrace`, controlled through # the `serialize-*` features below. serde = { version = "1.0", optional = true, features = ['derive'] } -rustc-serialize = { version = "0.3", optional = true } # Optionally demangle C++ frames' symbols in backtraces. -cpp_demangle = { default-features = false, version = "0.4.0", optional = true, features = ["alloc"] } +cpp_demangle = { default-features = false, version = "0.4.0", optional = true, features = [ + "alloc", +] } [target.'cfg(not(all(windows, target_env = "msvc", not(target_vendor = "uwp"))))'.dependencies] miniz_oxide = { version = "0.7.0", default-features = false } @@ -71,7 +72,6 @@ std = [] # Methods of serialization # # Various features used for enabling rustc-serialize or syntex codegen. -serialize-rustc = ["rustc-serialize"] serialize-serde = ["serde"] #======================================= diff --git a/src/capture.rs b/src/capture.rs index 73d94dc4..d1691b89 100644 --- a/src/capture.rs +++ b/src/capture.rs @@ -21,7 +21,6 @@ use serde::{Deserialize, Serialize}; /// This function requires the `std` feature of the `backtrace` crate to be /// enabled, and the `std` feature is enabled by default. #[derive(Clone)] -#[cfg_attr(feature = "serialize-rustc", derive(RustcDecodable, RustcEncodable))] #[cfg_attr(feature = "serde", derive(Deserialize, Serialize))] pub struct Backtrace { // Frames here are listed from top-to-bottom of the stack @@ -116,7 +115,6 @@ impl Frame { /// This function requires the `std` feature of the `backtrace` crate to be /// enabled, and the `std` feature is enabled by default. #[derive(Clone)] -#[cfg_attr(feature = "serialize-rustc", derive(RustcDecodable, RustcEncodable))] #[cfg_attr(feature = "serde", derive(Deserialize, Serialize))] pub struct BacktraceSymbol { name: Option>, @@ -440,53 +438,6 @@ impl fmt::Debug for BacktraceSymbol { } } -#[cfg(feature = "serialize-rustc")] -mod rustc_serialize_impls { - use super::*; - use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; - - #[derive(RustcEncodable, RustcDecodable)] - struct SerializedFrame { - ip: usize, - symbol_address: usize, - module_base_address: Option, - symbols: Option>, - } - - impl Decodable for BacktraceFrame { - fn decode(d: &mut D) -> Result - where - D: Decoder, - { - let frame: SerializedFrame = SerializedFrame::decode(d)?; - Ok(BacktraceFrame { - frame: Frame::Deserialized { - ip: frame.ip, - symbol_address: frame.symbol_address, - module_base_address: frame.module_base_address, - }, - symbols: frame.symbols, - }) - } - } - - impl Encodable for BacktraceFrame { - fn encode(&self, e: &mut E) -> Result<(), E::Error> - where - E: Encoder, - { - let BacktraceFrame { frame, symbols } = self; - SerializedFrame { - ip: frame.ip() as usize, - symbol_address: frame.symbol_address() as usize, - module_base_address: frame.module_base_address().map(|addr| addr as usize), - symbols: symbols.clone(), - } - .encode(e) - } - } -} - #[cfg(feature = "serde")] mod serde_impls { use super::*; diff --git a/src/lib.rs b/src/lib.rs index 5b97281a..7b4bbc2e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -97,8 +97,6 @@ // irrelevant as this crate is developed out-of-tree. #![cfg_attr(backtrace_in_libstd, allow(warnings))] #![cfg_attr(not(feature = "std"), allow(dead_code))] -// We know this is deprecated, it's only here for back-compat reasons. -#![cfg_attr(feature = "rustc-serialize", allow(deprecated))] #[cfg(feature = "std")] #[macro_use] diff --git a/tests/smoke.rs b/tests/smoke.rs index b47f0232..9c87f530 100644 --- a/tests/smoke.rs +++ b/tests/smoke.rs @@ -230,18 +230,6 @@ fn many_threads() { } } -#[test] -#[cfg(feature = "rustc-serialize")] -fn is_rustc_serialize() { - extern crate rustc_serialize; - - fn is_encode() {} - fn is_decode() {} - - is_encode::(); - is_decode::(); -} - #[test] #[cfg(feature = "serde")] fn is_serde() {