Skip to content

Commit 8645205

Browse files
authored
Merge pull request #49 from mbrubeck/transparent
Make structs repr(transparent)
2 parents d9b67a5 + 4a3b74b commit 8645205

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.travis.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
language: rust
2-
rust: nightly
2+
rust:
3+
- 1.28.0
4+
- nightly
5+
- beta
6+
- stable
37
sudo: false
48
env:
59
matrix:

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ const CANONICAL_ZERO_BITS: u64 = 0x0u64;
4242
/// NaN is sorted as *greater* than all other values and *equal*
4343
/// to itself, in contradiction with the IEEE standard.
4444
#[derive(Debug, Default, Clone, Copy)]
45+
#[repr(transparent)]
4546
pub struct OrderedFloat<T: Float>(pub T);
4647

4748
impl<T: Float> OrderedFloat<T> {
@@ -170,6 +171,7 @@ impl<T: Float> Bounded for OrderedFloat<T> {
170171
///
171172
/// A NaN value cannot be stored in this type.
172173
#[derive(PartialOrd, PartialEq, Debug, Default, Clone, Copy)]
174+
#[repr(transparent)]
173175
pub struct NotNan<T: Float>(T);
174176

175177
impl<T: Float> NotNan<T> {

0 commit comments

Comments
 (0)