Skip to content

Commit 8fe8ff8

Browse files
committed
Remove unused doctest and test more in Miri
1 parent 06295dc commit 8fe8ff8

2 files changed

Lines changed: 7 additions & 19 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@
102102
"uses": "actions-rs/cargo@v1",
103103
"with": {
104104
"command": "miri",
105-
# `miri` does not support the `macros` feature as it uses IO.
106-
"args": "test --features arbitrary1,bytemuck1,num-traits02,serde1,zerocopy,std",
105+
"args": "test --workspace --all-features",
107106
},
108107
},
109108
],

optimization-tests/src/lib.rs

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,4 @@
11
//! Checking compilation with optimizations for the `assert_unchecked` range tests in `unsafe_api`.
2-
//!
3-
//! ```rust,compile_fail
4-
//! const LOWER_BOUND: usize = 15;
5-
//!
6-
//! let bounded = bounded_integer::BoundedUsize::<LOWER_BOUND, 20>::new_saturating(15);
7-
//! let bounded = core::hint::black_box(bounded);
8-
//!
9-
//! optimization_tests::assert_optimized_out!(
10-
//! bounded.get() <= LOWER_BOUND
11-
//! )
12-
//! optimization_tests::assert_optimized_out!(
13-
//! *bounded.get_ref() <= LOWER_BOUND
14-
//! )
15-
//! optimization_tests::assert_optimized_out!(
16-
//! *unsafe { bounded.get_mut() } <= LOWER_BOUND
17-
//! )
18-
//! ```
192
203
// We should not export anything when not running tests
214
#![cfg(test)]
@@ -40,6 +23,12 @@ macro_rules! optimizer_assert_guaranteed {
4023
};
4124
}
4225

26+
// If you uncomment this, the tests must fail to pass:
27+
// #[test]
28+
// fn should_fail() {
29+
// optimizer_assert_guaranteed!(core::hint::black_box(true));
30+
// }
31+
4332
/// Assert that the inner value is statically enforced to be between the bounds `LO` and
4433
/// `HI` inclusive.
4534
fn range_check_optimized_out_usize<const LO: usize, const HI: usize>(expected: usize) {

0 commit comments

Comments
 (0)