Skip to content

Commit af078ec

Browse files
authored
Deny warnings on CI to keep codebase warning-free (#394)
* Deny warnings on CI to keep codebase warning-free There's a ton of platforms here that we compile for and so it's only really all covered on CI. To help keep warnings out for everyone let's deny warnings on CI. * Fix a warning in dylib-dep No need to care much about FFI representation here since we control both sides. * Squash an elided lifetime warning * Try to fix an extern crate warning * Squash a windows warning * Really squash unused crate * Fix a serde warning * Fix cpp-demangle formatter warnings * Try to handle dead code a bit better * Fix a warning found in tests
1 parent e7cbd9b commit af078ec

File tree

13 files changed

+41
-32
lines changed

13 files changed

+41
-32
lines changed

.github/workflows/main.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,12 @@ jobs:
5252
- name: Install Rust (rustup)
5353
run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }}
5454
shell: bash
55+
- run: echo RUSTFLAGS=-Dwarnings >> $GITHUB_ENV
56+
shell: bash
5557
# full fidelity of backtraces on 32-bit msvc requires frame pointers, so
5658
# enable that for our tests
5759
- name: Force frame pointers
58-
run: echo RUSTFLAGS=-Cforce-frame-pointers >> $GITHUB_ENV
60+
run: echo RUSTFLAGS="-Cforce-frame-pointers $RUSTFLAGS" >> $GITHUB_ENV
5961
shell: bash
6062
if: matrix.thing == 'windows-msvc32'
6163
- run: cargo build --manifest-path crates/backtrace-sys/Cargo.toml
@@ -99,6 +101,8 @@ jobs:
99101
- name: Install Rust
100102
run: rustup update stable --no-self-update && rustup default stable
101103
shell: bash
104+
- run: echo RUSTFLAGS=-Dwarnings >> $GITHUB_ENV
105+
shell: bash
102106
- run: rustup target add aarch64-pc-windows-msvc
103107
- run: cargo test --no-run --target aarch64-pc-windows-msvc
104108
- run: cargo test --no-run --target aarch64-pc-windows-msvc --features verify-winapi
@@ -122,6 +126,7 @@ jobs:
122126
submodules: true
123127
- run: rustup target add ${{ matrix.target }}
124128
- run: |
129+
export RUSTFLAGS=-Dwarnings
125130
export SDK_PATH=`xcrun --show-sdk-path --sdk ${{ matrix.sdk }}`
126131
export RUSTFLAGS="-C link-arg=-isysroot -C link-arg=$SDK_PATH"
127132
cargo test --no-run --target ${{ matrix.target }}
@@ -156,6 +161,8 @@ jobs:
156161
run: rustup update stable && rustup default stable
157162
- run: rustup target add ${{ matrix.target }}
158163
- run: cargo generate-lockfile
164+
- run: echo RUSTFLAGS=-Dwarnings >> $GITHUB_ENV
165+
shell: bash
159166
- run: ./ci/run-docker.sh ${{ matrix.target }}
160167

161168
rustfmt:
@@ -182,6 +189,8 @@ jobs:
182189
- name: Install Rust
183190
run: rustup update nightly && rustup default nightly
184191
- run: rustup target add ${{ matrix.target }}
192+
- run: echo RUSTFLAGS=-Dwarnings >> $GITHUB_ENV
193+
shell: bash
185194
- run: cargo build --target ${{ matrix.target }}
186195

187196
msrv:

ci/run-docker.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ run() {
1818
--volume `pwd`/target:/checkout/target \
1919
--workdir /checkout \
2020
--privileged \
21+
--env RUSTFLAGS \
2122
backtrace \
2223
bash \
2324
-c 'PATH=$PATH:/rust/bin exec ci/run.sh'

crates/cpp_smoke_test/tests/smoke.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ extern "C" {
99

1010
#[test]
1111
#[ignore] // fixme(fitzgen/cpp_demangle#73)
12-
#[cfg(not(target_os = "windows"))]
1312
fn smoke_test_cpp() {
1413
static RAN_ASSERTS: AtomicBool = AtomicBool::new(false);
1514

crates/dylib-dep/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(improper_ctypes_definitions)]
2+
13
type Pos = (&'static str, u32);
24

35
macro_rules! pos {

src/backtrace/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ cfg_if::cfg_if! {
152152
mod dbghelp;
153153
use self::dbghelp::trace as trace_imp;
154154
pub(crate) use self::dbghelp::Frame as FrameImp;
155+
#[cfg(target_env = "msvc")] // only used in dbghelp symbolize
155156
pub(crate) use self::dbghelp::StackFrame;
156157
} else {
157158
mod noop;

src/capture.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -472,12 +472,10 @@ mod rustc_serialize_impls {
472472

473473
#[cfg(feature = "serde")]
474474
mod serde_impls {
475-
extern crate serde;
476-
477-
use self::serde::de::Deserializer;
478-
use self::serde::ser::Serializer;
479-
use self::serde::{Deserialize, Serialize};
480475
use super::*;
476+
use serde::de::Deserializer;
477+
use serde::ser::Serializer;
478+
use serde::{Deserialize, Serialize};
481479

482480
#[derive(Serialize, Deserialize)]
483481
struct SerializedFrame {

src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,15 @@
5252
// When we're building as part of libstd, silence all warnings since they're
5353
// irrelevant as this crate is developed out-of-tree.
5454
#![cfg_attr(backtrace_in_libstd, allow(warnings))]
55+
#![cfg_attr(not(feature = "std"), allow(dead_code))]
5556

5657
#[cfg(feature = "std")]
5758
#[macro_use]
5859
extern crate std;
5960

60-
// This is only used for gimli right now, so silence warnings elsewhere.
61-
#[cfg_attr(not(target_os = "linux"), allow(unused_extern_crates))]
61+
// This is only used for gimli right now, which is only used on some platforms,
62+
// so don't worry if it's unused in other configurations.
63+
#[allow(unused_extern_crates)]
6264
extern crate alloc;
6365

6466
pub use self::backtrace::{trace_unsynchronized, Frame};

src/symbolize/dbghelp.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,3 +214,5 @@ unsafe fn cache(filename: Option<*const [u16]>) -> Option<::std::ffi::OsString>
214214

215215
#[cfg(not(feature = "std"))]
216216
unsafe fn cache(_filename: Option<*const [u16]>) {}
217+
218+
pub unsafe fn clear_symbol_cache() {}

src/symbolize/gimli/coff.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ impl<'a> Object<'a> {
101101
self.symbols[i].1.name(self.strings).ok()
102102
}
103103

104-
pub(super) fn search_object_map(&self, _addr: u64) -> Option<(&Context, u64)> {
104+
pub(super) fn search_object_map(&self, _addr: u64) -> Option<(&Context<'_>, u64)> {
105105
None
106106
}
107107
}

src/symbolize/libbacktrace.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,3 +456,5 @@ pub unsafe fn resolve(what: ResolveWhat<'_>, cb: &mut dyn FnMut(&super::Symbol))
456456
&mut syminfo_state as *mut _ as *mut _,
457457
);
458458
}
459+
460+
pub unsafe fn clear_symbol_cache() {}

0 commit comments

Comments
 (0)