diff options
| author | bors <bors@rust-lang.org> | 2015-10-08 07:39:06 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-10-08 07:39:06 +0000 |
| commit | 88898e6ca72d46a237ad6dd65e21889cdb4558a2 (patch) | |
| tree | 9715063c5c8d622915c30831cd20e3ca985613a4 /src/libcore | |
| parent | 2d405afeb00f1c133d62354903ff356d4c933570 (diff) | |
| parent | e8021808cb7c1d33551141dd867ffd9bebb65e4a (diff) | |
| download | rust-88898e6ca72d46a237ad6dd65e21889cdb4558a2.tar.gz rust-88898e6ca72d46a237ad6dd65e21889cdb4558a2.zip | |
Auto merge of #28892 - cristicbz:default-wrapping, r=alexcrichton
It's not very common to store `Wrapping` values, but I kept wrapping and unwrapping a hash value when I taking it out of a struct to do operations on it. I couldn't store the hash as `Wrapping<u64>` because I wanted to be able to `#[derive(Default)]` for the struct. At any rate, it feels to me that `Wrapping<T>` should implement pretty much everything `T` does. I left out `#[derive(Hash)]` since I'd be hard pressed to find a use case and wanted to avoid the extra generated code, but maybe I should add that too?
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/num/mod.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 6507bb7bf8c..e942e8b6923 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -39,7 +39,7 @@ use slice::SliceExt; /// all standard arithmetic operations on the underlying value are /// intended to have wrapping semantics. #[stable(feature = "rust1", since = "1.0.0")] -#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Debug)] +#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Debug, Default)] pub struct Wrapping<T>(#[stable(feature = "rust1", since = "1.0.0")] pub T); pub mod wrapping; |
