diff options
| author | Josh Stone <cuviper@gmail.com> | 2019-03-27 18:15:41 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-03-27 18:15:41 -0700 |
| commit | 44c411ec6f5aea339fe66d5f22548323cbad2edb (patch) | |
| tree | 79eec0b76f2f6aecfa619a897f3355fcfb27aba1 /src/libstd/alloc.rs | |
| parent | 6e65ae779f84ae7e103c202d41338180988b4a62 (diff) | |
| parent | 8733b2ab0c6bfe60df594e41ee9b1ce1f8caeaa0 (diff) | |
| download | rust-44c411ec6f5aea339fe66d5f22548323cbad2edb.tar.gz rust-44c411ec6f5aea339fe66d5f22548323cbad2edb.zip | |
Rollup merge of #59451 - TimDiekmann:patch-1, r=sfackler
Add `Default` to `std::alloc::System`
`System` is a unit struct, thus, it can be constructed without any additional information. Therefore `Default` is a noop. However, in generic code, a `T: Default` may happen as in
```rust
#[derive(Default)]
struct Foo<A> {
allocator: A
}
```
Does this need a feature gate?
Should I also add `PartialEq/Eq/PartialOrd/Ord/Hash`?
Diffstat (limited to 'src/libstd/alloc.rs')
| -rw-r--r-- | src/libstd/alloc.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libstd/alloc.rs b/src/libstd/alloc.rs index a13da2901df..4241f47b661 100644 --- a/src/libstd/alloc.rs +++ b/src/libstd/alloc.rs @@ -130,7 +130,7 @@ pub use alloc_crate::alloc::*; /// program opts in to using jemalloc as the global allocator, `System` will /// still allocate memory using `malloc` and `HeapAlloc`. #[stable(feature = "alloc_system_type", since = "1.28.0")] -#[derive(Debug, Copy, Clone)] +#[derive(Debug, Default, Copy, Clone)] pub struct System; // The Alloc impl just forwards to the GlobalAlloc impl, which is in `std::sys::*::alloc`. |
