Skip to content

Commit

Permalink
Deny strict provenance lints during testing (#572)
Browse files Browse the repository at this point in the history
When testing in CI on the nightly toolchain, deny the
`fuzzy_provenance_casts` and `lossy_provenance_casts` lints.
  • Loading branch information
joshlf committed Oct 30, 2023
1 parent 98a8dd3 commit 1ab6d68
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@
unused_qualifications,
variant_size_differences
)]
#![cfg_attr(
__INTERNAL_USE_ONLY_NIGHLTY_FEATURES_IN_TESTS,
deny(fuzzy_provenance_casts, lossy_provenance_casts)
)]
#![deny(
clippy::all,
clippy::alloc_instead_of_core,
Expand Down
7 changes: 4 additions & 3 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,10 +464,11 @@ impl<'a, T: ?Sized> AsAddress for &'a mut T {
impl<T: ?Sized> AsAddress for *const T {
#[inline(always)]
fn addr(self) -> usize {
// TODO(https://github.com/rust-lang/rust/issues/95228): Use `.addr()`
// instead of `as usize` once it's stable, and get rid of this `allow`.
// Currently, `as usize` is the only way to accomplish this.
// TODO(#181), TODO(https://github.com/rust-lang/rust/issues/95228): Use
// `.addr()` instead of `as usize` once it's stable, and get rid of this
// `allow`. Currently, `as usize` is the only way to accomplish this.
#[allow(clippy::as_conversions)]
#[cfg_attr(__INTERNAL_USE_ONLY_NIGHLTY_FEATURES_IN_TESTS, allow(lossy_provenance_casts))]
return self.cast::<()>() as usize;
}
}
Expand Down

0 comments on commit 1ab6d68

Please sign in to comment.