Skip to content

Commit

Permalink
Merge #596 from ChrisDenton/windows-nightly
Browse files Browse the repository at this point in the history
Fix CI and remove rustc-serialize
  • Loading branch information
workingjubilee authored Mar 28, 2024
2 parents d80990b + 6bc4fca commit eabeb5e
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 82 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,18 @@ jobs:
rust: stable
- os: macos-latest
rust: nightly
# HACK(jubilee): 1.77 broke backtraces on Windows lol
- os: windows-latest
rust: 1.76.0-x86_64-msvc
rust: stable-x86_64-msvc
- os: windows-latest
rust: 1.76.0-i686-msvc
rust: stable-i686-msvc
- os: windows-latest
rust: 1.76.0-x86_64-gnu
rust: stable-x86_64-gnu
- os: windows-latest
rust: nightly-x86_64-msvc
- os: windows-latest
rust: nightly-i686-msvc
- os: windows-latest
rust: nightly-x86_64-gnu
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -52,7 +57,6 @@ jobs:

- run: cargo build
- run: cargo test
- run: cargo test --features "serialize-rustc"
- run: cargo test --features "serialize-serde"
- run: cargo test --features "verify-winapi"
- run: cargo test --features "cpp_demangle"
Expand Down
7 changes: 0 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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 }
Expand Down Expand Up @@ -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"]

#=======================================
Expand Down
49 changes: 0 additions & 49 deletions src/capture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<Vec<u8>>,
Expand Down Expand Up @@ -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<usize>,
symbols: Option<Vec<BacktraceSymbol>>,
}

impl Decodable for BacktraceFrame {
fn decode<D>(d: &mut D) -> Result<Self, D::Error>
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<E>(&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::*;
Expand Down
2 changes: 0 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
12 changes: 0 additions & 12 deletions tests/smoke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,18 +230,6 @@ fn many_threads() {
}
}

#[test]
#[cfg(feature = "rustc-serialize")]
fn is_rustc_serialize() {
extern crate rustc_serialize;

fn is_encode<T: rustc_serialize::Encodable>() {}
fn is_decode<T: rustc_serialize::Decodable>() {}

is_encode::<backtrace::Backtrace>();
is_decode::<backtrace::Backtrace>();
}

#[test]
#[cfg(feature = "serde")]
fn is_serde() {
Expand Down

0 comments on commit eabeb5e

Please sign in to comment.