Skip to content

Commit

Permalink
Update rustc option for instrument-coverage (#1377)
Browse files Browse the repository at this point in the history
* chore: update rustc flag for instrument-coverage

In nightly, the compiler flag graduated from -Z to
-C (stable options).

* CI: link dead code for coverage

Throw in -C link-dead-code into the compiler flags for the
nightly-coverage CI job.

* Fix prelude imports

Remove imports that are reported as unused by the nightly compiler,
override the lint for the vec macro import that is actually used.

* Restore vec macro import in prelude

Override the lint more selectively, specifically for this macro
re-export.
  • Loading branch information
mzabaluev committed Feb 21, 2024
1 parent 52f77d9 commit 6a46b48
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:
components: llvm-tools-preview
- run: cargo test-all-features
env:
RUSTFLAGS: '-Zinstrument-coverage'
RUSTFLAGS: '-C instrument-coverage -C link-dead-code'
LLVM_PROFILE_FILE: '%p-%m.profraw'
- name: Install grcov
run: |
Expand Down
1 change: 0 additions & 1 deletion config/src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// https://doc.rust-lang.org/src/alloc/prelude/v1.rs.html
pub use alloc::{
borrow::ToOwned,
boxed::Box,
format,
string::{String, ToString},
vec,
Expand Down
7 changes: 2 additions & 5 deletions light-client-verifier/src/prelude.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
// Re-export according to alloc::prelude::v1 because it is not yet stabilized
// https://doc.rust-lang.org/src/alloc/prelude/v1.rs.html
#[allow(unused_imports)]
pub use alloc::vec;
pub use alloc::{
borrow::ToOwned,
boxed::Box,
format,
string::{String, ToString},
vec,
vec::Vec,
};
// will be included in 2021 edition.
pub use core::convert::{TryFrom, TryInto};
pub use core::prelude::v1::*;
5 changes: 3 additions & 2 deletions proto/src/prelude.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// Re-export according to alloc::prelude::v1 because it is not yet stabilized
// https://doc.rust-lang.org/src/alloc/prelude/v1.rs.html

#[allow(unused_imports)]
pub use alloc::vec;
pub use alloc::{
borrow::ToOwned,
boxed::Box,
format,
string::{String, ToString},
vec,
vec::Vec,
};
pub use core::prelude::v1::*;

0 comments on commit 6a46b48

Please sign in to comment.