Skip to content

Fix CI again for lints and migrations #687

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 0 additions & 58 deletions .github/workflows/check-binary-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,6 @@ jobs:
cd library/backtrace
git remote add head-pr "https://github.com/$PR_SOURCE_REPO"
git fetch --all
- name: Build binary with base version of backtrace
uses: ./backtrace/.github/actions/build-with-patched-std
with:
backtrace-commit: ${{ env.BASE_COMMIT }}
main-rs: ${{ env.TEST_MAIN_RS }}
rustc-dir: ${{ env.RUSTC_DIR }}
id: size-reference
- name: Build binary with PR version of backtrace
uses: ./backtrace/.github/actions/build-with-patched-std
with:
Expand All @@ -100,54 +93,3 @@ jobs:
# run. Appending data to a single file within a matrix is subject to race
# conditions. So we write the size data to files with distinct names
# generated from the job index.
- name: Write sizes to file
uses: actions/github-script@v6
env:
SIZE_REFERENCE: ${{ steps.size-reference.outputs.test-binary-size }}
SIZE_UPDATED: ${{ steps.size-updated.outputs.test-binary-size }}
PLATFORM: ${{ matrix.platform }}
with:
script: |
const fs = require("fs");
const path = require("path");

fs.mkdirSync(process.env.SIZE_DATA_DIR, {recursive: true});

const output_data = JSON.stringify({
platform: process.env.PLATFORM,
reference: process.env.SIZE_REFERENCE,
updated: process.env.SIZE_UPDATED,
});

// The "wx" flag makes this fail if the file exists, which we want,
// because there should be no collisions.
fs.writeFileSync(
path.join(process.env.SIZE_DATA_DIR, process.env.SIZE_DATA_FILE),
output_data,
{ flag: "wx" },
);
- name: Upload size data
uses: actions/upload-artifact@v4
with:
name: size-files
path: ${{ env.SIZE_DATA_DIR }}/${{ env.SIZE_DATA_FILE }}
retention-days: 1
if-no-files-found: error
report:
name: Report binary size changes
runs-on: ubuntu-latest
needs: measure
permissions:
pull-requests: write
steps:
# Clone backtrace to access Github composite actions to report size.
- uses: actions/checkout@v4
- name: Download size data
uses: actions/download-artifact@v4
with:
name: size-files
path: ${{ env.SIZE_DATA_DIR }}
- name: Analyze and report size changes
uses: ./.github/actions/report-code-size-changes
with:
data-directory: ${{ env.SIZE_DATA_DIR }}
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
if: contains(matrix.os, 'ubuntu')
env:
RUSTFLAGS: "-C link-arg=-Wl,--compress-debug-sections=zlib"
- run: cargo test
- run: cargo test --features "ruzstd"
if: contains(matrix.os, 'ubuntu-24.04') ||
(contains(matrix.os, 'ubuntu') && contains(matrix.rust, 'nightly'))
env:
Expand Down Expand Up @@ -235,7 +235,7 @@ jobs:
matrix:
target:
- wasm32-unknown-unknown
- wasm32-wasi
- wasm32-wasip1
- x86_64-unknown-fuchsia
- x86_64-fortanix-unknown-sgx
- x86_64-unknown-illumos
Expand Down
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ windows-targets = "0.52.6"

[target.'cfg(not(all(windows, target_env = "msvc", not(target_vendor = "uwp"))))'.dependencies]
miniz_oxide = { version = "0.8", default-features = false }
ruzstd = { version = "0.7.2", default-features = false }
ruzstd = { version = "0.7.2", default-features = false, optional = true }
addr2line = { version = "0.24.0", default-features = false }
libc = { version = "0.2.156", default-features = false }

Expand All @@ -65,6 +65,8 @@ std = []

serialize-serde = ["serde"]

ruzstd = ["dep:ruzstd"]

#=======================================
# Deprecated/internal features
#
Expand Down
3 changes: 2 additions & 1 deletion src/dbghelp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
//! bridge when we get there.

#![allow(non_snake_case)]

// SAFETY: none! HERE BE DEMONS
#![allow(static_mut_refs)]
use alloc::vec::Vec;

use super::windows_sys::*;
Expand Down
2 changes: 2 additions & 0 deletions src/symbolize/gimli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,8 @@ impl Cache {
// never happen, and symbolicating backtraces would be ssssllllooooowwww.
static mut MAPPINGS_CACHE: Option<Cache> = None;

// SAFETY: this is literally why this fn is unsafe
#[allow(static_mut_refs)]
f(MAPPINGS_CACHE.get_or_insert_with(Cache::new))
}

Expand Down
8 changes: 5 additions & 3 deletions src/symbolize/gimli/elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ use super::{gimli, Context, Endian, EndianSlice, Mapping, Stash, Vec};
use alloc::sync::Arc;
use core::convert::{TryFrom, TryInto};
use core::str;
use object::elf::{
ELFCOMPRESS_ZLIB, ELFCOMPRESS_ZSTD, ELF_NOTE_GNU, NT_GNU_BUILD_ID, SHF_COMPRESSED,
};
#[cfg(feature = "ruzstd")]
use object::elf::ELFCOMPRESS_ZSTD;
use object::elf::{ELFCOMPRESS_ZLIB, ELF_NOTE_GNU, NT_GNU_BUILD_ID, SHF_COMPRESSED};
use object::read::elf::{CompressionHeader, FileHeader, SectionHeader, SectionTable, Sym};
use object::read::StringTable;
use object::{BigEndian, Bytes, NativeEndian};
Expand Down Expand Up @@ -231,6 +231,7 @@ impl<'a> Object<'a> {
decompress_zlib(data.0, buf)?;
return Some(buf);
}
#[cfg(feature = "ruzstd")]
ELFCOMPRESS_ZSTD => {
let size = usize::try_from(header.ch_size(self.endian)).ok()?;
let buf = stash.allocate(size);
Expand Down Expand Up @@ -357,6 +358,7 @@ fn decompress_zlib(input: &[u8], output: &mut [u8]) -> Option<()> {
}
}

#[cfg(feature = "ruzstd")]
fn decompress_zstd(mut input: &[u8], mut output: &mut [u8]) -> Option<()> {
use ruzstd::frame::ReadFrameHeaderError;
use ruzstd::frame_decoder::FrameDecoderError;
Expand Down
Loading